Skip to content

Instantly share code, notes, and snippets.

@hadanischal
Created September 19, 2019 12:51
Show Gist options
  • Save hadanischal/a0e7d8a47f305dfafb32212296ea568b to your computer and use it in GitHub Desktop.
Save hadanischal/a0e7d8a47f305dfafb32212296ea568b to your computer and use it in GitHub Desktop.
//
// NavigationControllerExtension.swift
// SnackViewExample
//
// Created by Nischal Hada on 19/9/19.
// Copyright © 2019 Nischal Hada. All rights reserved.
//
import UIKit
class NavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
setCustomStyle()
}
}
extension UINavigationController {
func setCustomStyle() {
navigationBar.isTranslucent = false
//To tint the bar's items
navigationBar.tintColor = .titleTintColor
//To tint the bar's background
navigationBar.barTintColor = .barTintColor
// navigationItem.hidesBackButton = true
navigationBar.titleTextAttributes = [.font: UIFont.navigationBarTitle,
.foregroundColor: UIColor.titleTintColor]
let attribute = [NSAttributedString.Key.font: UIFont.navigationBarButtonItem]
UIBarButtonItem.appearance().setTitleTextAttributes(attribute, for: UIControl.State.normal)
view.backgroundColor = .barTintColor
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment