Last active
July 22, 2017 06:32
-
-
Save mwrites/f382a6f7a7fe6af3a77f22ec5c247b11 to your computer and use it in GitHub Desktop.
extend array of custom type
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
extension Array where Element:PackProtocol { | |
static func build(from json: [String:Any]) -> PackList { | |
let jsonPacks = json["packs"] as! [[String:Any]] | |
let packs = jsonPacks.flatMap { Pack.init(from: $0) } | |
return packs | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment