2

I am attempting to create a list row that contains among other things, multiple individually usable buttons. Previously, I was able to accomplish this by overlaying the buttons on top of the HStacks in the list, but recently this has ceased to function properly.

From searching around, I found this question where the accepted answer suggests using the BorderlessButtonStyle on all buttons to allow them to be individually clicked. However, whenever I apply this property to my button, as in the following code, the button no longer is able to be clicked at all.

Is this an issue with how I am implementing the BorderlessButtonStyle or a bug in SwiftUI?

List{
    HStack {
        Text("Display Name").bold()
        Divider()
        if !self.editing_name{
            Text(Auth.auth().currentUser?.displayName ?? "Unknown Name")
        }
        else{
            TextField("Name", text: self.$new_name)
        }
        Spacer()

        Button(action: {
            print("Edit")
        }) {
            Image(systemName: "pencil")
                .font(.body)
                .foregroundColor(Color.blue)
        }.buttonStyle(BorderlessButtonStyle())
    }
}

I am currently using Xcode 11.5 / iOS 13.5

0 Answers0