blueskies
blueskies

Reputation: 93

Resize label Image SwiftUI

I have a label with a custom Image. I want to make the Image resizable, but I can't find any way to do this. Here is my code ;

Label("Continue with Google", image: "googleLogo")
                .foregroundColor(.white)
                .background(Color.red)

Any help is appreciated!

Upvotes: 5

Views: 6037

Answers (1)

Bill Haku
Bill Haku

Reputation: 281

You can write like this:

Label {
    Text("Continue with Google")
} icon: {
    Image("googleLogo")
        .resizable()
        .scaledToFit()
}

Hope it can help you.

Upvotes: 17

Related Questions