Skip to content

A library for injecting and managing a floating view in the navigation controller view hierarchy.

Notifications You must be signed in to change notification settings

jordancoff/FloatingView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FloatingView

A library for injecting and managing a floating view in the navigation controller view hierarchy.

Features

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

Usage

Setup

let floatingButton = ...
let floatingViewManager = FloatingViewManager(floatingView: floatingButton)
let nav = UINavigationController(rootViewController: vc, floatingViewManager: floatingViewManager)

Customization

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 FloatingViewCustomizing and implement methods
  • navigation controller can conform to FloatingViewCustomizing and implement methods
  • default handler property corresponding to the desired customization can be set on the manager

About

A library for injecting and managing a floating view in the navigation controller view hierarchy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages