summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/CustomNavigationBar.swift
blob: 4168d62bb04c67348bfabbdb6d28bda9f80a9642 (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
34
35
36
37
38
39
40
//
//  CustomNavigationBar.swift
//  MullvadVPN
//
//  Created by pronebird on 22/05/2019.
//  Copyright © 2019 Mullvad VPN AB. All rights reserved.
//

import UIKit

class CustomNavigationBar: UINavigationBar {

    override init(frame: CGRect) {
        super.init(frame: frame)

        commonInit()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)

        commonInit()
    }

    private func commonInit() {
        var margins = layoutMargins
        margins.left = 24
        margins.right = 24
        layoutMargins = margins

        if #available(iOS 13, *) {
            // no-op
        } else {
            barTintColor = .secondaryColor
            shadowImage = UIImage()
            isTranslucent = false
        }
    }

}