I'm trying to implement this optional protocol method from Objective-C in swift :
- (void)customHTTPProtocol:(CustomHTTPProtocol *)protocol logWithFormat:
(NSString *)format arguments:(va_list)arguments;
( cfr: https://developer.apple.com/library/ios/samplecode/CustomHTTPProtocol/Introduction/Intro.html ) I have written this method in swift :
func customHTTPProtocol(`protocol`: CustomHTTPProtocol!, logWithFormat format: String!, arguments: CVaListPointer) {
}
it complains that cannot satisfy optional requirement and suggests to add a @objc before method , but if I add @objc it gives an error ( CVaListPointer cannot be represented in Objective-C )
The problem is that this test fails:
if ([strongDelegate respondsToSelector:@selector(customHTTPProtocol:logWithFormat:arguments:)]) {
and the swift method is not called