An attempt to create a utility project that is used in conjunction with my company's iOS applications. I did this at a previous job, but it preceded Swift. I obviously would like to keep the whole implementation in quick, not Obj-C.
I tried the cocoapod route using this guide , but there are problems with the build there before I can even start using my utility code in the main project.
Now I'm trying to use only the "Cocoa Touch Static Library", whose language is Swift, and still have no luck. I imported the entire .xcodeproj file into my workspace. At the moment, I have only one .swift file, as well as the header file created by Xcode. My project is called IosUtilsTest .
In particular, my test file uses:
extension UIBarButtonItem { class func flexible() -> UIBarButtonItem { return UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil) } }
And in my application:
import IosUtilsTest .... toolbar.items = [UIBarButtonItem.flexible(), centeredButton, UIBarButtonItem.flexible()] ....
I get a compiler error that flexible does not exist.
I tried to include both <IosUtilsTest/IosUtilsTest-swift.h> and <IosUtilsTest/IosUtilsTest.h> in my bridge header.
Basically, it looks like the extension is not included in the assembly. FWIW - I remember that there was a problem with categories requiring a special build flag, so I tried this only with the class I was trying to create, and that was the same basic error.
source share