In Xcode 6 (beta 4 6A267n), I added a Framework (selecting Swift as the language) and the framework header has this comment: // In this header, you should import all the public headers of your framework using statements like #import
Through SO I found that you have to append "-Swift" to your header file name, however I was not able to get this to work.
I've also added $(SRCROOT) to my header search path.
To access and use swift classes or libraries in objective-c files start with an objective-c project that already contains some files. Add a new Swift file to the project. In the menu select File>New>File… then select Swift File, instead of Cocoa Touch Class. Name the file and hit create.
It sounds like you are trying to create your own Swift library? In which case, you do not need to create an external interface as described here:
Swift: how can I create external interface for static library (public headers analog in Objective-C .h)
With Swift you identify your public interface by marking classes and methods as public
.
The header that has the -Swift
suffix is a bridging header and is what you use to bridge Objective-C code so that it can be used in your Swift application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With