mirror of
https://github.com/status-im/react-native.git
synced 2025-01-26 17:30:25 +00:00
Updates Swift @objc export for recent Swift versions
Summary: As of Swift 3, [Swift converts Objective-C API names based on parameters](https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md), so the docs should explicitly declare what the Objective-C API is (because it's also used in the JavaScript side too). An alternative to this would be to update the Objective-C and JavaScript calls to be `addEventWithName:location:date:` / `addEventWithName()` based on the default Swift API, but I think the approach in the PR is most correct here. Closes https://github.com/facebook/react-native/pull/10176 Differential Revision: D4001604 Pulled By: hramos fbshipit-source-id: cd4143d19d2d375288a086b9d7995e75fe1e9170
This commit is contained in:
parent
fa5ad85252
commit
0f3d24c7fb
@ -383,7 +383,8 @@ Let's say we have the same `CalendarManager` but as a Swift class:
|
||||
@objc(CalendarManager)
|
||||
class CalendarManager: NSObject {
|
||||
|
||||
@objc func addEvent(name: String, location: String, date: NSNumber) -> Void {
|
||||
@objc(addEvent:location:date:)
|
||||
func addEvent(name: String, location: String, date: NSNumber) -> Void {
|
||||
// Date is ready to use!
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user