Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protocol Init {
- init(data: [String: Any])
- }
- func httpGet<T: Init>(completion: (T) -> Void) {
- let data: [String: Any] = ["x": "Awesome"]
- completion(T(data: data))
- }
- struct Model: Init {
- let x: String
- init(data: [String: Any]) {
- x = data["x"]! as! String
- }
- }
- httpGet { (model: Model) in
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement