Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmaddux committed Oct 5, 2019
1 parent dceb640 commit 2ff58a4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Sources/FASwiftUI/FAIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ enum FACollection: String {
case pro = "Font Awesome 5 Pro"
case free = "Font Awesome 5 Free"
case brands = "Font Awesome 5 Brands"

static var availableCollection: [FACollection] {
var result = [FACollection]()
if FACollection.isAvailable(collection: .pro) {
result.append(.pro)
}
if FACollection.isAvailable(collection: .free) {
result.append(.free)
}
if FACollection.isAvailable(collection: .brands) {
result.append(.brands)
}
return result
}

static func isAvailable(collection: FACollection) -> Bool {
return UIFont.familyNames.contains(collection.rawValue)
}
}

// ======================================================= //
Expand All @@ -61,7 +79,7 @@ public struct FAIcon: Identifiable, Decodable, Comparable {
var collection: FACollection {
if styles.contains(.brands) {
return .brands
} else if UIFont.familyNames.contains(FACollection.pro.rawValue){
} else if FACollection.isAvailable(collection: .pro) {
return .pro
} else {
return .free
Expand Down

0 comments on commit 2ff58a4

Please sign in to comment.