Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//: Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
@objc protocol Thing {
func doThing(x: String) throws -> String
}
@objc class RealThing: NSObject, Thing {
func doThing(x: String) throws -> String {
return "didAThing"
}
}
//Playground execution failed: /var/folders/v2/skmhdwgn26j4xzg89rjnfl7c0000gn/T/./lldb/792/playground36.swift:12:13: error: type 'RealThing' does not conform to protocol 'Thing'
//@objc class RealThing: NSObject, Thing {
// ^
// /var/folders/v2/skmhdwgn26j4xzg89rjnfl7c0000gn/T/./lldb/792/playground36.swift:9:7: note: protocol requires function 'doThing' with type '(String) throws -> String'
// func doThing(x: String) throws -> String
// ^
// /var/folders/v2/skmhdwgn26j4xzg89rjnfl7c0000gn/T/./lldb/792/playground36.swift:14:7: note: Objective-C method 'doThing:error:' provided by method 'doThing' does not match the requirement's selector ('doThing:')
// func doThing(x: String) throws -> String {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.