Minor fixes

This commit is contained in:
Shaps Benkau 2023-02-06 09:33:23 +00:00
parent d619ce3a08
commit 1877ddf7e4
2 changed files with 17 additions and 18 deletions

View File

@ -96,8 +96,7 @@ private struct DynamicTypeRangeModifier: ViewModifier {
@Environment(\.backportDynamicTypeSize) private var size
private var resolvedSize: Backport<Any>.DynamicTypeSize {
print(range)
return range.contains(size)
range.contains(size)
? size
: max(range.lowerBound, min(range.upperBound, size))
}

View File

@ -18,20 +18,20 @@ public extension Backport<Any> {
public extension Backport<Any>.ImageRenderer {
var cgImage: CGImage? {
#if os(macOS)
#if os(macOS)
nsImage?.cgImage(forProposedRect: nil, context: .current, hints: nil)
#else
#else
uiImage?.cgImage
#endif
#endif
}
#if os(macOS)
#if os(macOS)
var nsImage: NSImage? {
NSHostingController(rootView: content).view.snapshot
}
#else
#else
var uiImage: UIImage? {
let controller = UIHostingController(rootView: content)
@ -55,7 +55,7 @@ public extension Backport<Any>.ImageRenderer {
return image
}
#endif
#endif
}
#if os(iOS)