Skip to content

Commit 7b1bb91

Browse files
committed
feat: ns native add
1 parent 6c363d8 commit 7b1bb91

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

content/guide/adding-native-code.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ contributors:
1010

1111
If the native API you need is not exposed through [@nativescript/core](/core/#nativescript-core), [third party plugins](https://market.nativescript.org/) or [@nativescript/\* plugins](https://v8.docs.nativescript.org/plugins/index.html)), you can add it to your project and access it right away in TypeScript.
1212

13-
1. Add native code to [App_Resources](/project-structure/app-resources):
13+
Ever since [NativeScript 8.8](https://blog.nativescript.org/nativescript-8-8-announcement/#ns-native), you can use a single command to add platform language files and have them auto configured ready to use with:
14+
15+
```bash
16+
ns native add swift AwesomeClass
17+
# Swift file 'nativescript-project/App_Resources/iOS/src/AwesomeClass.swift' generated successfully.
18+
19+
ns native add objective-c OtherAwesomeClass
20+
# Module map 'nativescript-project/App_Resources/iOS/src/module.modulemap' has been updated with the header 'OtherAwesomeClass.h'.
21+
22+
ns native add kotlin com.company.AwesomeClass
23+
# Kotlin file 'nativescript-project/App_Resources/Android/src/main/java/com/company/AwesomeClass.kt' generated successfully.
24+
25+
ns native add java com.company.OtherAwesomeClass
26+
# Java file 'nativescript-project/App_Resources/Android/src/main/java/com/company/OtherAwesomeClass.java' generated successfully.
27+
```
28+
29+
1. You can also manually add native code to [App_Resources](/project-structure/app-resources):
1430
- [Adding Java/Kotlin code to an application](/guide/native-code/android)
1531
- [Adding ObjectiveC/Swift Code to an application](/guide/native-code/ios)
1632
2. Optionally [generate TypeScript types for the added APIs](/guide/native-code/generate-typings)

0 commit comments

Comments
 (0)