Skip to content

Commit ca898f4

Browse files
ejmartin504facebook-github-bot
authored andcommitted
Add docs for Swift usage to RCTBridgeModule.h
Summary: Clarifies how to get a reference to RCTBridge from a Swift RCTBridgeModule. <!-- 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! --> In writing native modules for Swift, I have run into issues where the documentation applies only to Objective-C and does not supply adequate information for how one might accomplish something in Swift. This is a good example, where the `synthesize` method simply does not apply to Swift code. [IOS][ENHANCEMENT][Base/RCTBridgeModule.h] Add documentation for Swift usage. <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes #18231 Differential Revision: D7262850 Pulled By: hramos fbshipit-source-id: c6babb3edd786be8571eb49258d594f2fb99141d
1 parent c136c54 commit ca898f4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

React/Base/RCTBridgeModule.h

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ RCT_EXTERN void RCTRegisterModule(Class); \
8383
* to bridge features, such as sending events or making JS calls. This
8484
* will be set automatically by the bridge when it initializes the module.
8585
* To implement this in your module, just add `@synthesize bridge = _bridge;`
86+
* If using Swift, add `@objc var bridge: RCTBridge!` to your module.
8687
*/
8788
@property (nonatomic, weak, readonly) RCTBridge *bridge;
8889

0 commit comments

Comments
 (0)