Included in plans:
After converting an Objective-C class (i.e.
MyViewController) to Swift (while you still have Objective-C files left in your project), we need to ensure that your Objective-C classes still have access to the converted Swift class (or a protocol).
Header (`.h`) files that reference
MyViewController will have a forward class declaration (i.e.
@class MyViewController) automatically generated. This is required because you cannot import the Swift Bridging Header from a header (
.h) file. Otherwise, this would create a circular referencing issue.
The same functionality also works for protocols: header files that reference a protocol (i.e.
MyViewControllerProtocol) will automatically generate a forward protocol declaration (i.e.
Implementation (`.m`) files will be able to access the Swift version of `MyViewController` automatically due to the Swift Bridging Header (
ProjectName-Swift.h) which is automatically imported from the Precompiled Header (
The Swift Bridging Header file (
ProjectName-Swift.h) is automatically generated by Xcode (rather than Swiftify) if the project compiles successfully and contains at least one Objective-C and one Swift file.
To disable automatically adding forward class declarations to header files, you can uncheck this option under Preferences (⌘+,) => Converter and toggle the corresponding checkbox:
Please sign in to leave a comment.