WholeMonth
@propertyWrapper
public struct WholeMonth
Wrapped Date variables which constrain their values to the start of the enclosing interval
Usage example:
func demo_usingPropertyWrappers(_ date: Date) {
@WholeHour var ymdHour = date
@WholeHours var ymdHours = [date, date.addingTimeInterval(100000)]
@WholeDay var ymDay = date
@WholeMonth var yMonth = date
print("date:", date.EEEE_ddMMyyyy_HHmmss)
print("ymdHour:", ymdHour.EEEE_ddMMyyyy_HHmmss)
print("ymdHours:", ymdHours.map {$0.EEEE_ddMMyyyy_HHmmss})
print("ymDay:", ymDay.EEEE_ddMMyyyy_HHmmss)
print("yMonth:", yMonth.EEEE_ddMMyyyy_HHmmss)
}
let date = Date(timeIntervalSinceReferenceDate: 600000083)
demo_usingPropertyWrappers(date)
Printed output:
date: Monday 06.01.2020 11:41:23
ymdHour: Monday 06.01.2020 11:00:00
ymdHours: ["Monday 06.01.2020 11:00:00", "Tuesday 07.01.2020 15:00:00"]
ymDay: Monday 06.01.2020 00:00:00
yMonth: Wednesday 01.01.2020 00:00:00
-
Declaration
Swift
public var wrappedValue: Date { get set }
-
Declaration
Swift
public init(wrappedValue: Date)