Code | PreView |
import SwiftUI
import SwiftyMoment
struct SwiftyMoment_Test: View {
var testDate : Date = Calendar.current.date(byAdding: .day, value: -7, to: Date())!
var body: some View {
VStack(spacing: 24){
Text(SwiftyMoment(date: 1095379200 * 1000))
Text(SwiftyMoment(date: testDate))
}
}
}
- You can use the Date type and the Unix time(Int) type.
- Unix time (Int) is based on ms, so if you want to use second as the picture above, you have to do * 1000.