delete green (+) icon when onInsert

I use .onInsert now.

I want to delete green (+) icon that displayed by default.

Is it possible?

Answered by taisei_hikawa in 693567022

I couldn't figure out how to change it with onInsert, but I did find out that DropProposal is involved. By implementing it with onDrop, I was able to successfully turn it off.

Can you show a complete code example and a sample image showing the green (+) icon?

example code

struct ContentView: View {
  @State private var dragging: Ramen?
  @State private var ramens = [Ramen(name: "ramen", id: 0),
         Ramen(name: "ramen2", id: 1),
         Ramen(name: "ramen3", id: 2)]

  var body: some View {
    List {
      ForEach(ramens) { ramen in
        Image(ramen.name)
          .onDrag {
            self.dragging = ramen
            return NSItemProvider(object: String(ramen.id) as NSString)
          }
      }
      .onInsert(of: [.text], perform: insert)
    }
  }

  private func insert(index: Int, _: [NSItemProvider]) {
    ...
  }
}

when dragging

Accepted Answer

I couldn't figure out how to change it with onInsert, but I did find out that DropProposal is involved. By implementing it with onDrop, I was able to successfully turn it off.

delete green (+) icon when onInsert
 
 
Q