3

In edit mode when you add ".onDelete" for the row a red circle with minus symbol appear like the this photo

enter image description here

I want to show a green circle with plus symbol (like the photo below) in edit mode, and when the user tap this green circle the row will be added to another section.

enter image description here

My issue is how to add this "green circle with plus symbol" shape to the row in edit mode.

3
  • I would try an HStack with the green button (possible an SFSymbol) and the text. Commented Jan 5, 2021 at 21:08
  • 1
    I looking for some default way like ".onDelete" Commented Jan 6, 2021 at 4:22
  • There is no default way for that, code your own. Commented Jan 6, 2021 at 5:08

1 Answer 1

4

This is a workaround but you can make the add row with the following code.

HStack {
            ZStack {
                Image(systemName: "circle.fill")
                    .foregroundColor(.white)
                    .padding(.leading, 0)
                    .font(.system(size: 18))
                Image(systemName: "plus.circle.fill")
                    .foregroundColor(.green)
                    .padding(.leading, 0)
                    .font(.system(size: 18))
            }
                        
            Text("add item")
                .padding(.leading, 8.0)
    } .onTapGesture(count: 1, perform: {
        addItem() // your add item code
    })
    .frame(height: 32.0)
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.