Store NSDictionary in keychain
Encoding : [dic description]
Decoding : [dic propertyList]
save user id as login data permanently for iOS app with swift
Is the "user id" you want to save need to be secret? If not that actually might be a good candidate for NSUserDefaults. If is needs to be secret use the Keychain.
For an example of using the Keychain from Swift see this: SO Answer
How to generate Unique ID of device for iPhone/iPad using Objective-c
Yes, UDID is deprecated; we are not allowed to get UDID due to user privacy purposes. Apple does not allow to get any identifiers that uniquely identifies a device, such as IMEI, MAC address, UDID etc.
UUID is the best way to go as of now. But that would be unique for each vendor. You are not assured that it will be unique each time you get the UUID string. Best bet is to store the UUID string to phone's Keychain and retrieve it when needed, with a catch. When you factory-reset your phone, the keychain items would be erased. This limitation should be kept in mind.
UPDATE - IN IOS 10.3 BETA'S:
It seems that Apple has made some changes to how Keychain works in iOS 10.3+. Keychain items stored in the Keychain will be deleted when the all the apps from the specific vendor are uninstalled. According to Apple, the residence of sensitive information of an app even after the app is gone from the device may lead to security risks, so they decided to forbid this kind of behavior.
Developers relying on Keychain storage even after an uninstall for their apps can make use of this WORKAROUND to continue with the intended functionality. According to this workaround, any app can access the information stored in that specific Keychain Access Group, so it is recommended that adding an extra layer of encryption to your data will protect it with even more security, although keychain encrypts items by default.
UPDATE - IOS 10.3.3 (STABLE):
It seems that the keychain items deletion was a BUG in early betas of iOS 10.3.3 and was fixed later in the stable release. This might have been caused during betas since strange things can happen during that phase. It should be no problem to use Keychain hereafter.
Rafactor only one file in project to use ARC?
This class is almost for sure in an Apple project. Refactor the whole project - you don't need to really finish or compile - but once done, you can then take the refactored file as a starting point.
Related Topics
Local Swift Packages Stopped Working in Xcode 13
Truncatingremainder VS Remainder in Swift
Xcode Autocomplete Does Not Work in Sources Folder of Swift Playgrounds
Synchronize Properties in Swift 3 Using Gcd
Insert, Update and Delete Animations with Foreach in Swiftui
How to Use Swift Playground to Display Nsview with Some Drawing
How to Make a Swift Framework Submodule Really Private
Swift - Converting from Unsafepointer<Uint8> with Length to String
Differencein Approach to Create Dispatchqueue Swift3
Uitableviewcell Height Auto Layout Not Working on iOS 10
How to Convert Copaquepointer in Swift to Some Type (Cgcontext? in Particular)
Swift: How Can String.Join() Work Custom Types
Catch Objective-C Exception in Swift
How to Create a Packed Data Structure in Swift
How to Implement Interstitial Iads in Swift(Xcode 6.1)
Add Placeholder to Uitextfield, How to Set the Placeholder Text Programmatically in Swift