ios - Could not find an overload for “init” that accepts the supplied arguments SWIFT -



ios - Could not find an overload for “init” that accepts the supplied arguments SWIFT -

i used code

self.navigationcontroller?.navigationbar.titletextattributes = [nsfontattributename: uifont(name: "helveticaneue-light", size: 20), nsforegroundcolorattributename: uicolor.whitecolor()]

and i'm getting error "could not find overload “init” accepts supplied arguments"

uifont(name:size:) failable initializer -- homecoming nil if can't find font , crash app if disclose homecoming value. utilize code safely font , utilize it:

if allow font = uifont(name: "helveticaneue-light", size: 20) { self.navigationcontroller?.navigationbar.titletextattributes = [nsfontattributename: font, nsforegroundcolorattributename: uicolor.whitecolor()] }

ios xcode swift

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -