├── HidesNavigationBarWhenPushed1.gif ├── HidesNavigationBarWhenPushed2.gif ├── HidesNavigationBarWhenPushed3.gif ├── HidesNavigationBarWhenPushedExample ├── Assets.xcassets │ ├── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── MainViewController.swift └── AppDelegate.swift ├── HidesNavigationBarWhenPushedExample.xcodeproj ├── xcuserdata │ └── danilgontovnik.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── project.xcworkspace │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── contents.xcworkspacedata └── project.pbxproj ├── HidesNavigationBarWhenPushed.podspec ├── LICENSE ├── HidesNavigationBarWhenPushed ├── ViewController.swift ├── NavigationBar.swift └── NavigationController.swift └── README.md /HidesNavigationBarWhenPushed1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gontovnik/HidesNavigationBarWhenPushed/HEAD/HidesNavigationBarWhenPushed1.gif -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushed2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gontovnik/HidesNavigationBarWhenPushed/HEAD/HidesNavigationBarWhenPushed2.gif -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushed3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gontovnik/HidesNavigationBarWhenPushed/HEAD/HidesNavigationBarWhenPushed3.gif -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample.xcodeproj/xcuserdata/danilgontovnik.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample.xcodeproj/xcuserdata/danilgontovnik.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HidesNavigationBarWhenPushed.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | HidesNavigationBarWhenPushedExample.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushed.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "HidesNavigationBarWhenPushed" 3 | s.version = "1.0.2" 4 | s.summary = "A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag" 5 | s.homepage = "https://github.com/gontovnik/HidesNavigationBarWhenPushed" 6 | s.license = { :type => "MIT", :file => "LICENSE" } 7 | s.author = { "Danil Gontovnik" => "danil@gontovnik.com" } 8 | s.source = { :git => "https://github.com/gontovnik/HidesNavigationBarWhenPushed.git", 9 | :tag => "#{s.version}" } 10 | s.source_files = "HidesNavigationBarWhenPushed/*.swift" 11 | s.platform = :ios, '11.0' 12 | s.ios.deployment_target = '11.0' 13 | s.ios.frameworks = ['UIKit', 'Foundation'] 14 | s.swift_version = '4.1' 15 | end 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Danil Gontovnik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushed/ViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2018 Danil Gontovnik 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | SOFTWARE. 19 | */ 20 | 21 | import UIKit 22 | 23 | open class ViewController: UIViewController { 24 | 25 | // MARK: - Vars 26 | 27 | open var hidesNavigationBarWhenPushed = false 28 | var viewWillAppearNavigationBarUpdatesBlock: (() -> Void)? 29 | 30 | var fakeNavigationBar: NavigationBar? 31 | 32 | // MARK: - Lifecycle 33 | 34 | override open func viewWillAppear(_ animated: Bool) { 35 | super.viewWillAppear(animated) 36 | viewWillAppearNavigationBarUpdatesBlock?() 37 | viewWillAppearNavigationBarUpdatesBlock = nil 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/MainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.swift 3 | // HidesNavigationBarWhenPushedExample 4 | // 5 | // Created by Danil Gontovnik on 23/06/2018. 6 | // Copyright © 2018 Danil Gontovnik. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class MainViewController: ViewController { 12 | 13 | // MARK: - Vars 14 | 15 | @IBOutlet weak var scrollView: UIScrollView! 16 | 17 | // MARK: - Lifecycle 18 | 19 | override func loadView() { 20 | super.loadView() 21 | 22 | view.backgroundColor = .white 23 | } 24 | 25 | // MARK: - Methods 26 | 27 | @IBAction func presentWithLargeNavigationBar(_ sender: Any) { 28 | let navigationController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as! UINavigationController 29 | navigationController.viewControllers.first?.title = "Large Navigation Bar" 30 | navigationController.navigationBar.prefersLargeTitles = true 31 | self.navigationController?.present(navigationController, animated: true, completion: nil) 32 | } 33 | 34 | @IBAction func presentWithRegularNavigationBar(_ sender: Any) { 35 | let navigationController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as! UINavigationController 36 | navigationController.viewControllers.first?.title = "Regular Navigation Bar" 37 | self.navigationController?.present(navigationController, animated: true, completion: nil) 38 | } 39 | 40 | @IBAction func pushWithHiddenNavigationBar(_ sender: Any) { 41 | let mainViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainViewController") as! MainViewController 42 | mainViewController.title = "Hidden Navigation Bar" 43 | mainViewController.hidesNavigationBarWhenPushed = true 44 | navigationController?.pushViewController(mainViewController, animated: true) 45 | } 46 | 47 | @IBAction func push(_ sender: Any) { 48 | let mainViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainViewController") as! MainViewController 49 | mainViewController.title = "Pushed" 50 | navigationController?.pushViewController(mainViewController, animated: true) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // HidesNavigationBarWhenPushedExample 4 | // 5 | // Created by Danil Gontovnik on 23/06/2018. 6 | // Copyright © 2018 Danil Gontovnik. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushed/NavigationBar.swift: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2018 Danil Gontovnik 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | SOFTWARE. 19 | */ 20 | 21 | import UIKit 22 | 23 | open class NavigationBar: UINavigationBar { 24 | 25 | // MARK: - Vars 26 | 27 | var height: CGFloat? 28 | 29 | private var backgroundView: UIView? { 30 | return value(forKey: "_backgroundView") as? UIView 31 | } 32 | 33 | var isBackgroundViewHidden = false { 34 | didSet { 35 | backgroundView?.isHidden = isBackgroundViewHidden 36 | } 37 | } 38 | 39 | // MARK: - Constructors 40 | 41 | override public init(frame: CGRect) { 42 | super.init(frame: frame) 43 | commonInit() 44 | } 45 | 46 | required public init?(coder aDecoder: NSCoder) { 47 | super.init(coder: aDecoder) 48 | commonInit() 49 | } 50 | 51 | private func commonInit() { 52 | backgroundView?.addObserver(self, forKeyPath: "hidden", options: .new, context: nil) 53 | } 54 | 55 | // MARK: - 56 | 57 | deinit { 58 | backgroundView?.removeObserver(self, forKeyPath: "hidden") 59 | } 60 | 61 | // MARK: - Methods 62 | 63 | override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { 64 | if backgroundView?.isHidden != isBackgroundViewHidden { 65 | backgroundView?.isHidden = isBackgroundViewHidden 66 | } 67 | } 68 | 69 | func copyNavigationBar() -> NavigationBar { 70 | let navigationBar = NavigationBar() 71 | navigationBar.barStyle = barStyle 72 | navigationBar.isTranslucent = isTranslucent 73 | navigationBar.tintColor = tintColor 74 | navigationBar.barTintColor = barTintColor 75 | navigationBar.setBackgroundImage(backgroundImage(for: .default), for: .default) 76 | navigationBar.setBackgroundImage(backgroundImage(for: .compact), for: .compact) 77 | navigationBar.setBackgroundImage(backgroundImage(for: .defaultPrompt), for: .defaultPrompt) 78 | navigationBar.setBackgroundImage(backgroundImage(for: .compactPrompt), for: .compactPrompt) 79 | navigationBar.shadowImage = shadowImage?.copy() as? UIImage 80 | navigationBar.prefersLargeTitles = prefersLargeTitles 81 | return navigationBar 82 | } 83 | 84 | // MARK: - Layout 85 | 86 | override open func layoutSubviews() { 87 | super.layoutSubviews() 88 | 89 | if let height = height { 90 | backgroundView?.frame.origin.y = bounds.height - height 91 | backgroundView?.frame.size.height = height 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HidesNavigationBarWhenPushed 2 | 3 | A library, which adds the ability to hide navigation bar when view controller is pushed via `hidesNavigationBarWhenPushed` flag. 4 | 5 | **FYI: I use Apple internal API to make it work. Please remember that Apple might reject your app during app review process.** 6 | 7 | ## Context 8 | 9 | While hacking on various projects, time to time I get designs where view controller A has navigation bar, and view controller B doesn't have it. It was always a pain to make it work. I decided to hack on that – and this is the result of that. 10 | 11 | I hope that many people will find it useful too. 12 | 13 | ## Demo 14 | 15 | ### With interactive pop gesture recognizer 16 | 17 | ![](https://raw.githubusercontent.com/gontovnik/HidesNavigationBarWhenPushed/master/HidesNavigationBarWhenPushed1.gif) 18 | 19 | ### Regular push and pop 20 | 21 | ![](https://raw.githubusercontent.com/gontovnik/HidesNavigationBarWhenPushed/master/HidesNavigationBarWhenPushed2.gif) 22 | ![](https://raw.githubusercontent.com/gontovnik/HidesNavigationBarWhenPushed/master/HidesNavigationBarWhenPushed3.gif) 23 | 24 | ## Requirements 25 | * Xcode 9 or higher 26 | * iOS 11.0 or higher (may work on previous versions, just did not test it) 27 | * ARC 28 | * Swift 4.1 29 | 30 | ## Example project 31 | 32 | Open and run the **HidesNavigationBarWhenPushedExample** project in Xcode to see **HidesNavigationBarWhenPushed** in action. 33 | 34 | ## Installation 35 | 36 | ### CocoaPods 37 | 38 | ``` ruby 39 | pod 'HidesNavigationBarWhenPushed' 40 | ``` 41 | 42 | ### Manual 43 | 44 | Add **HidesNavigationBarWhenPushed** folder into your project. 45 | 46 | ## Usage 47 | 48 | 1. Use provided `NavigationController` instead of `UINavigationController` 49 | 2. Use provided `ViewController` instead of `UIViewController` 50 | 3. Use provided `NavigationBar` instead of `UINavigationBar` (make sure you specify this explicitly when using Interface Builder) 51 | 52 | `ViewController` contains a single property you have to worry about: `hidesNavigationBarWhenPushed`. 53 | 54 | If value on the new view controller is set to `true` and on the current view controller is set to `false`, then when new view controller is pushed, navigation bar will remain in the previous view controller. If value on the new view controller set to `false` and on the current view controller is set to `false`, then when new view controller is pushed, navigation bar will be present only in the new view controller, but not in the current. 55 | 56 | If it sounds confusing, please see the demo above. 57 | 58 | ## Contributions 59 | 60 | Contributions are always welcome! 61 | 62 | ## Contact 63 | 64 | Danil Gontovnik 65 | 66 | - https://github.com/gontovnik 67 | - https://twitter.com/gontovnik 68 | - http://gontovnik.com/ 69 | - danil@gontovnik.com 70 | 71 | ## License 72 | 73 | The MIT License (MIT) 74 | 75 | Copyright (c) 2018 Danil Gontovnik 76 | 77 | Permission is hereby granted, free of charge, to any person obtaining a copy 78 | of this software and associated documentation files (the "Software"), to deal 79 | in the Software without restriction, including without limitation the rights 80 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 81 | copies of the Software, and to permit persons to whom the Software is 82 | furnished to do so, subject to the following conditions: 83 | 84 | The above copyright notice and this permission notice shall be included in all 85 | copies or substantial portions of the Software. 86 | 87 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 88 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 89 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 90 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 91 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 92 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 93 | SOFTWARE. 94 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushed/NavigationController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2018 Danil Gontovnik 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | SOFTWARE. 19 | */ 20 | 21 | import UIKit 22 | 23 | open class NavigationController: UINavigationController { 24 | 25 | // MARK: - Types 26 | 27 | private typealias TransitionCompletion = (() -> Void) 28 | 29 | // MARK: - Vars 30 | 31 | private var _navigationBar: NavigationBar { 32 | return navigationBar as! NavigationBar 33 | } 34 | 35 | private var transitionCompletions = [UIViewController: TransitionCompletion]() 36 | 37 | // MARK: - Constructors 38 | 39 | public init() { 40 | super.init(navigationBarClass: NavigationBar.self, toolbarClass: nil) 41 | } 42 | 43 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 44 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 45 | } 46 | 47 | // MARK: - 48 | 49 | override public init(rootViewController: UIViewController) { 50 | super.init(navigationBarClass: NavigationBar.self, toolbarClass: nil) 51 | viewControllers = [rootViewController] 52 | commonInit() 53 | } 54 | 55 | public required init?(coder aDecoder: NSCoder) { 56 | super.init(coder: aDecoder) 57 | commonInit() 58 | } 59 | 60 | private func commonInit() { 61 | delegate = self 62 | if let viewController = viewControllers.first as? ViewController, viewController.hidesNavigationBarWhenPushed { 63 | forceHideNavigationBar() 64 | } 65 | } 66 | 67 | // MARK: - Methods 68 | 69 | override open func pushViewController(_ viewController: UIViewController, animated: Bool) { 70 | let currentViewController = viewControllers.last 71 | 72 | if let currentViewController = currentViewController as? ViewController, 73 | let viewController = viewController as? ViewController, 74 | isNavigationBarHidden == false { 75 | if currentViewController.hidesNavigationBarWhenPushed == false && viewController.hidesNavigationBarWhenPushed == true { 76 | let fakeNavigationBar = addFakeNavigationBar(to: currentViewController) 77 | currentViewController.fakeNavigationBar = fakeNavigationBar 78 | _navigationBar.isBackgroundViewHidden = true 79 | } else if currentViewController.hidesNavigationBarWhenPushed == true && viewController.hidesNavigationBarWhenPushed == false { 80 | let fakeNavigationBar = _navigationBar.copyNavigationBar() 81 | 82 | viewController.viewWillAppearNavigationBarUpdatesBlock = { [weak self] in 83 | guard let strongSelf = self else { return } 84 | viewController.view.addSubview(fakeNavigationBar) 85 | strongSelf.layout(fakeNavigationBar: fakeNavigationBar, within: viewController) 86 | } 87 | 88 | setTransitionCompletion(for: viewController) { [weak self] in 89 | fakeNavigationBar.removeFromSuperview() 90 | self?._navigationBar.isBackgroundViewHidden = false 91 | } 92 | } 93 | } 94 | super.pushViewController(viewController, animated: true) 95 | } 96 | 97 | @discardableResult override open func popViewController(animated: Bool) -> UIViewController? { 98 | if viewControllers.count > 1 { 99 | if let currentViewController = viewControllers.last as? ViewController, 100 | let previousViewController = viewControllers[viewControllers.count - 2] as? ViewController { 101 | return pop(from: currentViewController, to: previousViewController, animated: animated) 102 | } 103 | } 104 | return super.popViewController(animated: animated) 105 | } 106 | 107 | @discardableResult override open func popToRootViewController(animated: Bool) -> [UIViewController]? { 108 | if viewControllers.count > 1 { 109 | if let currentViewController = viewControllers.last as? ViewController, 110 | let previousViewController = viewControllers.first as? ViewController { 111 | return [pop(from: currentViewController, to: previousViewController, animated: animated)] 112 | } 113 | } 114 | return super.popToRootViewController(animated: animated) 115 | } 116 | 117 | fileprivate func pop(from currentViewController: ViewController, to previousViewController: ViewController, animated: Bool) -> UIViewController { 118 | if currentViewController.hidesNavigationBarWhenPushed == true && previousViewController.hidesNavigationBarWhenPushed == false { 119 | setTransitionCompletion(for: previousViewController) { [weak self] in 120 | previousViewController.fakeNavigationBar?.removeFromSuperview() 121 | previousViewController.fakeNavigationBar = nil 122 | self?._navigationBar.isBackgroundViewHidden = false 123 | } 124 | } else if currentViewController.hidesNavigationBarWhenPushed == false && previousViewController.hidesNavigationBarWhenPushed == true { 125 | let fakeNavigationBar = addFakeNavigationBar(to: currentViewController) 126 | _navigationBar.isBackgroundViewHidden = true 127 | currentViewController.viewWillAppearNavigationBarUpdatesBlock = { [weak self] in 128 | self?._navigationBar.isBackgroundViewHidden = false 129 | fakeNavigationBar.removeFromSuperview() 130 | } 131 | } 132 | super.popToViewController(previousViewController, animated: animated) 133 | return currentViewController 134 | } 135 | 136 | // MARK: - 137 | 138 | override open func setNavigationBarHidden(_ hidden: Bool, animated: Bool) { 139 | super.setNavigationBarHidden(hidden, animated: animated) 140 | if let viewController = visibleViewController as? ViewController, viewController.hidesNavigationBarWhenPushed && hidden == false { 141 | forceHideNavigationBar() 142 | } 143 | } 144 | 145 | private func setTransitionCompletion(for viewController: UIViewController, completion: @escaping TransitionCompletion) { 146 | transitionCompletions[viewController] = completion 147 | } 148 | 149 | private func forceHideNavigationBar() { 150 | _navigationBar.isBackgroundViewHidden = true 151 | } 152 | 153 | private func addFakeNavigationBar(to viewController: ViewController) -> NavigationBar { 154 | let fakeNavigationBar = _navigationBar.copyNavigationBar() 155 | viewController.view.addSubview(fakeNavigationBar) 156 | layout(fakeNavigationBar: fakeNavigationBar, within: viewController) 157 | return fakeNavigationBar 158 | } 159 | 160 | private func layout(fakeNavigationBar: NavigationBar, within viewController: UIViewController) { 161 | var rect = navigationBar.frame 162 | rect = navigationBar.superview?.convert(rect, to: viewController.view) ?? rect 163 | fakeNavigationBar.frame = rect 164 | fakeNavigationBar.height = rect.origin.y + rect.height 165 | } 166 | } 167 | 168 | // MARK: - UINavigationControllerDelegate 169 | 170 | extension NavigationController: UINavigationControllerDelegate { 171 | public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { 172 | if let transitionCompletion = transitionCompletions[viewController] { 173 | transitionCompletion() 174 | transitionCompletions.removeValue(forKey: viewController) 175 | } 176 | } 177 | 178 | public func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 56 | 66 | 76 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /HidesNavigationBarWhenPushedExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F02ED5CF20DE6DB5003FCF86 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F02ED5CE20DE6DB5003FCF86 /* AppDelegate.swift */; }; 11 | F02ED5D420DE6DB5003FCF86 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F02ED5D220DE6DB5003FCF86 /* Main.storyboard */; }; 12 | F02ED5D620DE6DB6003FCF86 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F02ED5D520DE6DB6003FCF86 /* Assets.xcassets */; }; 13 | F02ED5D920DE6DB6003FCF86 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F02ED5D720DE6DB6003FCF86 /* LaunchScreen.storyboard */; }; 14 | F0C1C70E20DEB9150093EAB4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0C1C70B20DEB9150093EAB4 /* ViewController.swift */; }; 15 | F0C1C70F20DEB9150093EAB4 /* NavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0C1C70C20DEB9150093EAB4 /* NavigationBar.swift */; }; 16 | F0C1C71020DEB9150093EAB4 /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0C1C70D20DEB9150093EAB4 /* NavigationController.swift */; }; 17 | F0EA62C120DE74480069B8F5 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0EA62C020DE74480069B8F5 /* MainViewController.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | F02ED5CB20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HidesNavigationBarWhenPushedExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | F02ED5CE20DE6DB5003FCF86 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | F02ED5D320DE6DB5003FCF86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | F02ED5D520DE6DB6003FCF86 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | F02ED5D820DE6DB6003FCF86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | F02ED5DA20DE6DB6003FCF86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | F0C1C70B20DEB9150093EAB4 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 28 | F0C1C70C20DEB9150093EAB4 /* NavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBar.swift; sourceTree = ""; }; 29 | F0C1C70D20DEB9150093EAB4 /* NavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = ""; }; 30 | F0EA62C020DE74480069B8F5 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | F02ED5C820DE6DB5003FCF86 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | F02ED5C220DE6DB5003FCF86 = { 45 | isa = PBXGroup; 46 | children = ( 47 | F02ED5CD20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample */, 48 | F02ED5CC20DE6DB5003FCF86 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | F02ED5CC20DE6DB5003FCF86 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | F02ED5CB20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | F02ED5CD20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | F0C1C70A20DEB9150093EAB4 /* HidesNavigationBarWhenPushed */, 64 | F02ED5CE20DE6DB5003FCF86 /* AppDelegate.swift */, 65 | F0EA62C020DE74480069B8F5 /* MainViewController.swift */, 66 | F02ED5D220DE6DB5003FCF86 /* Main.storyboard */, 67 | F02ED5D520DE6DB6003FCF86 /* Assets.xcassets */, 68 | F02ED5D720DE6DB6003FCF86 /* LaunchScreen.storyboard */, 69 | F02ED5DA20DE6DB6003FCF86 /* Info.plist */, 70 | ); 71 | path = HidesNavigationBarWhenPushedExample; 72 | sourceTree = ""; 73 | }; 74 | F0C1C70A20DEB9150093EAB4 /* HidesNavigationBarWhenPushed */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | F0C1C70B20DEB9150093EAB4 /* ViewController.swift */, 78 | F0C1C70C20DEB9150093EAB4 /* NavigationBar.swift */, 79 | F0C1C70D20DEB9150093EAB4 /* NavigationController.swift */, 80 | ); 81 | path = HidesNavigationBarWhenPushed; 82 | sourceTree = SOURCE_ROOT; 83 | }; 84 | /* End PBXGroup section */ 85 | 86 | /* Begin PBXNativeTarget section */ 87 | F02ED5CA20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample */ = { 88 | isa = PBXNativeTarget; 89 | buildConfigurationList = F02ED5DD20DE6DB6003FCF86 /* Build configuration list for PBXNativeTarget "HidesNavigationBarWhenPushedExample" */; 90 | buildPhases = ( 91 | F02ED5C720DE6DB5003FCF86 /* Sources */, 92 | F02ED5C820DE6DB5003FCF86 /* Frameworks */, 93 | F02ED5C920DE6DB5003FCF86 /* Resources */, 94 | ); 95 | buildRules = ( 96 | ); 97 | dependencies = ( 98 | ); 99 | name = HidesNavigationBarWhenPushedExample; 100 | productName = HidesNavigationBarWhenPushed; 101 | productReference = F02ED5CB20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample.app */; 102 | productType = "com.apple.product-type.application"; 103 | }; 104 | /* End PBXNativeTarget section */ 105 | 106 | /* Begin PBXProject section */ 107 | F02ED5C320DE6DB5003FCF86 /* Project object */ = { 108 | isa = PBXProject; 109 | attributes = { 110 | LastSwiftUpdateCheck = 0930; 111 | LastUpgradeCheck = 0930; 112 | ORGANIZATIONNAME = "Danil Gontovnik"; 113 | TargetAttributes = { 114 | F02ED5CA20DE6DB5003FCF86 = { 115 | CreatedOnToolsVersion = 9.3; 116 | }; 117 | }; 118 | }; 119 | buildConfigurationList = F02ED5C620DE6DB5003FCF86 /* Build configuration list for PBXProject "HidesNavigationBarWhenPushedExample" */; 120 | compatibilityVersion = "Xcode 9.3"; 121 | developmentRegion = en; 122 | hasScannedForEncodings = 0; 123 | knownRegions = ( 124 | en, 125 | Base, 126 | ); 127 | mainGroup = F02ED5C220DE6DB5003FCF86; 128 | productRefGroup = F02ED5CC20DE6DB5003FCF86 /* Products */; 129 | projectDirPath = ""; 130 | projectRoot = ""; 131 | targets = ( 132 | F02ED5CA20DE6DB5003FCF86 /* HidesNavigationBarWhenPushedExample */, 133 | ); 134 | }; 135 | /* End PBXProject section */ 136 | 137 | /* Begin PBXResourcesBuildPhase section */ 138 | F02ED5C920DE6DB5003FCF86 /* Resources */ = { 139 | isa = PBXResourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | F02ED5D920DE6DB6003FCF86 /* LaunchScreen.storyboard in Resources */, 143 | F02ED5D620DE6DB6003FCF86 /* Assets.xcassets in Resources */, 144 | F02ED5D420DE6DB5003FCF86 /* Main.storyboard in Resources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXResourcesBuildPhase section */ 149 | 150 | /* Begin PBXSourcesBuildPhase section */ 151 | F02ED5C720DE6DB5003FCF86 /* Sources */ = { 152 | isa = PBXSourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | F0C1C70E20DEB9150093EAB4 /* ViewController.swift in Sources */, 156 | F02ED5CF20DE6DB5003FCF86 /* AppDelegate.swift in Sources */, 157 | F0C1C71020DEB9150093EAB4 /* NavigationController.swift in Sources */, 158 | F0EA62C120DE74480069B8F5 /* MainViewController.swift in Sources */, 159 | F0C1C70F20DEB9150093EAB4 /* NavigationBar.swift in Sources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXSourcesBuildPhase section */ 164 | 165 | /* Begin PBXVariantGroup section */ 166 | F02ED5D220DE6DB5003FCF86 /* Main.storyboard */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | F02ED5D320DE6DB5003FCF86 /* Base */, 170 | ); 171 | name = Main.storyboard; 172 | sourceTree = ""; 173 | }; 174 | F02ED5D720DE6DB6003FCF86 /* LaunchScreen.storyboard */ = { 175 | isa = PBXVariantGroup; 176 | children = ( 177 | F02ED5D820DE6DB6003FCF86 /* Base */, 178 | ); 179 | name = LaunchScreen.storyboard; 180 | sourceTree = ""; 181 | }; 182 | /* End PBXVariantGroup section */ 183 | 184 | /* Begin XCBuildConfiguration section */ 185 | F02ED5DB20DE6DB6003FCF86 /* Debug */ = { 186 | isa = XCBuildConfiguration; 187 | buildSettings = { 188 | ALWAYS_SEARCH_USER_PATHS = NO; 189 | CLANG_ANALYZER_NONNULL = YES; 190 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 191 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 192 | CLANG_CXX_LIBRARY = "libc++"; 193 | CLANG_ENABLE_MODULES = YES; 194 | CLANG_ENABLE_OBJC_ARC = YES; 195 | CLANG_ENABLE_OBJC_WEAK = YES; 196 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 197 | CLANG_WARN_BOOL_CONVERSION = YES; 198 | CLANG_WARN_COMMA = YES; 199 | CLANG_WARN_CONSTANT_CONVERSION = YES; 200 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 201 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 202 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 203 | CLANG_WARN_EMPTY_BODY = YES; 204 | CLANG_WARN_ENUM_CONVERSION = YES; 205 | CLANG_WARN_INFINITE_RECURSION = YES; 206 | CLANG_WARN_INT_CONVERSION = YES; 207 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 208 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 209 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 210 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 211 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 212 | CLANG_WARN_STRICT_PROTOTYPES = YES; 213 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 214 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 215 | CLANG_WARN_UNREACHABLE_CODE = YES; 216 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 217 | CODE_SIGN_IDENTITY = "iPhone Developer"; 218 | COPY_PHASE_STRIP = NO; 219 | DEBUG_INFORMATION_FORMAT = dwarf; 220 | ENABLE_STRICT_OBJC_MSGSEND = YES; 221 | ENABLE_TESTABILITY = YES; 222 | GCC_C_LANGUAGE_STANDARD = gnu11; 223 | GCC_DYNAMIC_NO_PIC = NO; 224 | GCC_NO_COMMON_BLOCKS = YES; 225 | GCC_OPTIMIZATION_LEVEL = 0; 226 | GCC_PREPROCESSOR_DEFINITIONS = ( 227 | "DEBUG=1", 228 | "$(inherited)", 229 | ); 230 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 232 | GCC_WARN_UNDECLARED_SELECTOR = YES; 233 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 234 | GCC_WARN_UNUSED_FUNCTION = YES; 235 | GCC_WARN_UNUSED_VARIABLE = YES; 236 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 237 | MTL_ENABLE_DEBUG_INFO = YES; 238 | ONLY_ACTIVE_ARCH = YES; 239 | SDKROOT = iphoneos; 240 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 241 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 242 | }; 243 | name = Debug; 244 | }; 245 | F02ED5DC20DE6DB6003FCF86 /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_ANALYZER_NONNULL = YES; 250 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_ENABLE_OBJC_WEAK = YES; 256 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 257 | CLANG_WARN_BOOL_CONVERSION = YES; 258 | CLANG_WARN_COMMA = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 261 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 262 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INFINITE_RECURSION = YES; 266 | CLANG_WARN_INT_CONVERSION = YES; 267 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 268 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 269 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 272 | CLANG_WARN_STRICT_PROTOTYPES = YES; 273 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 274 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 275 | CLANG_WARN_UNREACHABLE_CODE = YES; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | CODE_SIGN_IDENTITY = "iPhone Developer"; 278 | COPY_PHASE_STRIP = NO; 279 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 280 | ENABLE_NS_ASSERTIONS = NO; 281 | ENABLE_STRICT_OBJC_MSGSEND = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu11; 283 | GCC_NO_COMMON_BLOCKS = YES; 284 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 285 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 286 | GCC_WARN_UNDECLARED_SELECTOR = YES; 287 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 288 | GCC_WARN_UNUSED_FUNCTION = YES; 289 | GCC_WARN_UNUSED_VARIABLE = YES; 290 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 291 | MTL_ENABLE_DEBUG_INFO = NO; 292 | SDKROOT = iphoneos; 293 | SWIFT_COMPILATION_MODE = wholemodule; 294 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 295 | VALIDATE_PRODUCT = YES; 296 | }; 297 | name = Release; 298 | }; 299 | F02ED5DE20DE6DB6003FCF86 /* Debug */ = { 300 | isa = XCBuildConfiguration; 301 | buildSettings = { 302 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 303 | CODE_SIGN_STYLE = Automatic; 304 | DEVELOPMENT_TEAM = 6HJFRTMUT9; 305 | INFOPLIST_FILE = "$(SRCROOT)/HidesNavigationBarWhenPushedExample/Info.plist"; 306 | LD_RUNPATH_SEARCH_PATHS = ( 307 | "$(inherited)", 308 | "@executable_path/Frameworks", 309 | ); 310 | PRODUCT_BUNDLE_IDENTIFIER = com.gontovnik.HidesNavigationBarWhenPushedExample; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | SWIFT_VERSION = 4.0; 313 | TARGETED_DEVICE_FAMILY = "1,2"; 314 | }; 315 | name = Debug; 316 | }; 317 | F02ED5DF20DE6DB6003FCF86 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 321 | CODE_SIGN_STYLE = Automatic; 322 | DEVELOPMENT_TEAM = 6HJFRTMUT9; 323 | INFOPLIST_FILE = "$(SRCROOT)/HidesNavigationBarWhenPushedExample/Info.plist"; 324 | LD_RUNPATH_SEARCH_PATHS = ( 325 | "$(inherited)", 326 | "@executable_path/Frameworks", 327 | ); 328 | PRODUCT_BUNDLE_IDENTIFIER = com.gontovnik.HidesNavigationBarWhenPushedExample; 329 | PRODUCT_NAME = "$(TARGET_NAME)"; 330 | SWIFT_VERSION = 4.0; 331 | TARGETED_DEVICE_FAMILY = "1,2"; 332 | }; 333 | name = Release; 334 | }; 335 | /* End XCBuildConfiguration section */ 336 | 337 | /* Begin XCConfigurationList section */ 338 | F02ED5C620DE6DB5003FCF86 /* Build configuration list for PBXProject "HidesNavigationBarWhenPushedExample" */ = { 339 | isa = XCConfigurationList; 340 | buildConfigurations = ( 341 | F02ED5DB20DE6DB6003FCF86 /* Debug */, 342 | F02ED5DC20DE6DB6003FCF86 /* Release */, 343 | ); 344 | defaultConfigurationIsVisible = 0; 345 | defaultConfigurationName = Release; 346 | }; 347 | F02ED5DD20DE6DB6003FCF86 /* Build configuration list for PBXNativeTarget "HidesNavigationBarWhenPushedExample" */ = { 348 | isa = XCConfigurationList; 349 | buildConfigurations = ( 350 | F02ED5DE20DE6DB6003FCF86 /* Debug */, 351 | F02ED5DF20DE6DB6003FCF86 /* Release */, 352 | ); 353 | defaultConfigurationIsVisible = 0; 354 | defaultConfigurationName = Release; 355 | }; 356 | /* End XCConfigurationList section */ 357 | }; 358 | rootObject = F02ED5C320DE6DB5003FCF86 /* Project object */; 359 | } 360 | --------------------------------------------------------------------------------