2 years ago
#11200
noloman
UIKit AppDelegate: apply style when app is launched
I’m trying to create an app using UIKit and I need to apply a certain theme once my app launches. I do so in the application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) but when I do Theme.apply(to: application.windows.first!) the app crashes with Unexpectedly found nil while unwrapping an Optional value
if I remove the Theme.apply line, it all works fine as my storyboard is launch and I see my tab bar controller. How can I grab the window to which I should apply my theme too?
I’m following https://nsscreencast.com/episodes/382-podcast-app-setup-theming?series=17 BTW, but it’s a bit outdated since it was written for Xcode 10.
Thanks a lot in advance!
swift
uikit
appdelegate
0 Answers
Your Answer