I added a custom font to my project and made sure it was in the "Copy Bundle Resources" in Build Phases. I also made sure it was added properly to the plist file:
but when I set up a function for placeholder text :
let attributes = [
NSForegroundColorAttributeName: UIColor.white,
NSFontAttributeName : UIFont(name: "NeutraText-Bold", size: 17)!
]
func placeHolder(_ text: String) -> (NSAttributedString){
return NSAttributedString(string: text, attributes:attributes)
}
signUpTextField.attributedPlaceholder = placeHolder("Sign Up")
I get the error:
fatal error: unexpectedly found nil while unwrapping an Optional value
for the line
NSFontAttributeName : UIFont(name: "NeutraText-Bold", size: 17)!