Challenge: URLs | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5429634-saving-data-in-ios/lessons/4

Great video. However, I tried to use a similar simple practice code after your lesson and it is giving me an init error on the last line:

let numberURL = URL(fileURLWithPath: โ€œNumber.txtโ€, relativeTo: FileManager.docDirURL)

var number1 = 1005

let numberData = Data(number1)

I am just trying to save a simple int.
I noticed from your example the UInt8 works but a Int8 number doesnt seem to work. Do you treat similar Ints and Floats different when using Data()