Set fixed size to Image

Viewed 3884

How can I set a fixed size for an Image in SwiftUI? Currently my Image is really big

At the moment I have this structure:

struct TweetCell: View {
     var profileImage: Image
     var body: some View {
         HStack {
              profileImage
             VStack {
            ...
         }
    }
  }
}
2 Answers

One way of doing it is via

profileImage.resizable().frame(width: 50, height: 50)
There are multiple ways to set fixed size to Image

1) Image("yourImage").frame(width: 25, height: 25, alignment: .center)

2) Image("yourImage").resizable().frame(width: 25, height: 25, alignment: .center)
3) Image("yourImage").frame(width: 25, height: 25, alignment: .center).clipped()

Attached the screenshots for all.

image1

image2

image3

Related