Created
November 1, 2017 05:20
-
-
Save zakky-dev/0e44ff447c39d64b1825dd6432b064ab to your computer and use it in GitHub Desktop.
こういうことができるのは嬉しいかもしれない
This file contains hidden or 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 InitWithIntProtocol { | |
init(i: Int) | |
} | |
class WithInt: InitWithIntProtocol { | |
required init(i: Int) { | |
print(i) | |
} | |
} | |
func ff<T: InitWithIntProtocol>(i: Int) -> T { | |
return T(i: i) | |
} | |
let _: WithInt = ff(i: 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment