Sunday, November 8, 2026
HomeiOS Developmentios - get a array of weekdays intager to a string utilizing...

ios – get a array of weekdays intager to a string utilizing weekdaysymbol

[ad_1]

I’m attempting to print an array of weekdays utilizing the weekdaysymbol – right here is my code thus far

for i in Weekdaysnumbers {
            
            let calender = Calendar.present
            let weekdayIndex = ((Weekdaysnumbers[i!]! - 1) + (calender.firstWeekday - 1)) % 7
            varWeekdaysStrings.append(calender.shortWeekdaySymbols[weekdayIndex])
        }

The Weekdaysnumbers shops an array of a weekday integers that the consumer will get to set. I then need to print a string representing it. I set it inside a for loop that goes by means of the array of Weekdaysnumbers and appends it to the brand new array. However I get this error message

 Thread 1: Deadly error: Index out of vary  

  • how can I eliminate this error? Any assist could be nice.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments