Browse files

Add docs for Swift usage to RCTBridgeModule.h

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:

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.**

[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|



 [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] [] - 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
  • Loading branch information...
ejmartin504 authored and facebook-github-bot committed Mar 13, 2018
1 parent c136c54 commit ca898f4367083e0943603521a41c48dec403e6c9
Showing with 1 addition and 0 deletions.
  1. +1 −0 React/Base/RCTBridgeModule.h
@@ -83,6 +83,7 @@ RCT_EXTERN void RCTRegisterModule(Class); \
* to bridge features, such as sending events or making JS calls. This
* will be set automatically by the bridge when it initializes the module.
* To implement this in your module, just add `@synthesize bridge = _bridge;`
* If using Swift, add `@objc var bridge: RCTBridge!` to your module.
@property (nonatomic, weak, readonly) RCTBridge *bridge;

0 comments on commit ca898f4

Please sign in to comment.