[swift-users] Swift 3 version of creating a string from a pointer, length and encoding?
john_brownie at sil.org
Thu Sep 29 04:47:58 CDT 2016
Next question in my migration. How do I do what this did in Swift 2.2?
let theData = String.init(bytes: data.memory, length: length, encoding:
The only initialisers that have a length are
init?(bytesNoCopy: UnsafeMutableRawPointer, length: Int, encoding:
String.Encoding, freeWhenDone: Bool)
init(utf16CodeUnitsNoCopy: UnsafePointer<unichar>, count: Int,
Neither is applicable.
Do I need to push it into a Data object first, like this?
let theData = String.init(data: Data.init(bytes: data, length: length),
Or is there a better way that I've missed (highly possible)?
In Finland on furlough from SIL Papua New Guinea
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users