Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

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))
Comment

PREVIOUS NEXT
Code Example
Swift :: Detect if device is ipad or iphone swift 
Swift :: regular expression for number less than 100 
Swift :: convert image to base64 in swift ui 
Swift :: get length of array swift 
Swift :: swift remove space from string 
Swift :: uitableviewcell automatic height 
Swift :: playing a sound in swift 
Swift :: swift animate a label ishidden 
Swift :: How to change the backgroundColor of UIDatePicker or UIPicker ? 
Swift :: date in swiftui 
Swift :: swift navigation bar title font 
Swift :: remove back button swift 
Swift :: swift wait 5 seconds 
Swift :: xcode disable a button 
Swift :: how to get current shown collectionview cell index in swift 
Swift :: swiftui tabview 
Swift :: deselect cell swift 
Swift :: string to double swift 
Swift :: convert int to string in swift 
Swift :: swift add width/height constraint to view 
Swift :: activity indicator swiftui 
Swift :: swift close view 
Swift :: rounded ios button 
Swift :: swift dictionary sorted 
Swift :: swift split string into array of 2 characters 
Swift :: parse int in swift 
Swift :: swift switch statement 
Swift :: Swift Static Properties 
Swift :: Swift Initializer 
Swift :: swift variables 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =