Control Size of content

I practice using SwiftUI Tutorials. https://developer.apple.com/tutorials/swiftui/

I want to fix size of the image. Tell me how to solve this, please.

I build like that:

import SwiftUI

struct CircleImage: View {

    var image: Image

    

    var body: some View {

        image

            .clipShape(Circle())

            .overlay {

                Circle().stroke(.gray, lineWidth: 4)

            }

            .shadow(radius: 7)

    }

}

You should use .resizable modifier:

Image("some image")
    .resizable()
    .frame(width: 32.0, height: 32.0)
    .clipShape(Circle()) // or Ellipse()) if original image is not square
    .overlay {
        Circle().stroke(.gray, lineWidth: 4)  // or Ellipse()
      }
     .shadow(radius: 7)

If image is not square, you can also use aspectRatio

        Image("some image")
            .resizable()
            .aspectRatio(UIImage(named: "some image")!.size, contentMode: .fit)
            .frame(width: 32, height: 32)
            .clipShape(Circle())
            .overlay {
                Circle().stroke(.gray, lineWidth: 4)
            }
            .shadow(radius: 7)

if you need more details, please show more code.

Control Size of content
 
 
Q