Reputation: 8707
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 {
...
}
}
}
}
Upvotes: 5
Views: 5311
Reputation: 1062
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.
Upvotes: 1
Reputation: 1976
One way of doing it is via
profileImage.resizable().frame(width: 50, height: 50)
Upvotes: 10