Repository: LiorNn/DragDropCollectionView Branch: master Commit: 5d1d3ef8d82f Files: 20 Total size: 66.6 KB Directory structure: gitextract_dhodvlri/ ├── DragDropCollectionView.swift ├── README.md └── Sample Project/ ├── DragDrop/ │ ├── AppDelegate.swift │ ├── Base.lproj/ │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets/ │ │ └── AppIcon.appiconset/ │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift ├── DragDrop.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata/ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata/ │ │ ├── Lior.xcuserdatad/ │ │ │ └── UserInterfaceState.xcuserstate │ │ └── prog.xcuserdatad/ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata/ │ ├── Lior.xcuserdatad/ │ │ ├── xcdebugger/ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes/ │ │ ├── DragDrop.xcscheme │ │ └── xcschememanagement.plist │ └── prog.xcuserdatad/ │ ├── xcdebugger/ │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes/ │ └── xcschememanagement.plist └── DragDropTests/ ├── DragDropTests.swift └── Info.plist ================================================ FILE CONTENTS ================================================ ================================================ FILE: DragDropCollectionView.swift ================================================ // // DragDropCollectionView.swift // DragDrop // // Created by Lior Neu-ner on 2014/12/30. // Copyright (c) 2014 LiorN. All rights reserved. // 3rd test for git submodule //Just testing git subtree for the second time import UIKit @objc protocol DrapDropCollectionViewDelegate { func dragDropCollectionViewDidMoveCellFromInitialIndexPath(_ initialIndexPath: IndexPath, toNewIndexPath newIndexPath: IndexPath) @objc optional func dragDropCollectionViewDraggingDidBeginWithCellAtIndexPath(_ indexPath: IndexPath) @objc optional func dragDropCollectionViewDraggingDidEndForCellAtIndexPath(_ indexPath: IndexPath) } class DragDropCollectionView: UICollectionView, UIGestureRecognizerDelegate { weak var draggingDelegate: DrapDropCollectionViewDelegate? var longPressRecognizer: UILongPressGestureRecognizer = { let longPressRecognizer = UILongPressGestureRecognizer() longPressRecognizer.delaysTouchesBegan = false longPressRecognizer.cancelsTouchesInView = false longPressRecognizer.numberOfTouchesRequired = 1 longPressRecognizer.minimumPressDuration = 0.1 longPressRecognizer.allowableMovement = 10.0 return longPressRecognizer }() fileprivate var draggedCellIndexPath: IndexPath? var draggingView: UIView? fileprivate var touchOffsetFromCenterOfCell: CGPoint? var isWiggling = false fileprivate let pingInterval = 0.3 var isAutoScrolling = false override var intrinsicContentSize: CGSize { self.layoutIfNeeded() return CGSize(width: UIView.noIntrinsicMetric, height: self.contentSize.height) } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) commonInit() } override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) { super.init(frame: frame, collectionViewLayout: layout) commonInit() } fileprivate func commonInit() { longPressRecognizer.addTarget(self, action: #selector(DragDropCollectionView.handleLongPress(_:))) longPressRecognizer.isEnabled = false self.addGestureRecognizer(longPressRecognizer) } override func reloadData() { super.reloadData() self.invalidateIntrinsicContentSize() } @objc func handleLongPress(_ longPressRecognizer: UILongPressGestureRecognizer) { let touchLocation = longPressRecognizer.location(in: self) switch (longPressRecognizer.state) { case UIGestureRecognizerState.began: draggedCellIndexPath = self.indexPathForItem(at: touchLocation) if (draggedCellIndexPath != nil) { draggingDelegate?.dragDropCollectionViewDraggingDidBeginWithCellAtIndexPath?(draggedCellIndexPath!) let draggedCell = self.cellForItem(at: draggedCellIndexPath! as IndexPath) as UICollectionViewCell? draggingView = UIImageView(image: getRasterizedImageCopyOfCell(draggedCell!)) draggingView!.center = (draggedCell!.center) self.addSubview(draggingView!) draggedCell!.alpha = 0.0 touchOffsetFromCenterOfCell = CGPoint(x: draggedCell!.center.x - touchLocation.x, y: draggedCell!.center.y - touchLocation.y) UIView.animate(withDuration: 0.4, animations: { () -> Void in self.draggingView!.transform = CGAffineTransform(scaleX: 1.3, y: 1.3) self.draggingView!.alpha = 0.8 }) } case UIGestureRecognizerState.changed: if draggedCellIndexPath != nil { draggingView!.center = CGPoint(x: touchLocation.x + touchOffsetFromCenterOfCell!.x, y: touchLocation.y + touchOffsetFromCenterOfCell!.y) if !isAutoScrolling { dispatchOnMainQueueAfter(pingInterval, closure: { () -> () in let scroller = self.shouldAutoScroll(touchLocation) if (scroller.shouldScroll) { self.autoScroll(scroller.direction) self.isAutoScrolling = true } }) } dispatchOnMainQueueAfter(pingInterval, closure: { () -> () in let shouldSwapCellsTuple = self.shouldSwapCells(touchLocation) if shouldSwapCellsTuple.shouldSwap { self.swapDraggedCellWithCellAtIndexPath(shouldSwapCellsTuple.newIndexPath!) } }) } case UIGestureRecognizerState.ended: if draggedCellIndexPath != nil { draggingDelegate?.dragDropCollectionViewDraggingDidEndForCellAtIndexPath?(draggedCellIndexPath!) let draggedCell = self.cellForItem(at: draggedCellIndexPath! as IndexPath) UIView.animate(withDuration: 0.4, animations: { () -> Void in self.draggingView!.transform = CGAffineTransform.identity self.draggingView!.alpha = 1.0 if (draggedCell != nil) { self.draggingView!.center = draggedCell!.center } }, completion: { (finished) -> Void in self.draggingView!.removeFromSuperview() self.draggingView = nil draggedCell?.alpha = 1.0 self.draggedCellIndexPath = nil }) } default: () } } func enableDragging(_ enable: Bool) { if enable { longPressRecognizer.isEnabled = true } else { longPressRecognizer.isEnabled = false } } fileprivate func shouldSwapCells(_ previousTouchLocation: CGPoint) -> (shouldSwap: Bool, newIndexPath: IndexPath?) { var shouldSwap = false var newIndexPath: IndexPath? let currentTouchLocation = self.longPressRecognizer.location(in: self) if !Double(currentTouchLocation.x).isNaN && !Double(currentTouchLocation.y).isNaN { if distanceBetweenPoints(previousTouchLocation, secondPoint: currentTouchLocation) < CGFloat(20.0) { if let newIndexPathForCell = self.indexPathForItem(at: currentTouchLocation) { if newIndexPathForCell != self.draggedCellIndexPath! as IndexPath { shouldSwap = true newIndexPath = newIndexPathForCell } } } } return (shouldSwap, newIndexPath) } fileprivate func swapDraggedCellWithCellAtIndexPath(_ newIndexPath: IndexPath) { self.moveItem(at: self.draggedCellIndexPath! as IndexPath, to: newIndexPath as IndexPath) let draggedCell = self.cellForItem(at: newIndexPath as IndexPath)! draggedCell.alpha = 0 self.draggingDelegate?.dragDropCollectionViewDidMoveCellFromInitialIndexPath(self.draggedCellIndexPath!, toNewIndexPath: newIndexPath) self.draggedCellIndexPath = newIndexPath } } //AutoScroll extension DragDropCollectionView { enum AutoScrollDirection: Int { case invalid = 0 case towardsOrigin = 1 case awayFromOrigin = 2 } func autoScroll(_ direction: AutoScrollDirection) { let currentLongPressTouchLocation = self.longPressRecognizer.location(in: self) var increment: CGFloat var newContentOffset: CGPoint if (direction == AutoScrollDirection.towardsOrigin) { increment = -50.0 } else { increment = 50.0 } newContentOffset = CGPoint(x: self.contentOffset.x, y: self.contentOffset.y + increment) let flowLayout = self.collectionViewLayout as! UICollectionViewFlowLayout if flowLayout.scrollDirection == UICollectionView.ScrollDirection.horizontal{ newContentOffset = CGPoint(x: self.contentOffset.x + increment, y: self.contentOffset.y) } if ((direction == AutoScrollDirection.towardsOrigin && newContentOffset.y < 0) || (direction == AutoScrollDirection.awayFromOrigin && newContentOffset.y > self.contentSize.height - self.frame.height)) { dispatchOnMainQueueAfter(0.3, closure: { () -> () in self.isAutoScrolling = false }) } else { UIView.animate(withDuration: 0.3 , delay: 0.0 , options: UIView.AnimationOptions.curveLinear , animations: { () -> Void in self.setContentOffset(newContentOffset, animated: false) if (self.draggingView != nil) { if flowLayout.scrollDirection == UICollectionView.ScrollDirection.vertical{ var draggingFrame = self.draggingView!.frame draggingFrame.origin.y += increment self.draggingView!.frame = draggingFrame }else{ var draggingFrame = self.draggingView!.frame draggingFrame.origin.x += increment self.draggingView!.frame = draggingFrame } } }) { (finished) -> Void in dispatchOnMainQueueAfter(0.0, closure: { () -> () in var updatedTouchLocationWithNewOffset = CGPoint(x: currentLongPressTouchLocation.x, y: currentLongPressTouchLocation.y + increment) if flowLayout.scrollDirection == UICollectionView.ScrollDirection.horizontal{ updatedTouchLocationWithNewOffset = CGPoint(x: currentLongPressTouchLocation.x + increment, y: currentLongPressTouchLocation.y) } let scroller = self.shouldAutoScroll(updatedTouchLocationWithNewOffset) if scroller.shouldScroll { self.autoScroll(scroller.direction) } else { self.isAutoScrolling = false } }) } } } func shouldAutoScroll(_ previousTouchLocation: CGPoint) -> (shouldScroll: Bool, direction: AutoScrollDirection) { let previousTouchLocation = self.convert(previousTouchLocation, to: self.superview) let currentTouchLocation = self.longPressRecognizer.location(in: self.superview) if let flowLayout = self.collectionViewLayout as? UICollectionViewFlowLayout { if !Double(currentTouchLocation.x).isNaN && !Double(currentTouchLocation.y).isNaN { if distanceBetweenPoints(previousTouchLocation, secondPoint: currentTouchLocation) < CGFloat(20.0) { let scrollDirection = flowLayout.scrollDirection var scrollBoundsSize: CGSize let scrollBoundsLength: CGFloat = 50.0 var scrollRectAtEnd: CGRect switch scrollDirection { case UICollectionViewScrollDirection.horizontal: scrollBoundsSize = CGSize(width: scrollBoundsLength, height: self.frame.height) scrollRectAtEnd = CGRect(x: self.frame.origin.x + self.frame.width - scrollBoundsSize.width , y: self.frame.origin.y, width: scrollBoundsSize.width, height: self.frame.height) case UICollectionViewScrollDirection.vertical: scrollBoundsSize = CGSize(width: self.frame.width, height: scrollBoundsLength) scrollRectAtEnd = CGRect(x: self.frame.origin.x, y: self.frame.origin.y + self.frame.height - scrollBoundsSize.height, width: self.frame.width, height: scrollBoundsSize.height) } let scrollRectAtOrigin = CGRect(origin: self.frame.origin, size: scrollBoundsSize) if scrollRectAtOrigin.contains(currentTouchLocation) { return (true, AutoScrollDirection.towardsOrigin) } else if scrollRectAtEnd.contains(currentTouchLocation) { return (true, AutoScrollDirection.awayFromOrigin) } } } } return (false, AutoScrollDirection.invalid) } } //Wiggle Animation extension DragDropCollectionView { func startWiggle() { for cell in visibleCells { addWiggleAnimationTo(cell ) } isWiggling = true } func stopWiggle() { for cell in visibleCells { cell.layer.removeAllAnimations() } isWiggling = false } override func dequeueReusableCell(withReuseIdentifier identifier: String, for indexPath: IndexPath) -> UICollectionViewCell { let cell: AnyObject = super.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath as IndexPath) if isWiggling { addWiggleAnimationTo(cell as! UICollectionViewCell) } else { cell.layer.removeAllAnimations() } return cell as! UICollectionViewCell } func addWiggleAnimationTo(_ cell: UICollectionViewCell) { CATransaction.begin() CATransaction.setDisableActions(false) cell.layer.add(rotationAnimation(), forKey: "rotation") cell.layer.add(bounceAnimation(), forKey: "bounce") CATransaction.commit() } fileprivate func rotationAnimation() -> CAKeyframeAnimation { let animation = CAKeyframeAnimation(keyPath: "transform.rotation.z") let angle = CGFloat(0.04) let duration = TimeInterval(0.1) let variance = Double(0.025) animation.values = [angle, -angle] animation.autoreverses = true animation.duration = self.randomize(duration, withVariance: variance) animation.repeatCount = Float.infinity return animation } fileprivate func bounceAnimation() -> CAKeyframeAnimation { let animation = CAKeyframeAnimation(keyPath: "transform.translation.y") let bounce = CGFloat(3.0) let duration = TimeInterval(0.12) let variance = Double(0.025) animation.values = [bounce, -bounce] animation.autoreverses = true animation.duration = self.randomize(duration, withVariance: variance) animation.repeatCount = Float.infinity return animation } fileprivate func randomize(_ interval: TimeInterval, withVariance variance:Double) -> TimeInterval { let random = (Double(arc4random_uniform(1000)) - 500.0) / 500.0 return interval + variance * random; } } //Assisting Functions extension DragDropCollectionView { func getRasterizedImageCopyOfCell(_ cell: UICollectionViewCell) -> UIImage { UIGraphicsBeginImageContextWithOptions(cell.bounds.size, false, 0.0) cell.layer.render(in: UIGraphicsGetCurrentContext()!) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image! } } public func dispatchOnMainQueueAfter(_ delay:Double, closure:@escaping ()->Void) { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+delay, qos: DispatchQoS.userInteractive, flags: DispatchWorkItemFlags.enforceQoS, execute: closure) } public func distanceBetweenPoints(_ firstPoint: CGPoint, secondPoint: CGPoint) -> CGFloat { let xDistance = firstPoint.x - secondPoint.x let yDistance = firstPoint.y - secondPoint.y return sqrt(xDistance * xDistance + yDistance * yDistance) } ================================================ FILE: README.md ================================================ # DragDropCollectionView A UICollectionView which allows for easy drag and drop to reorder cells. Mimicks the drag and drop on the iOS Springboard when reordering apps (wiggle animation included!). I have also included automatic scrolling for when the collection view's content does not all fit in the frame ![Alt text](/demo.gif) Installation -------------- To use the DragDropCollectionView class in an app, just drag the DragDropCollectionView.swift file into your project. Protocols and Delegates -------------- DragDropCollectionView has the following protocol: ```` @objc protocol DrapDropCollectionViewDelegate: UICollectionViewDelegate ```` This inherits from UICollectionViewDelegate and is to be used in place of the '.delegate' property found in UICollectionView DragDropCollectionView has the following delegate: ```` weak var draggingDelegate: DrapDropCollectionViewDelegate? ```` The DragDropCollectionViewDelegate has the following required methods: ```` func dragDropCollectionViewDidMoveCellFromInitialIndexPath(initialIndexPath: NSIndexPath, toNewIndexPath newIndexPath: NSIndexPath) ```` This method should be used in your to 'swap' items in your datasource The DragDropCollectionViewDelegate has the following optional methods: ```` optional func dragDropCollectionViewDraggingDidBeginWithCellAtIndexPath(indexPath: NSIndexPath) optional func dragDropCollectionViewDraggingDidEndForCellAtIndexPath(indexPath: NSIndexPath) ```` Methods -------------- Dragging can be easily enabled and disabled using the follwing method: ```` func enableDragging(enable: Bool) ```` To start the wiggle animation, use: ```` func startWiggle() ```` To stop the wiggle animation, use: ```` func stopWiggle() ```` ================================================ FILE: Sample Project/DragDrop/AppDelegate.swift ================================================ // // AppDelegate.swift // DragDrop // // Created by Lior Neu-ner on 2014/12/30. // Copyright (c) 2014 LiorN. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } } ================================================ FILE: Sample Project/DragDrop/Base.lproj/LaunchScreen.xib ================================================ ================================================ FILE: Sample Project/DragDrop/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Sample Project/DragDrop/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Sample Project/DragDrop/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Sample Project/DragDrop/ViewController.swift ================================================ // // ViewController.swift // DragDrop // // Created by Lior Neu-ner on 2014/12/30. // Copyright (c) 2014 LiorN. All rights reserved. // import UIKit class ViewController: UIViewController, UICollectionViewDataSource, DrapDropCollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionViewCell", for: indexPath as IndexPath) as UICollectionViewCell cell.backgroundColor = colors[indexPath.row] return cell } func dragDropCollectionViewDidMoveCellFromInitialIndexPath(_ initialIndexPath: IndexPath, toNewIndexPath newIndexPath: IndexPath) { let colorToMove = colors[initialIndexPath.row] colors.remove(at: initialIndexPath.row) colors.insert(colorToMove, at: newIndexPath.row) } @IBOutlet var dragDropCollectionView: DragDropCollectionView! var colors: [UIColor] = { var randomColors = [UIColor]() for i in 1...500 { let randomRed = CGFloat(arc4random() % 255) / 255.0 let randomGreen = CGFloat(arc4random() % 255) / 255.0 let randomBlue = CGFloat(arc4random() % 255) / 255.0 randomColors.append(UIColor(red: randomRed, green: randomGreen, blue: randomBlue, alpha: 1.0)) } return randomColors }() override func viewDidLoad() { super.viewDidLoad() dragDropCollectionView.draggingDelegate = self dragDropCollectionView.enableDragging(true) } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return colors.count } @IBAction func toggleWiggle(sender: UISwitch) { if sender.isOn { dragDropCollectionView.startWiggle() } else { dragDropCollectionView.stopWiggle() } } } ================================================ FILE: Sample Project/DragDrop.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ BA18A7C21A649C8D0044B197 /* DragDropCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA18A7C11A649C8D0044B197 /* DragDropCollectionView.swift */; }; BA6E6D401A529CAE0005985D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6E6D3F1A529CAE0005985D /* AppDelegate.swift */; }; BA6E6D421A529CAF0005985D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6E6D411A529CAF0005985D /* ViewController.swift */; }; BA6E6D451A529CAF0005985D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA6E6D431A529CAF0005985D /* Main.storyboard */; }; BA6E6D471A529CB00005985D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA6E6D461A529CB00005985D /* Images.xcassets */; }; BA6E6D4A1A529CB00005985D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BA6E6D481A529CB00005985D /* LaunchScreen.xib */; }; BA6E6D561A529CB20005985D /* DragDropTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6E6D551A529CB20005985D /* DragDropTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ BA6E6D501A529CB10005985D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BA6E6D321A529CAC0005985D /* Project object */; proxyType = 1; remoteGlobalIDString = BA6E6D391A529CAD0005985D; remoteInfo = DragDrop; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ BA18A7C11A649C8D0044B197 /* DragDropCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DragDropCollectionView.swift; path = ../../DragDropCollectionView.swift; sourceTree = ""; }; BA6E6D3A1A529CAD0005985D /* DragDrop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DragDrop.app; sourceTree = BUILT_PRODUCTS_DIR; }; BA6E6D3E1A529CAD0005985D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BA6E6D3F1A529CAE0005985D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; BA6E6D411A529CAF0005985D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; BA6E6D441A529CAF0005985D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; BA6E6D461A529CB00005985D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; BA6E6D491A529CB00005985D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; BA6E6D4F1A529CB10005985D /* DragDropTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DragDropTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; BA6E6D541A529CB10005985D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BA6E6D551A529CB20005985D /* DragDropTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragDropTests.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ BA6E6D371A529CAD0005985D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; BA6E6D4C1A529CB10005985D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ BA6E6D311A529CAC0005985D = { isa = PBXGroup; children = ( BA6E6D3C1A529CAD0005985D /* DragDrop */, BA6E6D521A529CB10005985D /* DragDropTests */, BA6E6D3B1A529CAD0005985D /* Products */, ); sourceTree = ""; }; BA6E6D3B1A529CAD0005985D /* Products */ = { isa = PBXGroup; children = ( BA6E6D3A1A529CAD0005985D /* DragDrop.app */, BA6E6D4F1A529CB10005985D /* DragDropTests.xctest */, ); name = Products; sourceTree = ""; }; BA6E6D3C1A529CAD0005985D /* DragDrop */ = { isa = PBXGroup; children = ( BA6E6D3F1A529CAE0005985D /* AppDelegate.swift */, BA6E6D411A529CAF0005985D /* ViewController.swift */, BA18A7C11A649C8D0044B197 /* DragDropCollectionView.swift */, BA6E6D431A529CAF0005985D /* Main.storyboard */, BA6E6D461A529CB00005985D /* Images.xcassets */, BA6E6D481A529CB00005985D /* LaunchScreen.xib */, BA6E6D3D1A529CAD0005985D /* Supporting Files */, ); path = DragDrop; sourceTree = ""; }; BA6E6D3D1A529CAD0005985D /* Supporting Files */ = { isa = PBXGroup; children = ( BA6E6D3E1A529CAD0005985D /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; BA6E6D521A529CB10005985D /* DragDropTests */ = { isa = PBXGroup; children = ( BA6E6D551A529CB20005985D /* DragDropTests.swift */, BA6E6D531A529CB10005985D /* Supporting Files */, ); path = DragDropTests; sourceTree = ""; }; BA6E6D531A529CB10005985D /* Supporting Files */ = { isa = PBXGroup; children = ( BA6E6D541A529CB10005985D /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ BA6E6D391A529CAD0005985D /* DragDrop */ = { isa = PBXNativeTarget; buildConfigurationList = BA6E6D591A529CB20005985D /* Build configuration list for PBXNativeTarget "DragDrop" */; buildPhases = ( BA6E6D361A529CAD0005985D /* Sources */, BA6E6D371A529CAD0005985D /* Frameworks */, BA6E6D381A529CAD0005985D /* Resources */, ); buildRules = ( ); dependencies = ( ); name = DragDrop; productName = DragDrop; productReference = BA6E6D3A1A529CAD0005985D /* DragDrop.app */; productType = "com.apple.product-type.application"; }; BA6E6D4E1A529CB10005985D /* DragDropTests */ = { isa = PBXNativeTarget; buildConfigurationList = BA6E6D5C1A529CB20005985D /* Build configuration list for PBXNativeTarget "DragDropTests" */; buildPhases = ( BA6E6D4B1A529CB10005985D /* Sources */, BA6E6D4C1A529CB10005985D /* Frameworks */, BA6E6D4D1A529CB10005985D /* Resources */, ); buildRules = ( ); dependencies = ( BA6E6D511A529CB10005985D /* PBXTargetDependency */, ); name = DragDropTests; productName = DragDropTests; productReference = BA6E6D4F1A529CB10005985D /* DragDropTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ BA6E6D321A529CAC0005985D /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1020; ORGANIZATIONNAME = LiorN; TargetAttributes = { BA6E6D391A529CAD0005985D = { CreatedOnToolsVersion = 6.1.1; DevelopmentTeam = AS8F5Z84GP; }; BA6E6D4E1A529CB10005985D = { CreatedOnToolsVersion = 6.1.1; TestTargetID = BA6E6D391A529CAD0005985D; }; }; }; buildConfigurationList = BA6E6D351A529CAC0005985D /* Build configuration list for PBXProject "DragDrop" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( English, en, Base, ); mainGroup = BA6E6D311A529CAC0005985D; productRefGroup = BA6E6D3B1A529CAD0005985D /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( BA6E6D391A529CAD0005985D /* DragDrop */, BA6E6D4E1A529CB10005985D /* DragDropTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ BA6E6D381A529CAD0005985D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( BA6E6D451A529CAF0005985D /* Main.storyboard in Resources */, BA6E6D4A1A529CB00005985D /* LaunchScreen.xib in Resources */, BA6E6D471A529CB00005985D /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; BA6E6D4D1A529CB10005985D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ BA6E6D361A529CAD0005985D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( BA6E6D421A529CAF0005985D /* ViewController.swift in Sources */, BA18A7C21A649C8D0044B197 /* DragDropCollectionView.swift in Sources */, BA6E6D401A529CAE0005985D /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; BA6E6D4B1A529CB10005985D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( BA6E6D561A529CB20005985D /* DragDropTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ BA6E6D511A529CB10005985D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = BA6E6D391A529CAD0005985D /* DragDrop */; targetProxy = BA6E6D501A529CB10005985D /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ BA6E6D431A529CAF0005985D /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( BA6E6D441A529CAF0005985D /* Base */, ); name = Main.storyboard; sourceTree = ""; }; BA6E6D481A529CB00005985D /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( BA6E6D491A529CB00005985D /* Base */, ); name = LaunchScreen.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ BA6E6D571A529CB20005985D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; BA6E6D581A529CB20005985D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; BA6E6D5A1A529CB20005985D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = DragDrop/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "LiorN.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_VERSION = 5.0; }; name = Debug; }; BA6E6D5B1A529CB20005985D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = DragDrop/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "LiorN.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_VERSION = 5.0; }; name = Release; }; BA6E6D5D1A529CB20005985D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = DragDropTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "LiorN.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DragDrop.app/DragDrop"; }; name = Debug; }; BA6E6D5E1A529CB20005985D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); INFOPLIST_FILE = DragDropTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "LiorN.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DragDrop.app/DragDrop"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ BA6E6D351A529CAC0005985D /* Build configuration list for PBXProject "DragDrop" */ = { isa = XCConfigurationList; buildConfigurations = ( BA6E6D571A529CB20005985D /* Debug */, BA6E6D581A529CB20005985D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; BA6E6D591A529CB20005985D /* Build configuration list for PBXNativeTarget "DragDrop" */ = { isa = XCConfigurationList; buildConfigurations = ( BA6E6D5A1A529CB20005985D /* Debug */, BA6E6D5B1A529CB20005985D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; BA6E6D5C1A529CB20005985D /* Build configuration list for PBXNativeTarget "DragDropTests" */ = { isa = XCConfigurationList; buildConfigurations = ( BA6E6D5D1A529CB20005985D /* Debug */, BA6E6D5E1A529CB20005985D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = BA6E6D321A529CAC0005985D /* Project object */; } ================================================ FILE: Sample Project/DragDrop.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Sample Project/DragDrop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: Sample Project/DragDrop.xcodeproj/xcuserdata/Lior.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: Sample Project/DragDrop.xcodeproj/xcuserdata/Lior.xcuserdatad/xcschemes/DragDrop.xcscheme ================================================ ================================================ FILE: Sample Project/DragDrop.xcodeproj/xcuserdata/Lior.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState DragDrop.xcscheme orderHint 0 SuppressBuildableAutocreation BA6E6D391A529CAD0005985D primary BA6E6D4E1A529CB10005985D primary ================================================ FILE: Sample Project/DragDrop.xcodeproj/xcuserdata/prog.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: Sample Project/DragDrop.xcodeproj/xcuserdata/prog.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState DragDrop.xcscheme_^#shared#^_ orderHint 0 ================================================ FILE: Sample Project/DragDropTests/DragDropTests.swift ================================================ // // DragDropTests.swift // DragDropTests // // Created by Lior Neu-ner on 2014/12/30. // Copyright (c) 2014 LiorN. All rights reserved. // import UIKit import XCTest class DragDropTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. XCTAssert(true, "Pass") } func testPerformanceExample() { // This is an example of a performance test case. self.measureBlock() { // Put the code you want to measure the time of here. } } } ================================================ FILE: Sample Project/DragDropTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1