⚠️ This lesson is retired and might contain outdated information.

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

Nathan Walker
InstructorNathan Walker
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 3 weeks ago

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.

[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.

egghead
egghead
~ 10 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today