summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Containers/Navigation/CustomNavigationController.swift
blob: bb83115ddb82fb8c64ea047365daa93560ff6735 (plain)
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
//
//  CustomNavigationController.swift
//  MullvadVPN
//
//  Created by pronebird on 23/02/2023.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import UIKit

/// Custom navigation controller that applies the custom appearance to itself.
class CustomNavigationController: UINavigationController {
    override var childForStatusBarHidden: UIViewController? {
        topViewController
    }

    override var childForStatusBarStyle: UIViewController? {
        topViewController
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        navigationBar.configureCustomAppeareance()
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        // Navigation bar updates the prompt color on layout so we have to force our own appearance on each layout pass.
        navigationBar.overridePromptColor()
    }
}