Swift Functions

Can anyone give me some idea what is wrong with this approach? thank you

func getTodaysDate() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd-MM-YY"
return dateFormatter.string(from: Date())

Add return before NavigationView. Since you added some constant declarations to the top of your implementation of body, it's no longer a single expression and you don't get the benefit of being able to omit the return keyword (1, 2).

Thanks I figured out another way.