I am having a bit of trouble figuring out this Core Data stuff. How do I create a new entry with a unique ID? In SQL I would just declare one field as an autoincrement fie
Take a look at NSProcessInfo / ProcessInfo from where we can fetch unique id.
Objective-C code snippet:
[[NSProcessInfo processInfo] globallyUniqueString]
.
Swift code snippet:
let uniqueId = ProcessInfo().globallyUniqueString
print("uniqueId: \(uniqueId)")
Apple Docs:
Global ID for the process. The ID includes the host name, process ID, and a time stamp, which ensures that the ID is unique for the network, which is handy if you don't want people guessing the id.