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

    Prepare for native iOS and Android api intellisense with NativeScript

    Nathan WalkerNathan Walker

    To prepare your development environment to code against native apis such as Objective C, Swift and Java, let's learn how to install tns-platform-declarations to provide rich intellisense support for all the native iOS and Android api’s. This lesson will cover how to modify your tsconfig.json and references.d.ts properly to ensure working with native api’s is smooth and as helpful as possible.

    nativescriptNativeScript
    angularAngular
    ^2.0.0
    androidAndroid
    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 Let's install the tns-platform-declarations, and let's save that to our devDependencies. Now we need to make a few modifications to our tsconfig. Let's reference the ES2016 library and then modify our references.

    00:19 NativeScript's core engineering team has provided some excellent examples on great project setup, and we'll use their references here and we'll set these up. You can see it references ES2016 tns-core-modules in the iOS and Android platform declarations. With this installed, you now get rich IntelliSense support on things like UI application, the shared application instance, key window.

    00:45 And in fact, you can go to Apple's API reference documentation and just browse the API that's now opened up to you. You'll find a rich set of classes in APIs. Things like NSNotificationCenter, where you can grab an instance of the default center and actually send events out -- which is kind of like Objective-C's EventBus system -- and access the APIs from, for instance, UI kit, which provides a rich API to say, for instance, the UI video controller.

    01:15 And just like you can browse Apple's API reference for Objective-C, you can browse Android's API reference for Android, where you have access to things like the Android Media Package -- where you can get access to the media player -- or Android's location package, where you have access to things like the Geocoder.

    01:37 Having this setup will help you dramatically in coding against native APIs, be it for iOS or Android.

    Discuss

    Discuss