Sometimes you need to get the current date in Swift.
To get the current date, create a new Date
instance.
let date = Date()
You can print the current date using a DateFormatter
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd/MM/yyyy"
print(dateFormatter.string(from: date))
The Complete iOS App Development Bootcamp
Disclosure: This website may contain affiliate links, meaning when you click the links and make a purchase, we receive a commission.