![]() The easiest way to expose your Swift code to Objective-C is by importing the Swift Bridging Header file ( ProjectName-Swift.h, which is automatically generated by Xcode) from the Precompiled Header file. Read more on this topic in the Apple’s documentation: Importing Objective-C into Swift. ![]() The Objective-C declarations are automatically available from any Swift file within that target, without any import statements! Use classes and other declarations from your custom Objective-C code with the same Swift syntax you use for system classes. Xcode offers to create this header when you add a Swift file to an existing Objective-C app or an Objective-C file to an existing Swift app: Inside this file, you import all the Objective-C classes that you need to be exposed (note that these Objective-C classes must be public). To access Objective-C code using Swift within the same target, you'll need an Objective-C bridging header file. ![]() It is recommended to read this article before, or during, migrating your Objective-C project to Swift and prior to reading this article.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |