Avatar
Kishikawa Katsumi 10/1/2018 3:31 PM
@swiftbot struct Stone {} struct Wall { var onChanged: () -> Void = {} } class Cat { var wall = Wall() init() { print("init cat") } deinit { print("deinit cat") } func nya() { print("begin nya") var stone = Stone() { didSet { self.mofu(stone) } } wall.onChanged = { print(stone) } print("end nya") } func mofu(_ stone: Stone) { print("mofu") } } func main() { let cat = Cat() cat.nya() } main()
🛠 1