Created
June 7, 2020 02:07
-
-
Save prafullakumar/ab0b81582d4dc8769e49b0b3633998b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
// Create the SwiftUI view that provides the window contents. | |
//Use this if NavigationBarTitle is with Large Font | |
updateAppearance() | |
let contentView = ContentView().accentColor(Color.theme) | |
// Use a UIHostingController as window root view controller. | |
if let windowScene = scene as? UIWindowScene { | |
let window = UIWindow(windowScene: windowScene) | |
window.rootViewController = UIHostingController(rootView: contentView) | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
} | |
private func updateAppearance() { | |
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.textHeaderPrimary] | |
//Use this if NavigationBarTitle is with displayMode = .inline | |
UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: UIColor.textHeaderPrimary] | |
UISwitch.appearance().onTintColor = UIColor.theme | |
//set other like tableView etc | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment