From b39aed4d0af1bdbf28dc66f342db35beeb6f799e Mon Sep 17 00:00:00 2001 From: Kevin deLeon Date: Sun, 7 Jun 2015 16:31:40 -0500 Subject: [PATCH 1/2] Adds additional info for creating Swift modules This may be common knowledge for most Swift/ObjC guys, but it took me quite a while to figure out why I was getting an error when creating/exporting my module. As a web guy coming to the "native" world, it was a bit confusing. I would imagine a lot of RCTN users will be in the same boat. --- docs/NativeModulesIOS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/NativeModulesIOS.md b/docs/NativeModulesIOS.md index f135454132af8c..64bc84ab0fd86c 100644 --- a/docs/NativeModulesIOS.md +++ b/docs/NativeModulesIOS.md @@ -302,4 +302,11 @@ RCT_EXTERN_METHOD(addEvent:(NSString *)name location:(NSString *)location date:( @end ``` +For those of you new to Swift and Objective-C, whenver you [mix the two languages in an iOS project](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html), you will also need an additional bridging file, known as a bridging header, to expose the Objective-C files to Swift. Xcode will offer to create this header file for you if you add your Swift file to your app through the Xcode `File>New File` menu option. You will need to import `RCTBridgeModule.h` in this header file. + +```objc +// CalendarManager-Bridging-Header.h +#import "RCTBridgeModule.h" +``` + 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). From 40b1976233a7e31796668ae056fe6181266a6310 Mon Sep 17 00:00:00 2001 From: Kevin deLeon Date: Sun, 7 Jun 2015 16:42:06 -0500 Subject: [PATCH 2/2] Fixes spelling error in requested change. --- docs/NativeModulesIOS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/NativeModulesIOS.md b/docs/NativeModulesIOS.md index 64bc84ab0fd86c..3f6fd4a7317da0 100644 --- a/docs/NativeModulesIOS.md +++ b/docs/NativeModulesIOS.md @@ -302,7 +302,7 @@ RCT_EXTERN_METHOD(addEvent:(NSString *)name location:(NSString *)location date:( @end ``` -For those of you new to Swift and Objective-C, whenver you [mix the two languages in an iOS project](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html), you will also need an additional bridging file, known as a bridging header, to expose the Objective-C files to Swift. Xcode will offer to create this header file for you if you add your Swift file to your app through the Xcode `File>New File` menu option. You will need to import `RCTBridgeModule.h` in this header file. +For those of you new to Swift and Objective-C, whenever you [mix the two languages in an iOS project](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html), you will also need an additional bridging file, known as a bridging header, to expose the Objective-C files to Swift. Xcode will offer to create this header file for you if you add your Swift file to your app through the Xcode `File>New File` menu option. You will need to import `RCTBridgeModule.h` in this header file. ```objc // CalendarManager-Bridging-Header.h