-
Notifications
You must be signed in to change notification settings - Fork 472
Swift ObjectiveC Interoperability
Nick Aiwazian edited this page Oct 8, 2015
·
2 revisions
If you want to consume Objective-C code from Swift, you'll need to use a [bridging header] (https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html).
If you didn't create one when you first created the project:
This can be done by File -> New -> File ... -> iOS -> Source -> Header File
. You'll want to name this file something like
YourProject-Bridging-Header.h
, but the name doesn't actually affect
the build process. You'll need to specify this file as a bridging
header in your project's Build Settings
.
You will then #import
every Objective-C header you want to expose to
Swift in this file.