Skip to content

Commit 6b4222f

Browse files
committed
Added fonts design compability.
1 parent 08529c0 commit 6b4222f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import SwiftUI
2+
3+
extension Text {
4+
5+
public func fontDesignCompability(_ design: Font.Design?) -> Text {
6+
if #available(iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1, *) {
7+
return self.fontDesign(design)
8+
} else {
9+
return self
10+
}
11+
}
12+
}

Sources/SwiftUIExtension/Compability/ViewCompability.swift

+8
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@ extension View {
3333
return self
3434
}
3535
}
36+
37+
public func fontDesignCompability(_ design: Font.Design?) -> some View {
38+
if #available(iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1, *) {
39+
return self.fontDesign(design)
40+
} else {
41+
return self
42+
}
43+
}
3644
}

0 commit comments

Comments
 (0)