Skip to content

Instantly share code, notes, and snippets.

@schneiderandre
Created August 20, 2014 16:01
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 schneiderandre/9b6b06d72e8829bfb649 to your computer and use it in GitHub Desktop.
Save schneiderandre/9b6b06d72e8829bfb649 to your computer and use it in GitHub Desktop.
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