You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, love the project, making supporting iOS 13 SwiftUI much more enjoyable.
I realise documentation is currently behind the code base, so figured I should ask here.
Is it possible to enable drag and drop recording in the CollectionView? I have been playing around with the API but struggling to find a way to do it (API seems to imply its possible).
My current code
classDropDelegate:CollectionViewDropDelegate{func performDrop(info:CollectionViewDropInfo)->Bool{print("performDrop")return true
}func validateDrop(info:CollectionViewDropInfo)->Bool{print("validateDrop")return true
}func dropUpdated(info:CollectionViewDropInfo)->DropProposal?{print("dropUpdated")returnnil}}classItem:Identifiable{letid=UUID()lettext:Stringinit(_ text:String){self.text = text
}}structCollectionExampleView:View{@Statevardata:[Item]=(1...10).map({Item("Item #\($0)")})letdragDrop=DropDelegate()varbody:someView{CollectionView(data, id: \.id){ element inText(element.text).padding().maxWidth(100).background(RoundedRectangle(cornerRadius:12).fill(Color.gray))}.onDrop(delegate: dragDrop).isDragActive(.constant(true))// played around with .dragItems too but no luck}}
Happy to contribute to some documentation once I figure it out.
The text was updated successfully, but these errors were encountered:
var body: some View {
CollectionView(data, id: \.id) { element in
Text(element.text)
.padding()
.minWidth(160)
.background(RoundedRectangle(cornerRadius: 12).fill(Color.gray))
}
.onMove { from, to in
data.move(fromOffsets: from, toOffset: to)
}
}
Hey there,
Firstly, love the project, making supporting iOS 13 SwiftUI much more enjoyable.
I realise documentation is currently behind the code base, so figured I should ask here.
Is it possible to enable drag and drop recording in the CollectionView? I have been playing around with the API but struggling to find a way to do it (API seems to imply its possible).
My current code
Happy to contribute to some documentation once I figure it out.
The text was updated successfully, but these errors were encountered: