I want to change the font in the navigation bar. However, the following code does not work; it causes the application to crash.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Lato-Light.ttf", size: 34)!] return true }
I get the following error:
fatal error: unexpectedly found nil while unwrapping an Optional value(lldb)
I really added the Lato-Light.ttf font to my project so that it can find it.
source share