-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
It appears that if we want an image to be resizable, we cannot set the aspectRatio modifier unless we have a known aspect ratio we want to adhere to.
This code works
struct ThemedBackground: ViewModifier {
func body(content: Content) -> some View {
content
.background(
Image("accent_background")
.resizable()
.ignoresSafeArea(.all)
)
}
}
adding aspect ratio breaks the resizing
struct ThemedBackground: ViewModifier {
func body(content: Content) -> some View {
content
.background(
Image("accent_background")
.resizable()
.aspectRatio(contentMode: .fill)
.ignoresSafeArea(.all)
)
}
}
Example of image not resizing:

NOTE
- Can repo on my iPhone 16 Pro running 18.6.2
- Cannot repo on my emulated 16 plus running 18.0
Metadata
Metadata
Assignees
Labels
No labels