Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The service variable in ViewController should be able to take every type that conforms to the RESTServiceType Protocol. But this produces a Swift Compiler Error.
import UIKit
protocol RESTServiceType {
class func getData()
}
struct RESTService: RESTServiceType {
static func getData() {
println("Data")
}
}
class ViewController {
var service: RESTServiceType.Type = RESTService.self
func viewDidLoad() {
service.getData()
}
}
ViewController().viewDidLoad()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment