АП
Size: a a a
АП
RN
PG
D
AD
D
AD
D
R
func getDateTime(getData: Bool) -> String {
let date = Date()
let calendar = Calendar.current
let hour = calendar.component(.hour, from: date)
let minutes = calendar.component(.minute, from: date)
let dateFormatt = DateFormatter()
dateFormatt.dateFormat = "dd.MM.yyyy"
let todaysDate = dateFormatt.string(from: date)
if getData == true {
return("\(todaysDate)")
}
else {
return("\(hour):\(minutes)")
}
}
Не понимаю как ее обновлять ?🚧
R
R
var body: some View {
let currentTime = getDateTime(getData: false)
let currentDate = getDateTime(getData: true)
VStack {
Text("\(currentTime)")
.font(/*@START_MENU_TOKEN@*/.title/*@END_MENU_TOKEN@*/)
Text("\(currentDate)")
.font(/*@START_MENU_TOKEN@*/.title/*@END_MENU_TOKEN@*/)
}
}
🚧