Created
May 7, 2016 06:15
-
-
Save sonsongithub/3a82044d66890a82f341ee157a9860f1 to your computer and use it in GitHub Desktop.
さっきのコード #CodePiece #yidev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Photo { | |
func getName() -> String | |
} | |
struct Facebook: Photo { | |
func getName() -> String { | |
return "facebook" | |
} | |
} | |
struct Flickr: Photo { | |
func getName() -> String { | |
return "flickr" | |
} | |
} | |
protocol Controller { | |
func a()->String | |
} | |
class ViewController<T: Photo> : Controller { | |
var array:[T] = [] | |
func a()->String { | |
return "sounds good" | |
} | |
} | |
let v1: Controller = ViewController<Facebook>.init() | |
let v2: Controller = ViewController<Flickr>.init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment