diff --git a/SwiftDraw/Sources/CanvasNSView.swift b/SwiftDraw/Sources/CanvasNSView.swift index 897ee2b..b1eec2b 100644 --- a/SwiftDraw/Sources/CanvasNSView.swift +++ b/SwiftDraw/Sources/CanvasNSView.swift @@ -29,7 +29,7 @@ // 3. This notice may not be removed or altered from any source distribution. // -#if canImport(AppKit) +#if canImport(AppKit) && !targetEnvironment(macCatalyst) import AppKit import SwiftUI diff --git a/SwiftDraw/Sources/SVG+UIGraphicsImageRendererContext.swift b/SwiftDraw/Sources/SVG+UIGraphicsImageRendererContext.swift new file mode 100644 index 0000000..bd381c6 --- /dev/null +++ b/SwiftDraw/Sources/SVG+UIGraphicsImageRendererContext.swift @@ -0,0 +1,31 @@ +// +// SVG+UIGraphicsImageRendererContext.swift +// SwiftDraw +// +// Created by Daniel on 10/14/25. +// + +#if canImport(UIKit) +public import CoreGraphics +public import UIKit + +public extension UIGraphicsImageRendererContext { + + func draw(_ svg: SVG, in rect: CGRect? = nil) { + self.cgContext.draw(svg, in: rect) + } + + func draw(_ svg: SVG, in rect: CGRect, byTiling: Bool) { + self.cgContext.draw(svg, in: rect, byTiling: byTiling) + } + + func draw( + _ svg: SVG, + in rect: CGRect, + capInsets: (top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat), + byTiling: Bool + ) { + self.cgContext.draw(svg, in: rect, capInsets: capInsets, byTiling: byTiling) + } +} +#endif