Saneesh Saneesh -3 years ago 130
iOS Question

Get Current month and year from FSCalender -Swift

I am using FSCalender for ma project. I need to scroll the calender for getting next month.

I am using this code to get the change notification

func calendarCurrentMonthDidChange(_ calendar: FSCalendar!) {
print("Changed")

print("ss",ss)
// Do something
}


what I need is to get the current month and year form the calendar object..

Answer Source

You can use the calendar.currentPage to get the Date value. Then use Component

let currentPageDate = calendar.currentPage

let month = Calendar.current.component(.month, from: currentPageDate)

print(month)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download