Categories
Development Devices iPhone

LongPress on List does re-order on iPad, but how to reorder on iPhone

With the following code, reordering the list works when long pressing,
but only on iPad, on iPhone the long press does nothing. how can I make it work on iPhone too?

var body: some View {
        NavigationView {
            List {
                ForEach(objects, id: \.firstName) { object in
                    Text("\(object.firstName) \(object.lastName)")
                }
                .onMove(perform: move)
            }
        }
    }

    func move(from source: IndexSet, to destination: Int) {
        objects.move(fromOffsets: source, toOffset: destination)
    }

Leave a Reply

Your email address will not be published. Required fields are marked *