Closed alecvance closed 6 years ago
It is enough to make the TimezoneMapper class derive from NSObject.
Please, could you show the code for
for someone who is still a Swift newbie. It is very difficult to find clear information on this.
NSObject was added awhile ago.
Note that now in Xcode 10, when updating the project for Swift 4, it's necessary to include @objcMembers in the Swift file for this to be able to be imported into an Objective-C project. Otherwise you will get a method not found error when compiling.
This article shows the use of the @objcMembers prefix: https://medium.com/swift2go/swift-4-and-objc-warnings-b520083f411f
I don't use Objective-C but feel free to send a PR.
On Tue, Dec 11, 2018 at 2:30 PM Alec Vance notifications@github.com wrote:
Note that now in Xcode 10, when updating the project for Swift 4, it's necessary to include @objcMembers in the Swift file for this to be able to be imported into an Objective-C project. Otherwise you will get a method not found error when compiling.
This article shows the use of the @objcMembers prefix: https://medium.com/swift2go/swift-4-and-objc-warnings-b520083f411f
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/drtimcooper/LatLongToTimezone/issues/18#issuecomment-446387548, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKU8oLTTulpuj0z-HhDoh6y1ivHGJo9ks5u4DH1gaJpZM4M2Pg2 .
Hi there!
To make the Swift class available from Objective-C all that's needed is to put @objc in front of the class definition, and make the TimezoneMapper class derive from NSObject. I'm using it now in this way. Thanks!