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

Overview

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

There is an issue with iOS 12 where the isTranslucent property cannot be retrieved from the UINavigationBar.appearance() method. So if you need to set your UINavigationBar translucent, you can use this:

ExtensibleNavigationBarNavigationController.ad_isTranslucent = true

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.

Comments
  • Custom transition animations using transitionCoordinator don’t work

    Custom transition animations using transitionCoordinator don’t work

    I am trying to add an animation to the navigation bar in a viewWillAppear() and viewWillDisappear() in a view controller which is managed by an ExtensibleNavigationBarNavigationController and also normal navigation controllers. The animation is supposed to alter the opacity of the navigation bar's internal UIVisualEffectView. In the video I am going to add, you can see that in the first part I am pushing the view controller from a normal UINavigationController and it works, but when I try to push the same view controller from an ExtensibleNavigationBarNavigationController, the animation doesn't happen at all.

    Imgur link to the screen recording

    Please answer as fast as possible, because this is a big issue.

    opened by OmerFlame 6
  • ExtensibleNavigationBarNavigationController initialization crash

    ExtensibleNavigationBarNavigationController initialization crash

    Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: barAppearance != nil'

    when I'm trying to use ExtensibleNavigationBarNavigationController(rootViewController: someViewController()).

    Appreciate your time.

    opened by gouen95 2
  • Fix safe area when setting the child VCs directly

    Fix safe area when setting the child VCs directly

    If we set the view controllers using the viewControllers property;

    extensibleNavigationController.viewControllers = [myChildVC]
    

    the safe area of the inserted view controllers does not take into account the height of the extension view.

    opened by gaetanzanella 1
  • Fix pushing

    Fix pushing

        override public func pushViewController(_ viewController: UIViewController, animated: Bool) {
            super.pushViewController(viewController, animated: true) // it should be `animated`
            viewController.additionalSafeAreaInsets = extensionAdditionalSafeAreaInsets
        }
    
    opened by gaetanzanella 1
  • Title bar gets smaller (becomes compact) when navigating from an extended view controller to a non-extended view controller and coming back.

    Title bar gets smaller (becomes compact) when navigating from an extended view controller to a non-extended view controller and coming back.

    Here’s a visualization of the problem to supply you with further guidance.

    Note: the type of navigation bar is still the large one, you can scroll up to see the big title, but you come back to the view seeing the navigation bar compacted down, as if it scrolled down a bit, artificially.

    https://user-images.githubusercontent.com/17903236/106367297-2a19dd80-634a-11eb-8426-a45b01f1c29c.MP4

    opened by OmerFlame 1
  • Typo in the readme

    Typo in the readme

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

    I think you mean ADNavigationBarExtension is available through CocoaPods :)

    opened by borgeser 0
Releases(v1.0.4)
A UINavigationController subclass that support pop interactive UINavigationbar with hidden or show.

KDInteractiveNavigationController Features ✨ UINavigationController interactive with UINavigationBar hidden or show Hide all UINavigationController ba

Kingiol 154 Dec 3, 2022
Easily hide and show a view controller's navigation bar (and tab bar) as a user scrolls

HidingNavigationBar An easy to use library (written in Swift) that manages hiding and showing a navigation bar as a user scrolls. Features Usage Custo

Tristan Himmelman 1k Dec 21, 2022
UINavigationBar Category which allows you to change its appearance dynamically

Deprecated This lib uses a hacky way to achieve the result, in the new iOS version, the structure of UINavigation is changed and this lib no longer wo

Leo 4.5k Dec 3, 2022
Scrollable UINavigationBar that follows the scrolling of a UIScrollView

A custom UINavigationController that enables the scrolling of the navigation bar alongside the scrolling of an observed content view Versioning notes

Andrea Mazzini 6.1k Jan 6, 2023
An easy way to change backgroundColor of UINavigationBar when Push & Pop

RainbowNavigation 中文介绍 Feature RainbowNavigation is written in Swift 2.0. It helps you change the backgroundColor of UINavigationBar in animations and

danisfabric 789 Dec 3, 2022
NavigationViewKit is a NavigationView extension library for SwiftUI.

NavigationViewKit 中文版说明 NavigationViewKit is a NavigationView extension library for SwiftUI. For more detailed documentation and demo, please visit 用N

东坡肘子 74 Dec 28, 2022
An open source library for building deep-linkable SwiftUI applications with composition, testing and ergonomics in mind

Composable Navigator An open source library for building deep-linkable SwiftUI applications with composition, testing and ergonomics in mind Vanilla S

Bahn-X 539 Jan 8, 2023
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Zhouqi Mo 3.3k Dec 21, 2022
SwiftUINavigator: a lightweight, flexible, and super easy library which makes SwiftUI navigation a trivial task

The logo is contributed with ❤️ by Mahmoud Hussein SwiftUINavigator is a lightwe

OpenBytes 22 Dec 21, 2022
Router is a library that assists with SwiftUI view transitions.

Router Router is a library that assists with SwiftUI view transitions. Installation .package(name: "Router", url: "[email protected]:1amageek/Router.git"

1amageek 69 Dec 23, 2022
Create an iOS app with two views, MainViewController and DetailViewController

iOS Take Home Create an iOS app with two views, MainViewController and DetailViewController. The MainViewController contains a list of GIFs from the G

Jakub Towarek 0 Oct 25, 2021
Simple and integrated way to customize navigation bar experience on iOS app.

NavKit Simple and integrated way to customize navigation bar experience on iOS app. It should save our time that we usually use to make abstraction of

Wilbert Liu 37 Dec 7, 2022
BulbapediaIOS - The home for Kiwix apps on iOS and macOS

Kiwix for iOS & macOS This is the home for Kiwix apps on iOS and macOS. Mobile a

null 0 Dec 30, 2021
A view that shows selectable symbols, similar to UITableView's `sectionIndexTitles` API but with support for symbols and more flexibility

?? TableOfContentsSelector Are you familiar with UITableView's sectionIndexTitles API? The little alphabet on the side of some tables for quickly jump

Christian Selig 106 Dec 19, 2022
FlowStacks allows you to hoist SwiftUI navigation and presentation state into a Coordinator

FlowStacks allow you to manage complex SwiftUI navigation and presentation flows with a single piece of state. This makes it easy to hoist that state into a high-level coordinator view. Using this pattern, you can write isolated views that have zero knowledge of their context within the navigation flow of an app.

John Patrick Morgan 471 Jan 3, 2023
Coordinators in SwiftUI. Simple, powerful and elegant.

Simple, powerful and elegant implementation of the Coordinator pattern in SwiftUI. Stinsen is written using 100% SwiftUI which makes it work seamlessl

Narek Mailian 618 Jan 7, 2023
An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation.

swiftui-navigation-stack An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations

Matteo 753 Jan 2, 2023
A wrapper for NavigationView and NavigationLink that makes programmatic navigation a little friendlier.

NavigatorKit A wrapper for NavigationView and NavigationLink that makes programmatic navigation a little friendlier. NavigatorKit is an opinionated wr

Gyuri Grell 2 Jun 16, 2022
Tools for making SwiftUI navigation simpler, more ergonomic and more precise.

SwiftUI Navigation Tools for making SwiftUI navigation simpler, more ergonomic and more precise. Motivation Tools Navigation overloads Navigation view

Point-Free 1.1k Jan 1, 2023