mattmaddux/FASwiftUI

Add fallback and error logging for missing styles and incorrect names

alexis-ag opened this issue · 8 comments

i've

  • added package dependancy
  • copied icons.json and three font files *.otf to my project
  • added them to the target
  • added to info.plist new section "Fonts provided by application" with three items (like 'Font Awesome 5 Brands-Regular-400.otf' without quotation)
  • i've added "FAText(iconName: "bomb", size: 50)" to the view
  • and all what i see is a question icon

Screenshot 2020-02-17 at 18 14 14

what am i doing wrong? could you help me?

Sure, would you mind posting the source code for the view you’re trying?

yeah, also i attached a source code with simple oneview swiftui proj

import SwiftUI
import FASwiftUI

struct ContentView: View {
var body: some View {
VStack {
Text("Hello, World!")
FAText(iconName: "bomb", size: 200)
}
}
}
font_awesome.zip

Great. Will try to figure it out tonight.

So you haven't actually checked the Target Membership box for each of the font files. Try that for each of them and try again.

Screen Shot 2020-02-17 at 8 46 16 PM

it's strange because i put it in target while adding files to the project
so, i've added them
and a result is the same
font_awesome.zip

thanks for paying attention

Yeah, it's a little odd that for the .otf files you always have to manually add the target. Not sure why.

But I figured out what was going on, the regular style of "bomb" is not included in the free FA set, only solid. So if you try this view...

import SwiftUI
import FASwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Text("Hello, World!")
            FAText(iconName: "bomb", size: 200, style: .solid)
            FAText(iconName: "flag", size: 200)
        }
    }
}

struct Test_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

...you'll notice they both work with your project (both regular and solid are included in the free set for "flag").

I should try to figure out some fallback to available types, or error messaging. But to see all the available versions I'd have to include a list, which I don't want to maintain.

I'll think about how this can be handled better.

(And maybe I should change my examples in the readme to something that's in the free FA set.)

cool, thanks for helping me

Done with 1.0.4 release.