Skip to content

Commit

Permalink
Added fonts design compability.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Sep 8, 2023
1 parent 08529c0 commit 6b4222f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/SwiftUIExtension/Compability/TextCompability.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import SwiftUI

extension Text {

public func fontDesignCompability(_ design: Font.Design?) -> Text {
if #available(iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1, *) {
return self.fontDesign(design)
} else {
return self
}
}
}
8 changes: 8 additions & 0 deletions Sources/SwiftUIExtension/Compability/ViewCompability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ extension View {
return self
}
}

public func fontDesignCompability(_ design: Font.Design?) -> some View {
if #available(iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1, *) {
return self.fontDesign(design)
} else {
return self
}
}
}

0 comments on commit 6b4222f

Please sign in to comment.