Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Created May 28, 2026 16:44
Show Gist options
  • Select an option

  • Save dillonhafer/760e93020a2a10d9c308bc5e50a8b60c to your computer and use it in GitHub Desktop.

Select an option

Save dillonhafer/760e93020a2a10d9c308bc5e50a8b60c to your computer and use it in GitHub Desktop.
A copy of Expo's ListForEachView.swift sans-onDelete
internal import ExpoModulesCore
import SwiftUI
final class ListForEachMoveView: Module {
func definition() -> ModuleDefinition {
Name("ListForEachMoveView")
View(ListForEachMoveSwiftUIView.self)
}
}
final class ListForEachMoveProps: ExpoSwiftUI.ViewProps {
var onMove = EventDispatcher()
}
struct ListForEachMoveSwiftUIView: ExpoSwiftUI.View {
@ObservedObject var props: ListForEachMoveProps
init(props: ListForEachMoveProps) {
self.props = props
}
var body: some View {
Children()
.onMove(perform: handleMove)
}
func handleMove(from sources: IndexSet, to destination: Int) {
let sourceIndices = Array(sources)
props.onMove(["sourceIndices": sourceIndices, "destination": destination])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment