Avatar
return書いたら型を書けと怒られたw
4:06 AM
やはりここは protocol Factory の出番かな
4:06 AM
protocol Factory { init(_ f: () -> Self) } extension Factory { init(_ f: () -> Self) { self = f() } } extension Foo: Factory { } let foo = Foo { let a = 1 let b = "2" return Foo(a: a, b: b) }
4:06 AM
よさ味