Warning: Initialization of 'UnsafeBufferPointer<T>' results in a dangling buffer pointer
问题 After update to Swift 5.2 / Xcode 11.4 got a warning to following code: extension Data { init<T>(from value: T) { var value = value let pointer = UnsafeBufferPointer(start: &value, count: 1) self.init(buffer: pointer) } func to<T>(type: T.Type) -> T { return self.withUnsafeBytes { $0.load(as: T.self) } } } On line let pointer = UnsafeBufferPointer(start: &value, count: 1) I got Initialization of 'UnsafeBufferPointer' results in a dangling buffer pointer I can use @silenceWarning but it's