Skip to content

Commit

Permalink
fix caption3 availabilities on tvOS
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-at-will authored Jan 27, 2025
1 parent a6736b4 commit 0b765b8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions RevenueCatUI/PaywallFontProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ open class DefaultPaywallFontProvider: PaywallFontProvider {
case .caption: return .caption
case .caption2: return .caption2

#if compiler(>=6.0) && os(tvOS)
// Font.TextStyle.caption3 was introduced with tvOS 18.0/Xcode 16.0, but
// was removed without warning in Xcode 16.1/tvOS 18.1 and hasn't been reintroduced
// since.
// Xcode 16.0 shipped with Swift compiler 6.0, and Xcode 16.1 shipped with Swift compiler 6.0.2,
// this allows us to target builds built only with Xcode 16.0.
//
// We will need to reevaluate this if and when Font.TextStyle.caption3 is reintroduced.
#if compiler(>=6.0) && compiler(<6.0.2) && os(tvOS)
case .caption3: if #available(tvOS 18.0, *) {
return .system(.caption3)
} else {
Expand Down Expand Up @@ -117,7 +124,14 @@ private extension Font.TextStyle {
case .caption: return .caption1
case .caption2: return .caption2

#if compiler(>=6.0) && os(tvOS)
// Font.TextStyle.caption3 was introduced with tvOS 18.0/Xcode 16.0, but
// was removed without warning in Xcode 16.1/tvOS 18.1 and hasn't been reintroduced
// since.
// Xcode 16.0 shipped with Swift compiler 6.0, and Xcode 16.1 shipped with Swift compiler 6.0.2,
// this allows us to target builds built only with Xcode 16.0.
//
// We will need to reevaluate this if and when Font.TextStyle.caption3 is reintroduced.
#if compiler(>=6.0) && compiler(<6.0.2) && os(tvOS)
case .caption3: return .caption2
#endif

Expand Down

0 comments on commit 0b765b8

Please sign in to comment.