intervalUnit
The amount of time – in calendar units such as day, month, or year – that represents a fraction of the total payment interval.
Declaration
var intervalUnit: NSCalendar.Unit { get set }Discussion
The default value for the interval unit is month.
The supported NSCalendar.Unit interval units are:
To set an interval unit based on a week, set intervalUnit to day, and set intervalCount to a multiple of the number of days per week. To find the number of days for a week in the current calendar, call NSCalendar.current.maximumRange(of: .weekday)!.count).
For example, the code below sets a payment that occurs every two weeks.
let daysPerWeek = NSCalendar.current.maximumRange(of: .weekday)!.count)
intervalUnit = .day
intervalCount = daysPerWeek * 2