Skip to content

Instantly share code, notes, and snippets.

@d-date
Created March 6, 2017 12:56
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 d-date/59ce49d37471660a8d271b5a7302dc99 to your computer and use it in GitHub Desktop.
Save d-date/59ce49d37471660a8d271b5a7302dc99 to your computer and use it in GitHub Desktop.
protocol HogeType {
init(value: String)
}
final class HogeClass { //finalにしておけば
var value = ""
var value2 = ""
required public init(value: String, value2: String) {
self.value = value
self.value2 = value2
}
}
extension HogeClass : HogeType { // convenience initをかける
convenience init(value: String) {
self.init(value: "", value2: "")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment