From 1a74a03dcea538b7d2968fbb2553242efaed1f94 Mon Sep 17 00:00:00 2001 From: Jack Rouleau Date: Wed, 11 Oct 2017 10:52:34 -0400 Subject: [PATCH 1/2] Added the sender object to the action protocol method, if delegate method is defined, call it then return --- MediaBrowser/MediaBrowser.swift | 6 +++++- MediaBrowser/MediaBrowserDelegate.swift | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MediaBrowser/MediaBrowser.swift b/MediaBrowser/MediaBrowser.swift index 333733a..90035cb 100755 --- a/MediaBrowser/MediaBrowser.swift +++ b/MediaBrowser/MediaBrowser.swift @@ -1512,6 +1512,9 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet if let gc = gridController { if gc.selectionMode { self.title = NSLocalizedString("Select Photos", comment: "") + if let ab = actionButton { + self.navigationItem.rightBarButtonItem = ab + } } else { let photosText: String @@ -2059,7 +2062,8 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet // If they have defined a delegate method then just message them // Let delegate handle things if let d = delegate { - d.actionButtonPressed(at: currentPageIndex, in: self) + d.actionButtonPressed(at: currentPageIndex, in: self, sender: sender) + return } // Show activity view controller diff --git a/MediaBrowser/MediaBrowserDelegate.swift b/MediaBrowser/MediaBrowserDelegate.swift index ca92e07..199b0d6 100644 --- a/MediaBrowser/MediaBrowserDelegate.swift +++ b/MediaBrowser/MediaBrowserDelegate.swift @@ -67,7 +67,7 @@ public protocol MediaBrowserDelegate: class { - Parameter photoIndex: Int - Parameter mediaBrowser: MediaBrowser */ - func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser) + func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser, sender: Any?) /** @@ -114,7 +114,7 @@ public extension MediaBrowserDelegate { func didDisplayMedia(at index: Int, in mediaBrowser: MediaBrowser) { } - func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser) { } + func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser, sender: Any? = nil) { } func isMediaSelected(at index: Int, in mediaBrowser: MediaBrowser) -> Bool { return false } From 745c91a273e14923297406eb74976485ea92394d Mon Sep 17 00:00:00 2001 From: Jack Rouleau Date: Thu, 19 Oct 2017 13:27:25 -0400 Subject: [PATCH 2/2] Change version number --- MediaBrowser.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.podspec b/MediaBrowser.podspec index b63cdf1..bb80156 100644 --- a/MediaBrowser.podspec +++ b/MediaBrowser.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'MediaBrowser' - s.version = '1.0.2' + s.version = '1.0.3' s.summary = 'A simple iOS photo and video browser with optional grid view, captions and selections written in Swift3.' s.description = <<-DESCRIPTION