Skip to content

Instantly share code, notes, and snippets.

@hossamghareeb
Created May 11, 2020 21:56
Show Gist options
  • Save hossamghareeb/eac26ddb17e369e0dd8b635638cceee1 to your computer and use it in GitHub Desktop.
Save hossamghareeb/eac26ddb17e369e0dd8b635638cceee1 to your computer and use it in GitHub Desktop.
memberwise init with custom init
// No memberwise initializer
struct Player {
let name: String
var score: Int = 0
init(json: [String: AnyObject]) {
}
}
// you have the both initializers:
struct Player {
let name: String
var score: Int = 0
}
extension Player {
init(json: [String: AnyObject]) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment