save date to userdefaults swift
//save as Date
UserDefaults.standard.set(Date(), forKey: key)
//read
let date = UserDefaults.standard.object(forKey: key) as! Date
let df = DateFormatter()
df.dateFormat = "dd/MM/yyyy HH:mm"
print(df.string(from: date))
Also in Swift:
- swift switch
- hide status bar ios
- let values = [3.0,6.0,9.0,1.0] let squares = values.map {$0 * $0} print(squares)
- change ui button swift
- swift thread.sleep
- shapes in swiftui
- swift uitextfield only numbers keyboard lock programmatically
- can you pass an enum as a parameter to a function swift
- hide status bar in tableview cell in swift
- navigationBarTitle text size swiftui
- swift create uinavigationcontroller programmatically
- swift table view needs
- list header swiftui
- how to set the font of text in swiftui
- how to print hello world in swift
- swift guard let
- swift initialize array with size
- rotate image animated swift
- how to low case string swift
- swift edit constraint programmatically
- timer in swift stack overflow
- convert string to base64 swift
- swift empty an array
- swift close app