Q:

How can you use a conditional statement in a swift method

I'd like to the padding in my buttonstyle to be conditional. If the buttonstyle parameter says its a circle I want a lot of padding and if not I only want a little padding.
I've tried adding an If statement in the code,
configuration.label
            .padding(if ButtonShape == "Circle" {
                60
                }else{
                30})

but I get the error "Expected expression in list of expressions"
I've also tried doing it inline as well. That didn't work at all
.padding((ButtonShape == "Circle"? 60:30))

returns the errors:
Cannot use optional chaining on non-optional value of type 'String'
Expected ',' separator
Any help would be greatly appreciated. Here is the full code:
struct SimpleButtonStyle: ButtonStyle {
    var ButtonShape: String
    
    
    func makeBody(configuration: Self.Configuration) -> some
        
        
        View {

        configuration.label
            .padding(if ButtonShape == "Circle" {
                60
                }else{
                30})
        .contentShape(Circle())
        .background(
            Group{
                if ButtonShape == "Circle" {
                    if configuration.isPressed{
                        Circle()
                            .fill(Color.offWhite)
                        .overlay(
                            Circle()
                                .stroke(Color.gray, lineWidth: 4)
                                .blur(radius: 4)
                                .offset(x: 2, y: 2)
                                .mask(Circle().fill(LinearGradient(Color.black,Color.clear)))
                            
                        )
                        .overlay(
                            Circle()
                                .stroke(Color.white,lineWidth: 8)
                                .blur(radius: 4)
                                .offset(x: -2, y: -2)
                                .mask(Circle().fill(LinearGradient(Color.clear,Color.black)))
                        
                        )
                    } else {
                        Circle()
                            .fill(Color.offWhite)
                            .shadow(color: Color.black.opacity(0.2), radius: 10, x: 10, y: 10)
                            .shadow(color: Color.white.opacity(0.7), radius: 10, x: -5, y: -5)
                    }
                } else {
                    if configuration.isPressed{
                        Capsule()
                            .fill(Color.offWhite)
                        .overlay(
                            Capsule()
                                .stroke(Color.gray, lineWidth: 4)
                                .blur(radius: 4)
                                .offset(x: 2, y: 2)
                                .mask(Capsule().fill(LinearGradient(Color.black,Color.clear)))
                            
                        )
                        .overlay(
                            Capsule()
                                .stroke(Color.white,lineWidth: 8)
                                .blur(radius: 4)
                                .offset(x: -2, y: -2)
                                .mask(Capsule().fill(LinearGradient(Color.clear,Color.black)))
                        
                        )
                    } else {
                        Capsule()
                            .fill(Color.offWhite)
                            .shadow(color: Color.black.opacity(0.2), radius: 10, x: 10, y: 10)
                            .shadow(color: Color.white.opacity(0.7), radius: 10, x: -5, y: -5)
                    }
                    
                    
                    
                }
            
        })
        
    }
}

A:

You need to add a space before the ? operator. Without the space the compiler mistok it for an optional.
.padding(ButtonShape == "Circle" ? 60:30)

