TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jun 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Mario Iannotta.
Easily add drag and drop to pass data between your apps
SplitViewDragAndDrop.configure(groupIdentifier: <YOUR-APP-GROUP-ID>)
in application:didFinishLaunchingWithOptions:
. Your apps must share that app group in order to communicate.SplitViewDragAndDrop.handleDrag(viewToDrag: <THE-DRAGGABLE-VIEW>, identifier: <AN-IDENTIFIER>, dataToTransfer: <SOME-DATA-TO-TRANSFER>)
where SplitViewDragAndDrop.addDropObserver(
targetView: <A-TARGET-VIEW>,
identifier: <AN-IDENTIFIER>,
draggingBegan: { frame, draggedViewSnapshotImage, dataTransfered in
// the drag is began, here you can perform some ui changes in order to tell the user where to drag the item
},
draggingValidation: { frame, draggedViewSnapshotImage, dataTransfered in
return <A-BOOL>
},
completion: { frame, draggedViewSnapshotImage, dataTransfered, isValid in
// the drag is complete and you can use dataTrasfered if you want
}
)
where
In this repository you can also find a demo.
If you like this git you can follow me here or on twitter :) @MarioIannotta
Cheers from Italy!