fatal error: value failed to bridge from Swift type to a Objective-C type
I get an error when changing the default text attributes, any help on how to change the default text font ?
When you change the default font, try to change the emphasis attributes and the strong attributes..
@JKINGH Please post the code that you're using.
I was trying to change the font within the textViewController by passing it a string
if let font = UIFont(name: "Lato-Thin", size: 26) {
attributes.defaultAttributes[NSFontAttributeName] = font
}
@JKINGH assuming that you have a bold version of this font with the name "Lato-Bold", you can use:
if let boldFont = UIFont(name: "Lato-Bold", size: 26) {
attributes.emphasisAttributes = [NSFontAttributeName: boldFont]
attributes.strongAttributes = [NSFontAttributeName: boldFont]
}
I am able to change the attributes of bold or any other, but for default text which has no style applied I cannot seem to change the font, even system fonts such as Helvetica.
@JKINGH You mentioned that you "get an error" when the font is changed. What is the error? Or does it just not use the font you specify?
Just realized the error is in the title, sorry. Do you know which value it's failing to bridge?