Files
Martin Bektchiev 1c0218ea15 feat(tns-platform-declarations): Generate iOS typings from iOS 12.1 SDK (#6693)
* feat(tns-platform-declarations): Generate iOS typings from iOS 12.1 SDK

* Instructions for generating iOS typescript definitions
* Refactor `typings-gen.sh` to use {N} CLI and generate fuller
metadata for the system libraries
* Automatically generate `ios.d.ts` wrapper
* Add interop pointers and references as alternatives
to `string` for `char*` args
(implemented in https://github.com/NativeScript/ios-runtime/pull/1022)

BREAKING CHANGE: Several enum values have changed because
    they have been wrongly generated.

    To migrate your app or plugin code use the new names of the
    following:
    *  enum NSUnderlineStyle:
        - `StyleNone` -> `None`
        - `StyleSingle` -> `Single`
        - `StyleThick` -> `Thick`
        - `StyleDouble` -> `Double`
     * enum AVAudioSessionErrorCode:
        - `CodeNone` -> `None`
        - `CodeMediaServicesFailed` -> `MediaServicesFailed`
        - `CodeIsBusy` -> `IsBusy`
        - `CodeIncompatibleCategory` -> `IncompatibleCategory`
        - `CodeCannotInterruptOthers` -> `CannotInterruptOthers`
        - `CodeMissingEntitlement` -> `MissingEntitlement`
        - `CodeSiriIsRecording` -> `SiriIsRecording`
        - `CodeCannotStartPlaying` -> `CannotStartPlaying`
        - `CodeCannotStartRecording` -> `CannotStartRecording`
        - `CodeBadParam` -> `BadParam`
        - `CodeResourceNotAvailable` -> `ResourceNotAvailable`
        - `CodeUnspecified` -> `Unspecified`

* fix(ui/text-base): Update NSUnderlineStyle.StyleSingle constant

After the typings regeneration its and several others' names have
changed to the expected `NSUnderlineStyle.Single`.

* fix(tns-platform-declarations): Restore deprecated enum values

In order to not introduce a breaking change in a patch version, we
are keeping `Style...` and `Code...` values that have been wrongly
generated till now. In the next major/minor release of the package
when the typings are regenerated we can safely remove them.

Revert to using the deprecated one's in `text-base.ios.ts` so that
the introduction of this breaking change doesn't slip in undetected.

* fix(application.ios): Directly call presetnNativeScriptApp

We've been using `performSelectorWithObject` but it's
declaration has been manually added. Moreover it's more
convenient to directly call the method.
2018-12-13 17:04:13 +02:00

275 lines
5.6 KiB
TypeScript

declare class CLSActivity extends CLSObject {
static alloc(): CLSActivity; // inherited from NSObject
static new(): CLSActivity; // inherited from NSObject
readonly additionalActivityItems: NSArray<CLSActivityItem>;
readonly duration: number;
primaryActivityItem: CLSActivityItem;
progress: number;
readonly started: boolean;
addAdditionalActivityItem(activityItem: CLSActivityItem): void;
addProgressRangeFromStartToEnd(start: number, end: number): void;
start(): void;
stop(): void;
}
declare class CLSActivityItem extends CLSObject {
static alloc(): CLSActivityItem; // inherited from NSObject
static new(): CLSActivityItem; // inherited from NSObject
readonly identifier: string;
title: string;
}
declare class CLSBinaryItem extends CLSActivityItem {
static alloc(): CLSBinaryItem; // inherited from NSObject
static new(): CLSBinaryItem; // inherited from NSObject
value: boolean;
readonly valueType: CLSBinaryValueType;
constructor(o: { identifier: string; title: string; type: CLSBinaryValueType; });
initWithIdentifierTitleType(identifier: string, title: string, valueType: CLSBinaryValueType): this;
}
declare const enum CLSBinaryValueType {
TrueFalse = 0,
PassFail = 1,
YesNo = 2
}
declare class CLSContext extends CLSObject {
static alloc(): CLSContext; // inherited from NSObject
static new(): CLSContext; // inherited from NSObject
readonly active: boolean;
readonly currentActivity: CLSActivity;
displayOrder: number;
readonly identifier: string;
readonly parent: CLSContext;
title: string;
topic: string;
readonly type: CLSContextType;
universalLinkURL: NSURL;
constructor(o: { type: CLSContextType; identifier: string; title: string; });
addChildContext(child: CLSContext): void;
becomeActive(): void;
createNewActivity(): CLSActivity;
descendantMatchingIdentifierPathCompletion(identifierPath: NSArray<string> | string[], completion: (p1: CLSContext, p2: NSError) => void): void;
initWithTypeIdentifierTitle(type: CLSContextType, identifier: string, title: string): this;
removeFromParent(): void;
resignActive(): void;
}
declare var CLSContextTopicArtsAndMusic: string;
declare var CLSContextTopicComputerScienceAndEngineering: string;
declare var CLSContextTopicHealthAndFitness: string;
declare var CLSContextTopicLiteracyAndWriting: string;
declare var CLSContextTopicMath: string;
declare var CLSContextTopicScience: string;
declare var CLSContextTopicSocialScience: string;
declare var CLSContextTopicWorldLanguage: string;
declare const enum CLSContextType {
None = 0,
App = 1,
Chapter = 2,
Section = 3,
Level = 4,
Page = 5,
Task = 6,
Challenge = 7,
Quiz = 8,
Exercise = 9,
Lesson = 10,
Book = 11,
Game = 12,
Document = 13,
Audio = 14,
Video = 15
}
declare class CLSDataStore extends NSObject {
static alloc(): CLSDataStore; // inherited from NSObject
static new(): CLSDataStore; // inherited from NSObject
readonly activeContext: CLSContext;
delegate: CLSDataStoreDelegate;
readonly mainAppContext: CLSContext;
readonly runningActivity: CLSActivity;
static readonly shared: CLSDataStore;
contextsMatchingIdentifierPathCompletion(identifierPath: NSArray<string> | string[], completion: (p1: NSArray<CLSContext>, p2: NSError) => void): void;
contextsMatchingPredicateCompletion(predicate: NSPredicate, completion: (p1: NSArray<CLSContext>, p2: NSError) => void): void;
removeContext(context: CLSContext): void;
saveWithCompletion(completion: (p1: NSError) => void): void;
}
interface CLSDataStoreDelegate extends NSObjectProtocol {
createContextForIdentifierParentContextParentIdentifierPath(identifier: string, parentContext: CLSContext, parentIdentifierPath: NSArray<string> | string[]): CLSContext;
}
declare var CLSDataStoreDelegate: {
prototype: CLSDataStoreDelegate;
};
declare const enum CLSErrorCode {
None = 0,
ClassKitUnavailable = 1,
InvalidArgument = 2,
InvalidModification = 3,
AuthorizationDenied = 4,
DatabaseInaccessible = 5,
Limits = 6,
InvalidCreate = 7,
InvalidUpdate = 8,
PartialFailure = 9
}
declare var CLSErrorCodeDomain: string;
declare var CLSErrorObjectKey: string;
declare var CLSErrorUnderlyingErrorsKey: string;
declare class CLSObject extends NSObject implements NSSecureCoding {
static alloc(): CLSObject; // inherited from NSObject
static new(): CLSObject; // inherited from NSObject
readonly dateCreated: Date;
readonly dateLastModified: Date;
static readonly supportsSecureCoding: boolean; // inherited from NSSecureCoding
constructor(o: { coder: NSCoder; }); // inherited from NSCoding
encodeWithCoder(aCoder: NSCoder): void;
initWithCoder(aDecoder: NSCoder): this;
}
declare var CLSPredicateKeyPathDateCreated: string;
declare var CLSPredicateKeyPathIdentifier: string;
declare var CLSPredicateKeyPathParent: string;
declare var CLSPredicateKeyPathTitle: string;
declare var CLSPredicateKeyPathTopic: string;
declare var CLSPredicateKeyPathUniversalLinkURL: string;
declare class CLSQuantityItem extends CLSActivityItem {
static alloc(): CLSQuantityItem; // inherited from NSObject
static new(): CLSQuantityItem; // inherited from NSObject
quantity: number;
constructor(o: { identifier: string; title: string; });
initWithIdentifierTitle(identifier: string, title: string): this;
}
declare class CLSScoreItem extends CLSActivityItem {
static alloc(): CLSScoreItem; // inherited from NSObject
static new(): CLSScoreItem; // inherited from NSObject
maxScore: number;
score: number;
constructor(o: { identifier: string; title: string; score: number; maxScore: number; });
initWithIdentifierTitleScoreMaxScore(identifier: string, title: string, score: number, maxScore: number): this;
}