From 74e1b139fb8ad66688a6c53e9be4e4d9218f18a0 Mon Sep 17 00:00:00 2001 From: Ben Ashman Date: Mon, 7 Dec 2015 20:25:20 -0800 Subject: [PATCH 01/16] the calm before the merge --- Camera.xcodeproj/project.pbxproj | 6 +++--- Camera/FileManagment.swift | 7 +++++++ Camera/ListViewViewController.swift | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Camera.xcodeproj/project.pbxproj b/Camera.xcodeproj/project.pbxproj index 564746e..cc8aaa8 100644 --- a/Camera.xcodeproj/project.pbxproj +++ b/Camera.xcodeproj/project.pbxproj @@ -177,7 +177,7 @@ TargetAttributes = { C21477BA1BEE9FE7001474A4 = { CreatedOnToolsVersion = 7.1; - DevelopmentTeam = 7JJG8MJLCH; + DevelopmentTeam = FG8F72SY67; }; }; }; @@ -401,7 +401,7 @@ INFOPLIST_FILE = Camera/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = andytaylor.Camera; + PRODUCT_BUNDLE_IDENTIFIER = benashman.Camera; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; }; @@ -417,7 +417,7 @@ INFOPLIST_FILE = Camera/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = andytaylor.Camera; + PRODUCT_BUNDLE_IDENTIFIER = benashman.Camera; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; }; diff --git a/Camera/FileManagment.swift b/Camera/FileManagment.swift index ba02c1d..045c9a1 100644 --- a/Camera/FileManagment.swift +++ b/Camera/FileManagment.swift @@ -33,6 +33,13 @@ func deleteSingleClip(clip: Clip) { } } +func deleteSingleClipAtIndex(index: Int) { + print("deleting clip at index \(index)") + + let clips = returnContentsOfClipsDirectory() + print(clips) +} + func deleteAllClips() { let clips = returnContentsOfClipsDirectory() diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index b8d2787..a2e5f59 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -155,11 +155,28 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo players.append(player) playerLayers.append(playerLayer) + /// + + let deleteAction = Selector("deleteCell:") + let deleteGesture = UISwipeGestureRecognizer(target: self, action: deleteAction) + deleteGesture.direction = .Up + cell.addGestureRecognizer(deleteGesture) + + /// + NSNotificationCenter.defaultCenter().addObserver(self, selector: "playerDidReachEndNotificationHandler:", name: "AVPlayerItemDidPlayToEndTimeNotification", object: player!.currentItem) return cell } + func deleteCell(sender: UISwipeGestureRecognizer) { + print("delete cell") + let cell = sender.view as! UICollectionViewCell + let index = self.clipCollection.indexPathForCell(cell)!.item + deleteSingleClipAtIndex(index) + + } + func playerDidReachEndNotificationHandler(notification: NSNotification) { let playerItem = notification.object as! AVPlayerItem playerItem.seekToTime(kCMTimeZero) From 40da73d4640a4a95e7e0ee8b390bc5ddef2514e2 Mon Sep 17 00:00:00 2001 From: Ben Ashman Date: Mon, 7 Dec 2015 20:52:40 -0800 Subject: [PATCH 02/16] deleting clip --- Camera/FileManagment.swift | 11 +++++++++-- Camera/ListViewViewController.swift | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Camera/FileManagment.swift b/Camera/FileManagment.swift index 045c9a1..ab0d2d5 100644 --- a/Camera/FileManagment.swift +++ b/Camera/FileManagment.swift @@ -36,8 +36,15 @@ func deleteSingleClip(clip: Clip) { func deleteSingleClipAtIndex(index: Int) { print("deleting clip at index \(index)") - let clips = returnContentsOfClipsDirectory() - print(clips) + let realm = try! Realm() + let clips = realm.objects(Clip).sorted("filename", ascending: true) + + let clip = clips[index] + deleteClip(clip.filename) + + try! realm.write { + realm.delete(clip) + } } func deleteAllClips() { diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index b7e5123..8030dd5 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -185,7 +185,9 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let cell = sender.view as! UICollectionViewCell let index = self.clipCollection.indexPathForCell(cell)!.item deleteSingleClipAtIndex(index) - + updateTableView() + } + func scrollViewDidScroll(scrollView: UIScrollView) { // let visibleRect: CGRect = CGRect(origin: self.clipCollection.contentOffset, size: self.clipCollection.bounds.size) // let visiblePoint: CGPoint = CGPointMake(CGRectGetMidX(visibleRect), CGRectGetMidY(visibleRect)) From 709574c626d688381fa6c50b8cf9a3d867f36330 Mon Sep 17 00:00:00 2001 From: Ben Ashman Date: Mon, 7 Dec 2015 21:15:00 -0800 Subject: [PATCH 03/16] delete gesture WIP --- Camera/Base.lproj/Main.storyboard | 120 ++++++++++++++-------------- Camera/ListViewViewController.swift | 33 ++++++-- 2 files changed, 85 insertions(+), 68 deletions(-) diff --git a/Camera/Base.lproj/Main.storyboard b/Camera/Base.lproj/Main.storyboard index e022fc8..48da502 100644 --- a/Camera/Base.lproj/Main.storyboard +++ b/Camera/Base.lproj/Main.storyboard @@ -250,6 +250,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 8030dd5..075387f 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -39,6 +39,8 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo var loadingIndicator: UIActivityIndicatorView! var blurView: UIVisualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Dark)) + var clipViewDefaultOrigin: CGPoint! + override func preferredStatusBarStyle() -> UIStatusBarStyle { return .LightContent } @@ -169,8 +171,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo /// let deleteAction = Selector("deleteCell:") - let deleteGesture = UISwipeGestureRecognizer(target: self, action: deleteAction) - deleteGesture.direction = .Up + let deleteGesture = UIPanGestureRecognizer(target: self, action: deleteAction) cell.addGestureRecognizer(deleteGesture) /// @@ -180,12 +181,28 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo return cell } - func deleteCell(sender: UISwipeGestureRecognizer) { - print("delete cell") - let cell = sender.view as! UICollectionViewCell - let index = self.clipCollection.indexPathForCell(cell)!.item - deleteSingleClipAtIndex(index) - updateTableView() + func deleteCell(sender: UIPanGestureRecognizer) { + let translation = sender.translationInView(view) + let velocity = sender.velocityInView(view) + let clipView = sender.view + + if sender.state == .Began { + clipViewDefaultOrigin = sender.view!.frame.origin + } else if sender.state == .Changed { + clipView?.transform = CGAffineTransformMakeTranslation(0, translation.y) + } else if sender.state == .Ended { + if velocity.y < 0 { + print("delete clip") + } else { + clipView!.frame.origin = clipViewDefaultOrigin + } + } + +// print("delete cell") +// let cell = sender.view as! UICollectionViewCell +// let index = self.clipCollection.indexPathForCell(cell)!.item +// deleteSingleClipAtIndex(index) +// updateTableView() } func scrollViewDidScroll(scrollView: UIScrollView) { From 7d38bd809b2b6dbbdd8d7b918e967a6799decbc8 Mon Sep 17 00:00:00 2001 From: Ben Ashman Date: Tue, 8 Dec 2015 09:18:41 -0800 Subject: [PATCH 04/16] buggy as shit --- Camera/ListViewViewController.swift | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 075387f..e95ff5f 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -185,24 +185,32 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let translation = sender.translationInView(view) let velocity = sender.velocityInView(view) let clipView = sender.view + let deleteThreshold = CGFloat(-180) if sender.state == .Began { clipViewDefaultOrigin = sender.view!.frame.origin } else if sender.state == .Changed { clipView?.transform = CGAffineTransformMakeTranslation(0, translation.y) + print(translation.y) + if translation.y < deleteThreshold { + print("passed delete threshold") + } } else if sender.state == .Ended { - if velocity.y < 0 { - print("delete clip") + if translation.y < deleteThreshold { + UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { + sender.view?.transform = CGAffineTransformMakeTranslation(0, -1000) // TODO: Make end value relative + }, completion: { Bool -> Void in + print("deleting cell") + let cell = sender.view as! UICollectionViewCell + let index = self.clipCollection.indexPathForCell(cell)!.item + deleteSingleClipAtIndex(index) + } + ) + print("deleting clip") } else { - clipView!.frame.origin = clipViewDefaultOrigin + print("cancel deletion") } } - -// print("delete cell") -// let cell = sender.view as! UICollectionViewCell -// let index = self.clipCollection.indexPathForCell(cell)!.item -// deleteSingleClipAtIndex(index) -// updateTableView() } func scrollViewDidScroll(scrollView: UIScrollView) { From cc2b60684becb5340fca88133276718847c28ef0 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 18:20:26 +1100 Subject: [PATCH 05/16] Cancelling animates the clip back to the original position. --- Camera.xcodeproj/project.pbxproj | 6 +++--- Camera/ListViewViewController.swift | 32 +++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Camera.xcodeproj/project.pbxproj b/Camera.xcodeproj/project.pbxproj index cc8aaa8..564746e 100644 --- a/Camera.xcodeproj/project.pbxproj +++ b/Camera.xcodeproj/project.pbxproj @@ -177,7 +177,7 @@ TargetAttributes = { C21477BA1BEE9FE7001474A4 = { CreatedOnToolsVersion = 7.1; - DevelopmentTeam = FG8F72SY67; + DevelopmentTeam = 7JJG8MJLCH; }; }; }; @@ -401,7 +401,7 @@ INFOPLIST_FILE = Camera/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = benashman.Camera; + PRODUCT_BUNDLE_IDENTIFIER = andytaylor.Camera; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; }; @@ -417,7 +417,7 @@ INFOPLIST_FILE = Camera/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = benashman.Camera; + PRODUCT_BUNDLE_IDENTIFIER = andytaylor.Camera; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; }; diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index ba71f37..4dac553 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -189,26 +189,42 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo if sender.state == .Began { clipViewDefaultOrigin = sender.view!.frame.origin - } else if sender.state == .Changed { + } + + if sender.state == .Changed { clipView?.transform = CGAffineTransformMakeTranslation(0, translation.y) print(translation.y) if translation.y < deleteThreshold { print("passed delete threshold") } - } else if sender.state == .Ended { + } + + if sender.state == .Ended { if translation.y < deleteThreshold { - UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { - sender.view?.transform = CGAffineTransformMakeTranslation(0, -1000) // TODO: Make end value relative - }, completion: { Bool -> Void in + + UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in + + sender.view?.transform = CGAffineTransformMakeTranslation(0, -1000) // TODO: Make end value relative + + }, completion: { (Bool) -> Void in + print("deleting cell") let cell = sender.view as! UICollectionViewCell let index = self.clipCollection.indexPathForCell(cell)!.item deleteSingleClipAtIndex(index) - } - ) + }) + print("deleting clip") + } else { - print("cancel deletion") + + UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in + + print("cancel deletion") + clipView?.transform = CGAffineTransformIdentity + + }, completion: { (Bool) -> Void in + }) } } } From c29e9910efa6024231cc49d02953c0b1243e15be Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 18:35:04 +1100 Subject: [PATCH 06/16] This isn't really working --- Camera/ListViewViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 4dac553..fce8c31 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -189,6 +189,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo if sender.state == .Began { clipViewDefaultOrigin = sender.view!.frame.origin + clipView!.transform = CGAffineTransformMakeTranslation(0, 0) } if sender.state == .Changed { @@ -197,6 +198,10 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo if translation.y < deleteThreshold { print("passed delete threshold") } + + if translation.y >= 20 { + clipView!.transform = CGAffineTransformTranslate(clipView!.transform, 0, 50) + } } if sender.state == .Ended { @@ -204,7 +209,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in - sender.view?.transform = CGAffineTransformMakeTranslation(0, -1000) // TODO: Make end value relative + clipView!.transform = CGAffineTransformTranslate(clipView!.transform, 0, -1000) // TODO: Make end value relative }, completion: { (Bool) -> Void in From 9f4104f5964d23ea22d87ce98c29b8e0cf4f9e08 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:05:03 +1100 Subject: [PATCH 07/16] Use straight up frame.origin.y instead of transforms. --- Camera/ListViewViewController.swift | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index fce8c31..649f853 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -39,7 +39,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo var loadingIndicator: UIActivityIndicatorView! var blurView: UIVisualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Dark)) - var clipViewDefaultOrigin: CGPoint! + var clipOriginalY: CGFloat! override func preferredStatusBarStyle() -> UIStatusBarStyle { return .LightContent @@ -67,6 +67,8 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo clipCollection.dataSource = self clipCollection.delegate = self + clipOriginalY = (view.frame.size.height - 400) / 2 + updateTableView() } @@ -185,23 +187,23 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let translation = sender.translationInView(view) let velocity = sender.velocityInView(view) let clipView = sender.view - let deleteThreshold = CGFloat(-180) + let deleteThreshold: CGFloat = -180 + + print(clipOriginalY) if sender.state == .Began { - clipViewDefaultOrigin = sender.view!.frame.origin - clipView!.transform = CGAffineTransformMakeTranslation(0, 0) +// clipViewDefaultOrigin = sender.view!.frame.origin } if sender.state == .Changed { - clipView?.transform = CGAffineTransformMakeTranslation(0, translation.y) + + clipView!.frame.origin.y = clipOriginalY + translation.y + print(translation.y) + if translation.y < deleteThreshold { print("passed delete threshold") } - - if translation.y >= 20 { - clipView!.transform = CGAffineTransformTranslate(clipView!.transform, 0, 50) - } } if sender.state == .Ended { @@ -226,7 +228,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in print("cancel deletion") - clipView?.transform = CGAffineTransformIdentity + clipView?.frame.origin.y = self.clipOriginalY }, completion: { (Bool) -> Void in }) From 4ad8beb676c13b23f522af73bcc1980a044ce66a Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:05:23 +1100 Subject: [PATCH 08/16] Add tension to the down swipe to indicate it doesn't do anything. --- Camera/ListViewViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 649f853..282ac28 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -204,6 +204,10 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo if translation.y < deleteThreshold { print("passed delete threshold") } + + if translation.y > 0 { + clipView!.frame.origin.y = clipOriginalY + (translation.y / 7) + } } if sender.state == .Ended { From 2692485f15c2e2380ebb5be358fb5a3f16956844 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:06:54 +1100 Subject: [PATCH 09/16] Add comment to my shitty code --- Camera/ListViewViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 282ac28..7495d3b 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -67,6 +67,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo clipCollection.dataSource = self clipCollection.delegate = self + // 400 below is clip height. Pretty crappy code but works for the moment. clipOriginalY = (view.frame.size.height - 400) / 2 updateTableView() From d28a63c96d1f3ce4d179c69ce50acac3c522262a Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:17:55 +1100 Subject: [PATCH 10/16] Stuff --- Camera/ListViewViewController.swift | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 7495d3b..a114f5c 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -188,9 +188,6 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let translation = sender.translationInView(view) let velocity = sender.velocityInView(view) let clipView = sender.view - let deleteThreshold: CGFloat = -180 - - print(clipOriginalY) if sender.state == .Began { // clipViewDefaultOrigin = sender.view!.frame.origin @@ -202,21 +199,20 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo print(translation.y) - if translation.y < deleteThreshold { - print("passed delete threshold") - } - if translation.y > 0 { clipView!.frame.origin.y = clipOriginalY + (translation.y / 7) } } if sender.state == .Ended { - if translation.y < deleteThreshold { + + print(velocity.y) + + if velocity.y < -350 || translation.y < -350 { - UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in + UIView.animateWithDuration(0.6, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in - clipView!.transform = CGAffineTransformTranslate(clipView!.transform, 0, -1000) // TODO: Make end value relative + clipView!.frame.origin.y = 0 - self.view.frame.height }, completion: { (Bool) -> Void in From 05529450c8b8ce0a970cc9c35220674058fe1402 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:31:07 +1100 Subject: [PATCH 11/16] Reloads the collection view so they actually go away. And other random stuff. --- Camera/ListViewViewController.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index a114f5c..e77325f 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -165,7 +165,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo // player!.play() // } - player!.play() +// player!.play() player!.muted = true players.append(player) @@ -190,9 +190,13 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let clipView = sender.view if sender.state == .Began { -// clipViewDefaultOrigin = sender.view!.frame.origin + } +// if velocity.x != 0 { +// velocity.x = 0 +// } + if sender.state == .Changed { clipView!.frame.origin.y = clipOriginalY + translation.y @@ -208,7 +212,8 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo print(velocity.y) - if velocity.y < -350 || translation.y < -350 { +// if velocity.y < -350 || translation.y < -350 { + if translation.y < -350 { UIView.animateWithDuration(0.6, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 10, options: [], animations: { () -> Void in @@ -220,6 +225,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let cell = sender.view as! UICollectionViewCell let index = self.clipCollection.indexPathForCell(cell)!.item deleteSingleClipAtIndex(index) + self.clipCollection.reloadData() }) print("deleting clip") From a5cdca2382e65545dcd0391688dfbd14a16cdb8b Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:32:46 +1100 Subject: [PATCH 12/16] Get rid of that nasty ass code --- Camera/ListViewViewController.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index e77325f..04ee9da 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -67,9 +67,6 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo clipCollection.dataSource = self clipCollection.delegate = self - // 400 below is clip height. Pretty crappy code but works for the moment. - clipOriginalY = (view.frame.size.height - 400) / 2 - updateTableView() } @@ -190,7 +187,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo let clipView = sender.view if sender.state == .Began { - + clipOriginalY = clipView!.frame.origin.y } // if velocity.x != 0 { From 96823c7d1669b8b63d612dc08b8dee00e3368b02 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:37:35 +1100 Subject: [PATCH 13/16] reduce derp --- Camera/ListViewViewController.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Camera/ListViewViewController.swift b/Camera/ListViewViewController.swift index 04ee9da..e1eda63 100644 --- a/Camera/ListViewViewController.swift +++ b/Camera/ListViewViewController.swift @@ -162,7 +162,7 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo // player!.play() // } -// player!.play() + player!.play() player!.muted = true players.append(player) @@ -190,10 +190,6 @@ class ListViewViewController: UIViewController, UICollectionViewDataSource, UICo clipOriginalY = clipView!.frame.origin.y } -// if velocity.x != 0 { -// velocity.x = 0 -// } - if sender.state == .Changed { clipView!.frame.origin.y = clipOriginalY + translation.y From 80f000c89f370d8da4efcdb89d43af107a5b559b Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 14 Dec 2015 19:44:19 +1100 Subject: [PATCH 14/16] Remove delete label. --- Camera/Base.lproj/Main.storyboard | 10 ---------- Camera/CollectionViewCell.swift | 7 ------- 2 files changed, 17 deletions(-) diff --git a/Camera/Base.lproj/Main.storyboard b/Camera/Base.lproj/Main.storyboard index 6774bc7..d8d8b5d 100644 --- a/Camera/Base.lproj/Main.storyboard +++ b/Camera/Base.lproj/Main.storyboard @@ -275,16 +275,6 @@ -