The problem: When i use AsyncImage to display an image. The size of image is big and dont fit the size of frame.
Thats the code i used:
AsyncImage(url: URL(string: mockImageUrl))
.frame(width: 200, height: 300)
And this is how image is displayed:
What I need: I need to do image fits the frame.
What I tryed: I defined the size of AsyncImage but the image still doesnt feat the height and width of frame.
Solution:
To make image follow the size of AsyncImage you need change the scale of image like this:
".resizable()" code allow the image size fit the frame of AsyncImage.
image on emulator
Documentation examples:
https://developer.apple.com/documentation/swiftui/asyncimage