MenuViewController has two buttons - "month" and "week", now CalendarViewController contains information only about the month. How depending on the pressed button to change the information on CalendarViewController? I tried: in MenuViewController:

@IBAction func buttonClick(sender: AnyObject) { let calendarVC = kConstantObj.SetIntialMainViewController("CalendarViewController") self.window?.rootViewController = calendarVC self.window?.makeKeyAndVisible() } if sender == mounthButton { calendarVC.presentationMode(.MonthView) } else { 

calendarVC.presentationMode (.WeekView)}} in CalendarViewController:

  func presentationMode() -> CalendarMode { return CalendarMode.MonthView } 

but Xcode gives the error 'use of unresolved identifier' calendarVC 'That is, two main questions - how to change the function in CalendarViewController, and how to switch to the CalendarViewController for the necessary information by pressing the week / month?

    1 answer 1

    It can be released through delegation or through NSNotificationCenter

    Here is the answer to your question:

    1. NSNotificationCenter
    2. Delegation