I have an Objective-C application where I like to integrate Swift, but I have an odd issue.
I imported <#ProjectName#>-Swift.h
to my implementation file, where I needed the Swift Class. My Swift Class looks like this:
import Foundation
@objc class FileIconColor: NSObject {
@objc func fileIconColorForSuffix(suffix: NSString) -> UIColor {
var color:UIColor!
//Some huge calculations
return color
}
//Just for testing
@objc func test () {
println("Test")
}
}
I am able to call the Class, but I am not able to access the functions in the class; As you can see, the @objc
prefixes are there, on both the Class and its functions.
Do you know why this happens? I also build the project before I want to use the function, because the Swift bridging header first needs to be built, am I correct?
Oh and btw, I managed to access Objective-C code in my Swift Class. So there can't be much wrong (I manually created the Objective-C bridging header) :)
Thanks, David