I'm trying to convert a string to a data type. I thought this was all I needed but if I try to print it it just prints "12 bytes"
let tString = "Hello World!"
if let newData = tString.data(using: String.Encoding.utf8){
print(newData)
self.peripheral?.writeValue(newData, for: positionCharacteristic, type: CBCharacteristicWriteType.withResponse)
}
What am I doing wrong?
.utf8
is sufficient. – Shirbergprint(newData as NSData)
. – Facilitationas NSData
is pretty smart. – Shirberg