参考苹果官网
根据官网指导跳转到
https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md
找到了Conversion between pointers指针类型转换
代码如下:
// Before: let untypedPointer = UnsafePointer<Void>(ptr) // After: let untypedPointer = ptr.map(UnsafePointer<Void>.init) // Usually the pointee type is actually inferred: foo(ptr.map(UnsafePointer.init))原文链接:https://www.f2er.com/swift/322721.html