MarkdownTextView icon indicating copy to clipboard operation
MarkdownTextView copied to clipboard

fatal error: value failed to bridge from Swift type to a Objective-C type

Open JDSX opened this issue 9 years ago • 7 comments

I get an error when changing the default text attributes, any help on how to change the default text font ?

JDSX avatar Mar 24 '16 18:03 JDSX

When you change the default font, try to change the emphasis attributes and the strong attributes..

hussc avatar Apr 01 '16 08:04 hussc

@JKINGH Please post the code that you're using.

indragiek avatar Apr 02 '16 19:04 indragiek

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
    } 

JDSX avatar Apr 07 '16 20:04 JDSX

@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]
        }

hussc avatar Apr 08 '16 03:04 hussc

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.

JDSX avatar Apr 08 '16 15:04 JDSX

@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?

indragiek avatar Apr 23 '16 21:04 indragiek

Just realized the error is in the title, sorry. Do you know which value it's failing to bridge?

indragiek avatar Apr 23 '16 21:04 indragiek