> On Jul 31, 2015, at 2:51 PM, Jens Alfke wrote:
>
> Your code should work if you change String(…) to NSString(…).
However, there’s no need to bother getting the bytes and length from the
NSData, since there’s an initializer that takes just an NSData:
if let name = NSString(data: dataValue, en
> On Jul 31, 2015, at 12:32 PM, Jan E. Schotsman wrote:
>
> But the NSString Reference says:
> convenience init?(bytes bytes: UnsafePointer, length length: Int,
> encoding encoding: UInt )
NSString ≠ String. It’s not toll-free bridging like you’re used to with CF.
String and NSString are act
Hello,
This has me puzzled: I am trying to initialize a Swift string with an
NSData but the analyzer denies my approach.
let dataValue:NSData = …
let name = String( bytes:dataValue.bytes, length:dataValue.length,
encoding:NSUTF8StringEncoding )
Analyzer complains: "Cannot find an initial