LiveUI / Awesome

FontAwesome 6 Swift & SwiftUI implementation for iOS, tvOS & macOS
MIT License
97 stars 27 forks source link

Added Swift package support #57

Closed sarathsarah closed 2 years ago

sarathsarah commented 2 years ago

Added Swift package support tested in Same project as well.

sarathsarah commented 2 years ago

@rafiki270 Please take a look and review it.

lozhuf commented 2 years ago

Unfortunately there seems to be a problem with loading AwesomePro fonts. In Fonts.swift line 105 & 123, the use of Bundle.module leads to the NSBundle being <myApp>.app/Awesome_Awesome.bundle, even though the pro font resource files are saved to Bundle.main.

sarathsarah commented 2 years ago

is it crashing? I got crash while accessing Font.load() in NSAttributedString+Awesome line 21. Thats why I added Bundle.module there.

lozhuf commented 2 years ago

It crashes if you try to use the pro font after loading it. The load will just fail silently if it can't find the pro fonts. The issue is that the pro files are in Bundle.main, while the regular font files are in Bundle.module. I believe you need to use Bundle.module only if the passed in bundle is nil, and it's AwesomeSPM.

lozhuf commented 2 years ago

I have just fixed this issue here: https://github.com/sarathsarah/Awesome/pull/1

sarathsarah commented 2 years ago

@lozhuf Merged your PR. and Thanks ;)

sarathsarah commented 2 years ago

Adding .swiftpm to .gitignore will create issue isn't it?