Skip to content

Commit 3eced7f

Browse files
esbenvbfacebook-github-bot
authored andcommitted
Updated swift section to match current code base
Summary: <!-- Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html Happy contributing! --> Current documentation was outdated. Follow the swift section with a recent version of RN and see that it works? Closes #16260 Differential Revision: D6017759 Pulled By: hramos fbshipit-source-id: 5d3ea56b08427694016c39b7ace5b2d5c63c1f4c
1 parent 0cd69e8 commit 3eced7f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/NativeModulesIOS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class CalendarManager: NSObject {
439439
// Date is ready to use!
440440
}
441441
442-
override func constantsToExport() -> [String: Any]! {
442+
func constantsToExport() -> [String: Any]! {
443443
return ["someKey": "someValue"]
444444
}
445445
@@ -468,4 +468,6 @@ For those of you new to Swift and Objective-C, whenever you [mix the two languag
468468
#import <React/RCTBridgeModule.h>
469469
```
470470

471-
You can also use `RCT_EXTERN_REMAP_MODULE` and `RCT_EXTERN_REMAP_METHOD` to alter the JavaScript name of the module or methods you are exporting. For more information see [`RCTBridgeModule`](https://github.com/facebook/react-native/blob/master/React/Base/RCTBridgeModule.h).
471+
You can also use `RCT_EXTERN_REMAP_MODULE` and `_RCT_EXTERN_REMAP_METHOD` to alter the JavaScript name of the module or methods you are exporting. For more information see [`RCTBridgeModule`](https://github.com/facebook/react-native/blob/master/React/Base/RCTBridgeModule.h).
472+
473+
> **Important when making third party modules**: Static libraries with Swift are only supported in Xcode 9 and later. In order for the Xcode project to build when you use Swift in the iOS static library you include in the module, your main app project must contain Swift code and a bridging header itself. If your app project does not contain any Swift code, a workaround can be a single empty .swift file and an empty bridging header.

0 commit comments

Comments
 (0)