Last active
September 14, 2015 04:36
-
-
Save Cananito/13986bbb843e47f4e05a to your computer and use it in GitHub Desktop.
rdar://22678998 Swift 2.0 GM: Selector matching error when implementing an @objc protocol's function that throws.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc protocol P { | |
func execute() throws | |
// Solution: https://twitter.com/jckarter/status/643189428781846528 | |
// @objc(executeAndReturnError:) func execute() throws | |
} | |
class A : P { | |
// Error: Type 'A' foes not conform to protocol 'P' | |
// Detail 1: Protocol requires function 'execute()' with type '() throws -> ()' | |
// Detail 2: Objective-C method 'executeAndReturnError:' provided by method 'execute()' does not match the requirement's selector ('execute') | |
@objc func execute() throws { | |
try x() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment