Search code examples
iosnscalendar

How to find out what first day of week is? (Monday or Sunday)


I want to check if the first day of the week for a user is Monday or Sunday to perform some actions with the calendar. Is it possible to determinate that using NSCalendar or any other way?


Solution

  • It's just:

    Swift:

    Calendar.current.firstWeekday
    

    Obj-C:

    [NSCalendar currentCalendar].firstWeekday
    

    With 1 = Sunday.