Skip to content

Commit

Permalink
Adding check for visionOS in Font resource (#5892)
Browse files Browse the repository at this point in the history
* adding check for visionOS

* fixing check
  • Loading branch information
PushedCrayon authored and pepicrft committed Feb 12, 2024
1 parent 3771c26 commit da17e99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/TuistGenerator/Templates/FontsTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension SynthesizedResourceInterfaceTemplates {
{% set fontType %}{{param.name}}FontConvertible{% endset %}
#if os(macOS)
import AppKit.NSFont
#elseif os(iOS) || os(tvOS) || os(watchOS)
#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
import UIKit.UIFont
#endif
#if canImport(SwiftUI)
Expand Down Expand Up @@ -55,7 +55,7 @@ extension SynthesizedResourceInterfaceTemplates {
#if os(macOS)
{{accessModifier}} typealias Font = NSFont
#elseif os(iOS) || os(tvOS) || os(watchOS)
#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
{{accessModifier}} typealias Font = UIFont
#endif
Expand All @@ -74,7 +74,7 @@ extension SynthesizedResourceInterfaceTemplates {
}
#if os(macOS)
return SwiftUI.Font.custom(font.fontName, size: font.pointSize)
#elseif os(iOS) || os(tvOS) || os(watchOS)
#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
return SwiftUI.Font(font)
#endif
}
Expand All @@ -98,7 +98,7 @@ extension SynthesizedResourceInterfaceTemplates {
{{accessModifier}} extension {{fontType}}.Font {
convenience init?(font: {{fontType}}, size: CGFloat) {
#if os(iOS) || os(tvOS) || os(watchOS)
#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) {
font.register()
}
Expand Down

0 comments on commit da17e99

Please sign in to comment.