Avatar
@swiftbot class MyClass { var i: Int init(_ i: Int) { print("init: \(i)") self.i = i } deinit { print("deinit: \(i)") } } do { print("# init array") var array = [MyClass(1), MyClass(2)] print("# assign 3") array[0] = MyClass(3) print("# assign 4") array.withUnsafeMutableBufferPointer { bp in bp.baseAddress!.initialize(to: MyClass(4)) } print("# exit do") }
🛠 1