diff --git a/Package.swift b/Package.swift index 2f7000a..7219a7a 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -6,11 +6,12 @@ import PackageDescription let package = Package( name: "FontAwesomeSwiftUI", platforms: [ - .macOS(.v10_15), - .iOS(.v13), - .tvOS(.v13), - .watchOS(.v6) - ], + .macOS(.v12), + .iOS(.v15), + .tvOS(.v13), + .watchOS(.v6), + .visionOS(.v1) + ], products: [ .library( name: "FontAwesomeSwiftUI", diff --git a/Sources/FontAwesomeSwiftUI/FontAwesome.swift b/Sources/FontAwesomeSwiftUI/FontAwesome.swift index d55f0a9..890527a 100644 --- a/Sources/FontAwesomeSwiftUI/FontAwesome.swift +++ b/Sources/FontAwesomeSwiftUI/FontAwesome.swift @@ -16,7 +16,6 @@ public struct FontAwesome { } } -@available(iOS 13.0, OSX 10.15, *) public extension SwiftUI.Font { static func awesome(style: FontStyle, size: CGFloat) -> SwiftUI.Font { return SwiftUI.Font.custom(style.rawValue, size: size) diff --git a/Sources/FontAwesomeSwiftUI/FontRegister.swift b/Sources/FontAwesomeSwiftUI/FontRegister.swift index 5986461..d7e6676 100644 --- a/Sources/FontAwesomeSwiftUI/FontRegister.swift +++ b/Sources/FontAwesomeSwiftUI/FontRegister.swift @@ -5,36 +5,34 @@ // Created by khoa on 18/10/2020. // -#if os(iOS) || os(tvOS) -import UIKit +#if os(OSX) + import AppKit #else -import AppKit + import UIKit #endif final class FontRegister { - #if os(iOS) || os(tvOS) - func register(fontName: String) { - guard let url = self.url(fontName: fontName) else { - assertionFailure("Can not locate font \(fontName)") - return - } - - var error: Unmanaged? - if !CTFontManagerRegisterFontsForURL(url as CFURL, .process, &error) { - if let error = error { - let description: CFString = CFErrorCopyDescription(error.takeUnretainedValue()) - assertionFailure("Can not locate font \(fontName). Reason \(description)") - } else { - assertionFailure("Can not register font \(fontName)") + #if os(iOS) || os(tvOS) || os(visionOS) + func register(fontName: String) { + guard let url = self.url(fontName: fontName) else { + assertionFailure("Can not locate font \(fontName)") + return + } + + var error: Unmanaged? + if !CTFontManagerRegisterFontsForURL(url as CFURL, .process, &error) { + if let error = error { + let description: CFString = CFErrorCopyDescription(error .takeUnretainedValue()) + assertionFailure("Can not locate font \(fontName). Reason \(description)") + } else { + assertionFailure("Can not register font \(fontName)") + } } } - } #else - func register(fontName: String) { - - } + func register(fontName: String) {} #endif