Swift 4.1 deinitialize and deallocate(capacity:) deprecated
问题 I've been saying this to form a C array of CGPoint: let arr = UnsafeMutablePointer<CGPoint>.allocate(capacity:4) defer { arr.deinitialize() arr.deallocate(capacity:4) } arr[0] = CGPoint(x:0,y:0) arr[1] = CGPoint(x:50,y:50) arr[2] = CGPoint(x:50,y:50) arr[3] = CGPoint(x:0,y:100) Now (Swift 4.1 in the Xcode 9.3 beta) both deinitialize and deallocate(capacity:) are deprecated. It looks like what I'm supposed to say now might be: defer { arr.deinitialize(count:4) arr.deallocate() } Is that right?