Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@brentsimmons
Created August 13, 2015 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentsimmons/ee9d819e43ca1c9ac001 to your computer and use it in GitHub Desktop.
Save brentsimmons/ee9d819e43ca1c9ac001 to your computer and use it in GitHub Desktop.
//: 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