emrepun / StickyTabBarViewController

Sticky and Collapsible View on top of tab bar
MIT License
150 stars 15 forks source link

Make expandable VC available from tab bar #17

Closed emrepun closed 4 years ago

emrepun commented 4 years ago

Description

This PR makes sure it is possible to access actual sticky view controller from tab bar to modify it,

Closes #14

Imagine a view controller named SampleChildViewController is already sticked to the tab bar controller. Now consumers will be able to access this view controller any where with tabBarController access as following:

    var tabController: StickyViewControllerSupportingTabBarController? {
        if let tabBarController = tabBarController as? StickyViewControllerSupportingTabBarController {
            return tabBarController
        }
        return nil
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        if let stickyViewController = tabController?.childViewController as? SampleChildViewController {
            // update it's content or anything.
            stickyViewController.minimisedView.backgroundColor = .black
        }
    }

Definition of Done

Has changes to public api but not urgent, so no need to publish a version, we can edit readme in the future, when there is a need for a release

Thurman1776- commented 4 years ago

@emrepun will have a look at this this week 👍