A library for injecting and managing a floating view in the navigation controller view hierarchy.
This library lets you add a floating view at the navigation controller level
- ❌ No need to subclass your nav controller
- ❌ No view logic in your nav controller
- ✅ Customization hooks whenever a view controller is shown
let floatingButton = ...
let floatingViewManager = FloatingViewManager(floatingView: floatingButton)
let nav = UINavigationController(rootViewController: vc, floatingViewManager: floatingViewManager)Customization is offered via the FloatingViewCustomizing protocol.
protocol FloatingViewCustomizing {
func shouldShowButton() -> Bool
func createConstraints(floatingView: UIView, superview: UIView)
}For each hook offered through the protocol, customization can be done with the following order of precendence:
- view controller being shown can conform to
FloatingViewCustomizingand implement methods - navigation controller can conform to
FloatingViewCustomizingand implement methods default handlerproperty corresponding to the desired customization can be set on the manager