Skip to content

Commit 0f3d24c

Browse files
notjoshFacebook Github Bot
authored andcommitted
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 facebook#10176 Differential Revision: D4001604 Pulled By: hramos fbshipit-source-id: cd4143d19d2d375288a086b9d7995e75fe1e9170
1 parent fa5ad85 commit 0f3d24c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/NativeModulesIOS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ Let's say we have the same `CalendarManager` but as a Swift class:
383383
@objc(CalendarManager)
384384
class CalendarManager: NSObject {
385385

386-
@objc func addEvent(name: String, location: String, date: NSNumber) -> Void {
386+
@objc(addEvent:location:date:)
387+
func addEvent(name: String, location: String, date: NSNumber) -> Void {
387388
// Date is ready to use!
388389
}
389390

0 commit comments

Comments
 (0)