You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SVGs can be displayed within `SVGView`just like using SwiftUI's built-in `Image`:
41
+
`SVGView`works much like SwiftUI’s built-in `Image` view:
42
42
43
43
```swift
44
44
SVGView("sample.svg")
45
45
```
46
46
47
-
By default, SVGs are rendered at their original (intrinsic) size. To make them flexible within layouts, mark them as resizable — exactly like `Image`:
47
+
By default, the SVG is rendered at its intrinsic size. To make it flexible within layouts, mark it as resizable — just like `Image`:
48
48
49
49
```swift
50
50
SVGView("sample.svg")
51
-
.resizable()
52
-
.scaledToFit()
51
+
.resizable()
52
+
.scaledToFit()
53
53
```
54
54
55
-
This allows the SVG to scale proportionally to fit within its container. Use `.scaledToFill()` to completely cover the container and use `.resizable(resizingMode: .tile)` to draw the SVG in repeating tiles filling the available space.
55
+
- Use `.scaledToFit()` to scale proportionally so the SVG fits inside its container.
56
+
- Use `.scaledToFill()` to fill the entire container, cropping if necessary.
57
+
- Use `.resizable(resizingMode: .tile)` to repeat the SVG as tiles across the available space.
56
58
57
-
When you load by name, SVGView uses an internal cache so repeated lookups are efficient.
58
-
For more predictable performance (avoiding any cache lookup or parsing), you can pass an already-created SVG instance:
59
+
When loading by name, `SVGView` maintains an internal cache for efficient repeated lookups.
60
+
For more predictable performance (avoiding cache lookups or parsing), you can pass in an already-constructed `SVG` instance:
0 commit comments