1792f4b4bb
- Rewrite Settings controller in Swift - Move settings as tab bar item - Force settings save when user change tab or back from a sub-setting controller
57 lines
1.8 KiB
Swift
57 lines
1.8 KiB
Swift
//
|
|
// EQNAppearanceCommand.swift
|
|
// Earthquake Network
|
|
//
|
|
// Created by Busi Andrea on 14/08/2020.
|
|
// Copyright © 2020 Earthquake Network. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
|
|
public class EQNAppearanceCommand: EQNCommandProtocol {
|
|
|
|
|
|
// MARK: - Public
|
|
|
|
func execute() {
|
|
print("EQNAppearanceCommand: start execute")
|
|
|
|
applyAppearance()
|
|
}
|
|
|
|
// MARK: - Private
|
|
|
|
private func applyAppearance() {
|
|
// UINavigationBar
|
|
let proxyNavBar = UINavigationBar.appearance(whenContainedInInstancesOf: [UINavigationController.self])
|
|
if #available(iOS 13.0, *) {
|
|
let navAppearance = UINavigationBarAppearance()
|
|
navAppearance.configureWithOpaqueBackground()
|
|
navAppearance.titleTextAttributes = [
|
|
NSAttributedString.Key.foregroundColor: UIColor.darkGray
|
|
]
|
|
navAppearance.largeTitleTextAttributes = [
|
|
NSAttributedString.Key.foregroundColor: UIColor.darkGray
|
|
]
|
|
navAppearance.backgroundColor = UIColor.eqn_primary
|
|
navAppearance.shadowColor = UIColor.clear
|
|
|
|
proxyNavBar.isTranslucent = false
|
|
proxyNavBar.tintColor = UIColor.darkGray
|
|
proxyNavBar.standardAppearance = navAppearance
|
|
proxyNavBar.scrollEdgeAppearance = navAppearance
|
|
} else {
|
|
proxyNavBar.tintColor = UIColor.darkGray
|
|
proxyNavBar.isTranslucent = false
|
|
proxyNavBar.barTintColor = UIColor.eqn_primary
|
|
proxyNavBar.titleTextAttributes = [
|
|
NSAttributedString.Key.foregroundColor: UIColor.white
|
|
]
|
|
}
|
|
|
|
let proxyTabBar = UITabBar.appearance()
|
|
proxyTabBar.tintColor = UIColor(named: "Red")!
|
|
}
|
|
}
|