Skip to content

faberNovel/ADNavigationBarExtension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADNavigationBarExtension is a UI library written in Swift. It allows you to show and hide an extension to your UINavigationBar

Platform Swift5 CocoaPods License


Features

Use ExtensibleNavigationBarNavigationController to set an extension under your UINavigationBar:

  • The navigation controller manages the displaying of your navigation bar's extension
  • It is compatible with UIAppearance

See the provided examples for help or feel free to ask directly.



Requirements

ADNavigationBarExtension is written in swift 5.0. Compatible with iOS 10.0+

Installation

ADNavigationBarExtension is available through CocoaPods. To install it, simply add the following line to your Podfile:

Cocoapods

pod 'ADNavigationBarExtension'

Usage

Setup

The main component of the library is the ExtensibleNavigationBarNavigationController. It is basicaly a simple UINavigationController wich manages a supplementary view under the UINavigationBar.

A startup sequence might look like this:

let navigationController = ExtensibleNavigationBarNavigationController()
let navigationBarExtension = MyCustomView()
let navigationBarExtensionHeight = 64
navigationController.setNavigationBarExtensionView(navigationBarExtension, forHeight: navigationBarExtensionHeight)
navigationController.pushViewController(MyViewController(), animated: false)
window.rootViewController = navigationController

Then the ExtensibleNavigationBarNavigationController needs to know when the navigation bar's extension needs to be displayed or to be hidden. You have to use the protocol ExtensibleNavigationBarInformationProvider:

extension MyViewController: ExtensibleNavigationBarInformationProvider {
    var shouldExtendNavigationBar: Bool { return true }
}

Warning

Be aware of ExtensibleNavigationBarNavigationController is using the UINavigationControllerDelegate protocol. So if you also need to use de navigationController's delegate proprerty, you can use this:

let navigationController = ExtensibleNavigationBarNavigationController()
navigationController.navigationControllerDelegate = self

Credits

ADNavigationBarExtension is owned and maintained by Fabernovel. You can follow us on Twitter at @FabernovelApp.

License

ADNavigationBarExtension is released under the MIT license. See LICENSE for details.

About

iOS UI library to show and hide an extension to your UINavigationBar

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •