These are snippets of JavaScript, assuming NativeScript bindings to the iOS native APIs, that allow one to invoke native iOS functionality. 📲
Equivalent (or similar) Swift code is provided where available. NativeScript is based on Obj-C interfaces, but I show Swift because I don't have any familiarity with Obj-C 🤷♂️
You can try these out by building a new NativeScript project. But I myself use NS:IDE, my open-source NativeScript run-time IDE.
First, I write the desired native code in Swift. Then I try rewriting that same code line-by-line my NativeScript Playground for iOS, which provides intellisense based on the incredible tns-platform-declarations. If I'm ever confused by the typings, I refer to the official Apple API documentation (ideally with 'Objective-C' selected as the language, which maps better to the NativeScript bindings) helps a lot here.
You can of course also start a TypeScript project of your own and use those platform declarations to get Intellisense. I just use NS:IDE to skip the source-rebuilding step (NS:IDE allows you to test the code at run-time).
- https://docs.nativescript.org/core-concepts/ios-runtime/types/ObjC-Classes
- https://docs.nativescript.org/core-concepts/ios-runtime/how-to/ObjC-Subclassing
- https://github.com/NativeScript/NativeScript/tree/master/tns-platform-declarations/ios/objc-x86_64
Now all moved into individual README.md files under folders of a corresponding name at the root of this repository. For example, accelerometer/README.md.
- React NativeScript (GitHub). A React Renderer for NativeScript!
- LinguaBrowse (iOS) on the App Store. A web browser for the foreign-language web. Made in Swift.
- LinguaBrowse (macOS) on the App Store. A web browser for the foreign-language web. Made in React Native + TypeScript + Swift.
- NS:IDE (iOS) on the App Store, GitHub (iOS) on the App Store. An IDE for exploring NativeScript... made in NativeScript.
- Plucky Box (iOS) on the App Store, GitHub, expo.io as Android/iOS – made in React Native + TypeScript.
- @LinguaBrowse – my Twitter account. I talk about NativeScript, React Native, TypeScript, Chinese, Japanese, and my apps on there.