2

Is there same thing as ImageEdgeInsets for SwiftUI. For example I have button 60x60. And want to make inset for image inside.

VStack(alignment: .leading, spacing: 0.0){
            Section{
                Button(action: {
                    if self.accountViewModel.signInContext == .quote{
                        self.presentationMode.wrappedValue.dismiss()
                    }else{
                        self.viewController?.dismiss(animated: true)
                    }
                }){
                    Image("Close Icon").renderingMode(.template).padding(.vertical, 20).padding(.horizontal, 20).foregroundColor(.white).scaledToFit()
                }
                .frame(width: 60, height: 60)
                Rectangle().line().padding(.horizontal, -30)
            }
        }

1 Answer 1

4

Yes, .padding is for that purpose, just needed to make image resizable. I suppose you need the following

Image("Close Icon")
    .renderingMode(.template)
    .resizable()
    .aspectRatio(contentMode: .fit)
    .padding(.vertical, 20).padding(.horizontal, 20)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.