You just need to delete the
UnsafePointer
creation.
let value = String(cString: colSQL0!)
Two points:
You can no longer convert from pointers of one type to pointers of another type directly. This is fallout from SE-0107 UnsafeRawPointer API, which puts Swift’s type aliasing rules on a firm footing.
In this case that’s not a problem because, as a special case, Swift 3 support constructing a
String
from a C string using either signed or unsigned characters
Specifically, there are two constructors:
public init(cString: UnsafePointer<CChar>)
public init(cString: UnsafePointer<UInt8>)
and, as noted in the comments, the second “is identical to
init(cString: UnsafePointer<CChar>)
but operates on an unsigned sequence of bytes.”
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"