Simple and integrated way to customize navigation bar experience on iOS app.

Overview

NavKit

Carthage compatible Build Status Coverage Status

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 navigation bar, back button, and so on.

Demo

Blink Navigation Bar Navigation Bar with Color Transition Navigation Bar

Installation

Carthage

github "wilbertliu/NavKit"

CocoaPods

Add the following line into the Podfile :

pod 'NavKit'

After that, run the following command :

$ pod install

Usage

Since the release of version 0.4, NavKit has a huge redesign of its API. It makes the switch of the mindset to the view controller's based navigation configuration, which means we don't need additional layer to configure the navigation experience.

There are only 3 things to do in order to use NavKit :

  1. Conforms to protocol CustomizableNavigation and UIGestureRecognizerDelegate.
  2. Define the properties that we need to customize the navigation bar like barBackgroundColor, backImage, etc.
  3. Call self.updateNavigation() wherever in view controller to update the navigation bar based on the defined properties.

Global Style

There's a time when we want to make a general style because it would be used by most of the screens. What we have to do is just make a protocol extension of CustomizableNavigation and define the properties that we want to make as global. And of course, if you override the properties on some controller, NavKit would use what's defined at controller instead. Can we jump into some codes to show?

import Foundation
import NavKit

extension CustomizableNavigation where Self: UIViewController, Self: UIGestureRecognizerDelegate {
    var titleColor: UIColor { return .red }
    var titleFont: UIFont { return UIFont.systemFont(ofSize: 16, weight: UIFontWeightMedium) }
    var backImage: UIImage? { return UIImage(named: "something") }
}

Example

Note that this section is taken from Example project. Make sure to check it to add some knowledge on how to use NavKit.

import UIKit
import NavKit

class DetailViewController: UIViewController, CustomizableNavigation, UIGestureRecognizerDelegate {
    // MARK: - Navigation Config

    var barBackgroundColor: UIColor = UIColor.blue.withAlphaComponent(0.5)
    var backText: String? = "<-- Go back"

    // MARK: - Life Cycles

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navigationController?.navigationBar.tintColor = .white
        self.updateNavigation()
    }
}

Support

Have any feedbacks? Feel free to submit a PR! And I'm more than happy to answer questions, or maybe just some hi?! To do that, shoot me a DM or tweet @wilbertliu

License

MIT © Wilbert Liu

You might also like...
An iOS view-controller navigation management. No inherit, using one line code to integrate.
An iOS view-controller navigation management. No inherit, using one line code to integrate.

KGNavigationBar Example An iOS view-controller navigation management. No inherit, using one line code to integrate. 一个 iOS 控制器导航管理库. 无需继承, 一行代码即可实现集成。

A lightweight iOS mini framework that enables programmatic navigation with SwiftUI, by using UIKit under the hood.

RouteLinkKit A lightweight iOS mini framework that enables programmatic navigation with SwiftUI. RouteLinkKit is fully compatible with native Navigati

Models UI navigation patterns using TCA

Composable Navigation The Composable Navigation is a Swift Package that builds on top of The Composable Architecture (TCA, for short). It models UI na

sRouting - The lightweight navigation framework for SwiftUI.
sRouting - The lightweight navigation framework for SwiftUI.

sRouting The lightweight navigation framework for SwiftUI. Overview sRouting using the native navigation mechanism in SwiftUI. It's easy to handle nav

🧭 SwiftUI navigation done right

🧭 NavigationKit NavigationKit is a lightweight library which makes SwiftUI navigation super easy to use. 💻 Installation 📦 Swift Package Manager Usi

Navigation helpers for SwiftUI applications build with ComposableArchitecture
Navigation helpers for SwiftUI applications build with ComposableArchitecture

Swift Composable Presentation 📝 Description Navigation helpers for SwiftUI applications build with ComposableArchitecture. More info about the concep

Powerful navigation in the Composable Architecture via the coordinator pattern

TCACoordinators The coordinator pattern in the Composable Architecture TCACoordinators brings a flexible approach to navigation in SwiftUI using the C

Cordova/Phonegap plugin for launching today's most popular navigation/ride apps to navigate to a destination.
Cordova/Phonegap plugin for launching today's most popular navigation/ride apps to navigate to a destination.

Launch Navigator Cordova/Phonegap Plugin Cordova/Phonegap plugin for launching today's most popular navigation/ride apps to navigate to a destination.

Make SwiftUI Navigation be easy

VNavigator VNavigator is a clean and easy-to-use navigation in SwiftUI base on UINavigationController in UIKit Installation From CocoaPods CocoaPods i

Releases(0.5)
  • 0.5(May 8, 2017)

    Release Notes

    • Change property isBarUsingShadow to isBarUsingBottomShadow to improve readability.
    • Remove isBarTranslucent to make translucency determined by barBackgroundColor instead.
    • Add method resetNavigation to reset navigation configuration.
    Source code(tar.gz)
    Source code(zip)
  • 0.4(May 1, 2017)

    Release Notes

    • Huge API redesign (make sure to check README or example project).
    • Example project.
    • Navigation bar transparency support.
    • No more memory leak.
    • Demo section on README.
    Source code(tar.gz)
    Source code(zip)
  • 0.3(Apr 12, 2017)

    Release Notes

    • Fix bar background color for clear color.
    • Update NavigationConfig protocol to use adjective instead.
    • Change optional properties Objective-C style to protocol extension for default value.
    • Change properties in protocol to be only gettable.
    • Change doSetup function name to be updateNavigation.
    • Change coverage service to coveralls.
    Source code(tar.gz)
    Source code(zip)
Owner
Wilbert Liu
Hacker 🛠
Wilbert Liu
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
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
Simple custom navigation bar by swift

YoNavBarView Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation YoNav

null 1 Nov 23, 2021
Replicating the 'clear' navigation bar style of the iOS 12 Apple TV app.

TONavigationBar TONavigationBar is an open-source subclass of UINavigationBar that adds the ability to set the background content of the navigation ba

Tim Oliver 247 Dec 7, 2022
Change SwiftUI Navigation Bar Color for different View

SwiftUINavigationBarColor Change SwiftUI NavigationBar background color per screen. Usage For NavigationBarColor to work, you have to set the Navigati

Hai Feng Kao 18 Jul 15, 2022
Simple iOS app to showcase navigation with coordinators in SwiftUI + MVVM.

SimpleNavigation Simple iOS app to showcase the use of the Coordinator pattern using SwiftUI and MVVM. The implementation is as easy as calling a push

Erik Lopez 7 Dec 6, 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
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
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