Search code examples
iosuinavigationcontrollerswift4uipageviewcontroller

Update ChildViewController from UIPageViewController when embeded in NavigationController swift4


I have a UIPageViewController embeded in a NavigationController app setup I'm adding programically a editButton to the UIPageViewController's navigationItem. I would like to update the child viewController UI when the UIPageviewcontroller set Editing changing state. What is the simpliest way to do this? Thanks a lot.


Solution

  • You can do it with RxSwift

    Declare a variable like

    `var isEditingEnabled = Variable<Bool>(false)` 
    

    in Page Controller

    and in child view controller's viewDidLoad add an observer like

    parentVCObj.isEditingEnabled.asObservable().subscribe{
    
    }