Avatar
var foo: Foo { return x } じゃなくて let foo: Foo = x だった。
8:25 AM
@swiftbot struct Cat { let face: String = "😺" func bark() -> String { return "にゃーん" } } struct Dog { let face: String = "🐶" func bark() -> String { return "わんわん" } } let cat = unsafeBitCast(Dog(), to: Cat.self) print(cat.face) print(cat.bark())