Reputation: 115
I am trying to set height and width of an image . I've tried using following code but it didn't work.
Image("testImg")
.frame(width: 50, height: 50)
Upvotes: 3
Views: 640
Reputation: 629
var body: some View {
Image("yourImage")
.resizable()
.scaledToFit()
.frame(width: 50.0, height:50.0)
}
Upvotes: 1
Reputation: 568
Image("testImg")
.resizable()
.scaledToFit()
.frame(width: required-width,height:required-height)
Upvotes: 0
Reputation: 1680
Try this code:
Image("testImg")
.resizable()
.scaledToFit()
.frame(width: 50,height:50)
Upvotes: 1
Reputation: 1760
Image(restaurant.image)
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
Upvotes: 1
Reputation: 636
Try this
Image("testImg")
.resizable()
.frame(width: 50.0, height: 50.0)
Upvotes: 5