Sto cercando di implementare questo metodo protocollo facoltativo da Objective-C in rapida:Implementare protocollo ObjectiveC in rapida
- (void)customHTTPProtocol:(CustomHTTPProtocol *)protocol logWithFormat:
(NSString *)format arguments:(va_list)arguments;
(cfr: https://developer.apple.com/library/ios/samplecode/CustomHTTPProtocol/Introduction/Intro.html) Ho scritto questo metodo in rapida:
func customHTTPProtocol(`protocol`: CustomHTTPProtocol!, logWithFormat format: String!, arguments: CVaListPointer) {
}
si lamenta che non può soddisfare il requisito facoltativo e suggerisce di aggiungere un @objc prima del metodo, ma se aggiungo @objc dà un errore (CVaListPointer non può essere rappresentato in Objective-C)
Il problema è che questo test non riesce:
if ([strongDelegate respondsToSelector:@selector(customHTTPProtocol:logWithFormat:arguments:)]) {
e il metodo rapido non è chiamato
Questo è stato già fatto, ho un altro problema, perché il metodo di protocollo è opzionale e (va_list) è forse tradotto male – atrebbi