0
をスローすることが無名関数を指定してください私のコードからストリップダウンサンプルです:スウィフト2.2では、どのように私は簡潔にここ
struct Widget {
let string: String
init(_ string: String) throws {
self.string = string
}
}
struct Widgets {
let widgets: [Widget]
init(_ strings: [String]) throws {
// Is this really the cleanest way to do the map?
widgets = try strings.map({(string:String) throws -> Widget in
return try Widget(string)
})
}
}
Btwをスローします。私はXCode 7.3を使用しています –