• Stars
    star
    330
  • Rank 127,657 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Drag and drop between your apps in split view mode on iOS 9

SplitViewDragAndDrop

Easily add drag and drop to pass data between your apps

Platform Swift 3 Cocoapods Compatible

Setup

  • Add pod 'SplitViewDragAndDrop' to your Podfile or copy the "SplitViewDragAndDrop" folder into your project
  • Make sure to call SplitViewDragAndDrop.configure(groupIdentifier: <YOUR-APP-GROUP-ID>) in application:didFinishLaunchingWithOptions:. Your apps must share that app group in order to communicate.
  • Configure the view you want to drag with SplitViewDragAndDrop.handleDrag(viewToDrag: <THE-DRAGGABLE-VIEW>, identifier: <AN-IDENTIFIER>, dataToTransfer: <SOME-DATA-TO-TRANSFER>) where
    • viewToDrag is a UIView and it will be snapshotted and dragged around
    • identifier is a string rappresenting an unique identifier.
    • dataToTransfer is a Data, it could be an image, a pdf ecc..
  • Configure the drop observer with
    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
    • targetView is a UIView and it will be the center of the dragged item when the user end the dragging and the validation succedded
    • identifier is a string rappresenting an unique identifier
    • draggingBegan is a closure that will be called when the drag is began
    • draggingValidation is a closure that will be called when the drag is ended. You have to return a value that indicate if the drag is valid or not. If that value is true, the dragged view will be moved to the center of the targetView, otherwise it will be moved back to it's original position.
    • completion is a closure that will be called after the validation.

Demo

In this repository you can also find a demo.

Info

If you like this git you can follow me here or on twitter :) @MarioIannotta

Cheers from Italy!

More Repositories

1

PullUpController

Pull up controller with multiple sticky points like in iOS Maps
Swift
1,243
star
2

MIBlurPopup

MIBlurPopup lets you create popups with a blurred background
Swift
605
star
3

ShyView

A UI component that avoids screenshots and recordings
Swift
194
star
4

SwizzleSwift

Swizzle selectors with just one clean and elegant API
Swift
155
star
5

LocalizedSwift

Localize UI Components in a simple and declarative way
Swift
137
star
6

LoadingPlaceholderView

Non-blocking animated gradient placeholder view for your async tasks.
Swift
132
star
7

SwiftyContextMenu

UIContextMenu backporting with Swifter API
Swift
123
star
8

MIPivotPageController

MIPivotPageController allows switching view controllers with an horizontal swipe
Swift
89
star
9

MIAlertController

A simple fully customizable alert controller
Swift
54
star
10

BlurView

Custom blur radius for your UIKit views
Swift
39
star
11

Sivire

Record videos of your simulators from the mac menu bar
JavaScript
10
star
12

QuickLookFramework

A quick look plugin to inspect Frameworks
Swift
9
star
13

SwiftAcknowledgements

Extract your SPM dependencies licenses and add them to the Settings.bundle of your app
Swift
8
star
14

Nomosi

Declarative plug and play network services for your iOS and MacOS apps
Swift
7
star
15

SivireSDK

Add gesture to your video recorded with Sivire
Swift
4
star
16

GitProjects

A Swift script to extract stats from multiple git repositories
Swift
4
star
17

MIPlotter

Draw your histograms quickly and easily.
Objective-C
3
star
18

MIJsonParser

Just like json_encode, simple convert your arrays in valid json string.
PHP
1
star
19

Postfix-expression-evaluator

A script to evaluate mathematical expression in postfix notation
Python
1
star
20

MarioIannotta

1
star