
NSHipster · 8 min readSwift & Apple platforms
cron & Calendar.RecurrenceRule
It explains why cron expressions can’t represent complex dates like the first Sunday of a month or Thanksgiving, and shows how Apple’s Calendar.RecurrenceRule and a custom RRULE parser handle such patterns. The article demonstrates Swift code for creating, parsing, and iterating recurrence rules, highlighting bugs and limitations.
- Cron fields combine with OR logic, causing unexpected extra runs for complex schedules
- Calendar.RecurrenceRule expresses yearly/monthly rules but mis‑implements some RFC‑5545 cases
- A custom RRULE parser can fully parse RFC‑5545 strings and convert them to Swift dates