This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Generate metadata TypeScript declarations for Objective C/Swift libraries on iOS

    Nathan WalkerNathan Walker

    Learn how to generate TypeScript declaration files for all native api’s for iOS, including any 3rd party Objective C/Swift libraries included in your project via Cocoapods or other means. This will allow you to view all the metadata for included iOS libraries to see what classes and apis are exposed to NativeScript.

    nativescriptNativeScript
    angularAngular
    ^2.0.0
    iosiOS
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:00 You can specify TNS_TypeScript_declarations_path, and this is going to equal a location to actually print out all the metadata for all the classes that are available. We're going to use a standard shell script variable for the present working directory.

    00:20 We'll just name this folder typingz with a Z, because some people do use typings with an S as a standard to put custom typings. Then we'll pass tns build ios. Now, if we go look in our project, we will see a typingz with a Z i386, and an x86 64 folder.

    00:40 We can take a look inside, and we have typescript definition files generated for all the metadata from Objective-C classes, but what is nice about this, is you will also get any third-party Objective-C libraries metadata generated.

    00:54 For instance, here is the Filestack API that we have included in our project now through the CocoaPod. We can scroll through this and actually see all the definitions of the classes which are made available by including that CocoaPod.

    01:09 This can be extremely useful when you're trying to see what is exposed and/or discrepancies between property names that may be indicated in the documentation for a pod, versus what the API actually exposes.

    Discuss

    Discuss