From f4ef40b6429d6589acf2aacfd63565215e293564 Mon Sep 17 00:00:00 2001 From: lorenzo villarroel perez Date: Fri, 20 Apr 2018 08:35:48 +0200 Subject: [PATCH 01/21] version 0.1.4 --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index 4ea79e8..a38d1d6 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.1.3" + s.version = "0.1.4" s.summary = "ALTableView Pod" s.homepage = "https://github.com/ALiOSDev/ALTableView" diff --git a/ALTableViewSwift/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/Info.plist index 22492c9..0da0cb0 100644 --- a/ALTableViewSwift/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1.3 + 0.1.4 CFBundleVersion 1 LSRequiresIPhoneOS From 42d0bab4dfc255693c6b9f92c14d6a839c472137 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 31 Oct 2018 10:22:13 +0100 Subject: [PATCH 02/21] added editing configuration and delegate --- .../ALTableView/ALTableView.swift | 11 ++++++++++- .../ALTableView/ALTableViewEditingManaging.swift | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift index efed495..33e9c09 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift @@ -19,15 +19,24 @@ public class ALTableView: NSObject { internal var sectionElements: Array public weak var delegate: ALTableViewProtocol? + public weak var editingDelegate: ALTableViewRowEditingProtocol? public weak var viewController: UIViewController? public weak var tableView: UITableView? + public var editingAllowed: Bool + public var movingRowsAllowed: Bool //MARK: - Initializers - public init(sectionElements: Array, viewController: UIViewController, tableView: UITableView) { + public init(sectionElements: Array, + viewController: UIViewController, + tableView: UITableView, + editingAllowed: Bool = false, + movingRowsAllowed: Bool = false) { self.sectionElements = sectionElements + self.editingAllowed = editingAllowed + self.movingRowsAllowed = movingRowsAllowed super.init() self.viewController = viewController tableView.delegate = self diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift index 52e92d6..e641db3 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift @@ -8,11 +8,16 @@ import UIKit +public protocol ALTableViewRowEditingProtocol: class { + func rowMoved(from sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) + func rowDeleted(indexPath: IndexPath) +} + extension ALTableView { public func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { - return true + return movingRowsAllowed } public func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { @@ -23,19 +28,23 @@ extension ALTableView { if let originRowElement = originSection?.getRowElementAt(index: sourceIndexPath.row) { originSection?.deleteRowElements(numberOfRowElements: 1, at: .middle(sourceIndexPath.row)) destinationSection?.insert(rowElements: [originRowElement], at: .middle(destinationIndexPath.row)) + editingDelegate?.rowMoved(from: sourceIndexPath, to: destinationIndexPath) } } public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { - return true + return editingAllowed } public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { switch editingStyle { case .delete: - self.remove(at: indexPath, animation: .automatic) + if self.remove(at: indexPath, animation: .automatic) { + editingDelegate?.rowDeleted(indexPath: indexPath) + } + default: break } From dcff585eede8868d7e82dff85ad77a466055a004 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 31 Oct 2018 10:24:05 +0100 Subject: [PATCH 03/21] conversion to swift 4.2 --- .../ALTableView.xcodeproj/project.pbxproj | 5 +- .../ALTableViewEditingManaging.swift | 2 +- .../ALTableView/ALTableViewRowManaging.swift | 52 +++++++++---------- .../ALTableViewSectionManaging.swift | 52 +++++++++---------- .../Elements/ALElement.swift | 2 +- .../Elements/Row/ALRowElement.swift | 4 +- .../TestALTableView.xcodeproj/project.pbxproj | 5 +- .../TestALTableView/AppDelegate.swift | 2 +- 8 files changed, 63 insertions(+), 61 deletions(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj b/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj index fdbfbe9..dce2d5b 100644 --- a/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj +++ b/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj @@ -335,6 +335,7 @@ TargetAttributes = { 453A357B2089D4F200187F68 = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1010; }; 453A35842089D4F200187F68 = { CreatedOnToolsVersion = 9.3; @@ -646,7 +647,7 @@ PRODUCT_BUNDLE_IDENTIFIER = es.al.ALTableView.ALTableView; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -672,7 +673,7 @@ PRODUCT_BUNDLE_IDENTIFIER = es.al.ALTableView.ALTableView; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift index e641db3..ad1e955 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift @@ -37,7 +37,7 @@ extension ALTableView { return editingAllowed } - public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { + public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { switch editingStyle { case .delete: diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift index d0694ca..c06ae12 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift @@ -12,7 +12,7 @@ import UIKit extension ALTableView { - private func insert(rowElements: Array, section: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func insert(rowElements: Array, section: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { guard let sectionElement: ALSectionElement = self.getSectionElementAt(index: section), sectionElement.insert(rowElements: rowElements, at: position) else { @@ -26,47 +26,47 @@ extension ALTableView { return true } - private func insert(rowElement: ALRowElement, section: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func insert(rowElement: ALRowElement, section: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElements: [rowElement], section: section, position: position, animation: animation) } - @discardableResult public func insert(rowElements: Array, section: Int, row: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElements: Array, section: Int, row: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElements: rowElements, section: section, position: .middle(row), animation: animation) } - @discardableResult public func insert(rowElement: ALRowElement, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElement: ALRowElement, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElement: rowElement, section: indexPath.section, row: indexPath.row, animation: animation) } - @discardableResult public func insert(rowElement: ALRowElement, section: Int, row: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElement: ALRowElement, section: Int, row: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElements: [rowElement], section: section, row: row, animation: animation) } - @discardableResult public func insert(rowElements: Array, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElements: Array, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElements: rowElements, section: indexPath.section, row: indexPath.row, animation: animation) } - @discardableResult public func insert(rowElement: ALRowElement, atTheBeginingOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElement: ALRowElement, atTheBeginingOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElement: rowElement, section: section, position: .begining, animation: animation) } - @discardableResult public func insert(rowElements: Array, atTheBeginingOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElements: Array, atTheBeginingOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElements: rowElements, section: section, position: .begining, animation: animation) } - @discardableResult public func insert(rowElement: ALRowElement, atTheEndOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElement: ALRowElement, atTheEndOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElement: rowElement, section: section, position: .end, animation: animation) } - @discardableResult public func insert(rowElements: Array, atTheEndOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(rowElements: Array, atTheEndOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(rowElements: rowElements, section: section, position: .end, animation: animation) } @@ -76,7 +76,7 @@ extension ALTableView { extension ALTableView { - private func remove(rowElements: Int, section: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func remove(rowElements: Int, section: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { guard let sectionElement: ALSectionElement = self.getSectionElementAt(index: section), sectionElement.deleteRowElements(numberOfRowElements: rowElements, at: position) else { @@ -89,47 +89,47 @@ extension ALTableView { return true } - private func remove(section: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func remove(section: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(rowElements: 1, section: section, position: position, animation: animation) } - @discardableResult public func remove(rowElements: Int, section: Int, row: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(rowElements: Int, section: Int, row: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(rowElements: rowElements, section: section, position: .middle(row), animation: animation) } - @discardableResult public func remove(at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(section: indexPath.section, row: indexPath.row, animation: animation) } - @discardableResult public func remove( section: Int, row: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove( section: Int, row: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(rowElements: 1, section: section, row: row, animation: animation) } - @discardableResult public func remove(rowElements: Int, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(rowElements: Int, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(rowElements: rowElements, section: indexPath.section, row: indexPath.row, animation: animation) } - @discardableResult public func remove(atTheBeginingOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(atTheBeginingOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(section: section, position: .begining, animation: animation) } - @discardableResult public func remove(rowElements: Int, atTheBeginingOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(rowElements: Int, atTheBeginingOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(rowElements: rowElements, section: section, position: .begining, animation: animation) } - @discardableResult public func remove(atTheEndOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(atTheEndOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(section: section, position: .end, animation: animation) } - @discardableResult public func remove(rowElements: Int, atTheEndOfSection section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(rowElements: Int, atTheEndOfSection section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(rowElements: rowElements, section: section, position: .end, animation: animation) } @@ -139,7 +139,7 @@ extension ALTableView { extension ALTableView { - private func replace(rowElements: Array, section: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func replace(rowElements: Array, section: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { guard let sectionElement: ALSectionElement = self.getSectionElementAt(index: section), sectionElement.replace(rowElements: rowElements, at: position) else { @@ -152,28 +152,28 @@ extension ALTableView { return true } - private func replace(rowElement: ALRowElement, section: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func replace(rowElement: ALRowElement, section: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(rowElements: [rowElement], section: section, position: position, animation: animation) } - @discardableResult public func replace(rowElements: Array, section: Int, row: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(rowElements: Array, section: Int, row: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(rowElements: rowElements, section: section, position: .middle(row), animation: animation) } - @discardableResult public func replace(rowElement: ALRowElement, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(rowElement: ALRowElement, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(rowElement: rowElement, section: indexPath.section, row: indexPath.row, animation: animation) } - @discardableResult public func replace(rowElement: ALRowElement, section: Int, row: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(rowElement: ALRowElement, section: Int, row: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(rowElements: [rowElement], section: section, row: row, animation: animation) } - @discardableResult public func replace(rowElements: Array, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(rowElements: Array, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(rowElements: rowElements, section: indexPath.section, row: indexPath.row, animation: animation) } diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift index 4b0fa35..358f7ff 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift @@ -12,7 +12,7 @@ import UIKit extension ALTableView { - private func insert(sectionElements: Array, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func insert(sectionElements: Array, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { guard self.sectionElements.safeInsert(contentsOf: sectionElements, at: position) else { return false @@ -24,47 +24,47 @@ extension ALTableView { return true } - private func insert(sectionElement: ALSectionElement, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func insert(sectionElement: ALSectionElement, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElements: [sectionElement], position: position, animation: animation) } - @discardableResult public func insert(sectionElements: Array, section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElements: Array, section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElements: sectionElements, position: .middle(section), animation: animation) } - @discardableResult public func insert(sectionElement: ALSectionElement, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElement: ALSectionElement, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElement: sectionElement, section: indexPath.section, animation: animation) } - @discardableResult public func insert(sectionElement: ALSectionElement, section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElement: ALSectionElement, section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElements: [sectionElement], section: section, animation: animation) } - @discardableResult public func insert(sectionElements: Array, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElements: Array, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElements: sectionElements, section: indexPath.section, animation: animation) } - @discardableResult public func insert(sectionElement: ALSectionElement, atTheBeginingOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElement: ALSectionElement, atTheBeginingOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElement: sectionElement, position: .begining) } - @discardableResult public func insert(sectionElements: Array, atTheBeginingOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElements: Array, atTheBeginingOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElements: sectionElements, position: .begining) } - @discardableResult public func insert(sectionElement: ALSectionElement, atTheEndOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElement: ALSectionElement, atTheEndOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElement: sectionElement, position: .end) } - @discardableResult public func insert(sectionElements: Array, atTheEndOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func insert(sectionElements: Array, atTheEndOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.insert(sectionElements: sectionElements, position: .end) } @@ -74,7 +74,7 @@ extension ALTableView { extension ALTableView { - private func remove(sectionElements: Int, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func remove(sectionElements: Int, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { guard self.sectionElements.safeDelete(numberOfElements: sectionElements, at:position) else { return false @@ -86,46 +86,46 @@ extension ALTableView { return true } - private func remove(position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func remove(position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: 1, position: position, animation: animation) } - @discardableResult public func remove(sectionElements: Int, section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(sectionElements: Int, section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: sectionElements, position: .middle(section), animation: animation) } - @discardableResult public func removeSection(at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func removeSection(at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: 1, section: indexPath.section, animation: animation) } - @discardableResult public func remove(section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: 1, section: section, animation: animation) } - @discardableResult public func remove(sectionElements: Int, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(sectionElements: Int, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: sectionElements, section: indexPath.section, animation: animation) } - @discardableResult public func remove(satTheBeginingOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(satTheBeginingOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(position: .begining, animation: animation) } - @discardableResult public func remove(sectionElements: Int, atTheBeginingOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(sectionElements: Int, atTheBeginingOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: sectionElements, position: .begining, animation: animation) } - @discardableResult public func remove(atTheEndOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(atTheEndOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(position: .end, animation: animation) } - @discardableResult public func remove(sectionElements: Int, atTheEndOfTableView section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func remove(sectionElements: Int, atTheEndOfTableView section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.remove(sectionElements: sectionElements, position: .end, animation: animation) } @@ -135,7 +135,7 @@ extension ALTableView { extension ALTableView { - private func replace(sectionElements: Array, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func replace(sectionElements: Array, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { guard self.sectionElements.safeReplace(contentsOf: sectionElements, at: position) else { return false @@ -147,28 +147,28 @@ extension ALTableView { return true } - private func replace(sectionElement: ALSectionElement, position: ALPosition, animation: UITableViewRowAnimation = .top) -> Bool { + private func replace(sectionElement: ALSectionElement, position: ALPosition, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(sectionElements: [sectionElement], position: position, animation: animation) } - @discardableResult public func replace(sectionElements: Array, section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(sectionElements: Array, section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(sectionElements: sectionElements, position: .middle(section), animation: animation) } - @discardableResult public func replace(sectionElement: ALSectionElement, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(sectionElement: ALSectionElement, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(sectionElement: sectionElement, section: indexPath.section, animation: animation) } - @discardableResult public func replace(sectionElement: ALSectionElement, section: Int, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(sectionElement: ALSectionElement, section: Int, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(sectionElements: [sectionElement], section: section, animation: animation) } - @discardableResult public func replace(sectionElements: Array, at indexPath: IndexPath, animation: UITableViewRowAnimation = .top) -> Bool { + @discardableResult public func replace(sectionElements: Array, at indexPath: IndexPath, animation: UITableView.RowAnimation = .top) -> Bool { return self.replace(sectionElements: sectionElements, section: indexPath.section, animation: animation) } diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift index 9008d85..0ab094d 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift @@ -38,7 +38,7 @@ public class ALElement { internal func getHeight() -> CGFloat { if self.estimateHeightMode { - return UITableViewAutomaticDimension + return UITableView.automaticDimension } return self.height } diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift index fc8257c..cffc5be 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift @@ -46,7 +46,7 @@ public class ALRowElement: ALElement, ALRowElementProtocol { private var className: AnyClass //TODO es posible que el className no sea necesario - private let cellStyle: UITableViewCellStyle + private let cellStyle: UITableViewCell.CellStyle private var pressedHandler: ALCellPressedHandler? private var createdHandler: ALCellCreatedHandler? @@ -54,7 +54,7 @@ public class ALRowElement: ALElement, ALRowElementProtocol { //MARK: - Initializers - public init(className: AnyClass, identifier: String, dataObject: Any, cellStyle: UITableViewCellStyle = .default, estimateHeightMode: Bool = false, height: CGFloat = 44.0, pressedHandler: ALCellPressedHandler? = nil, createdHandler: ALCellCreatedHandler? = nil, deselectedHandler: ALCellDeselectedHandler? = nil) { + public init(className: AnyClass, identifier: String, dataObject: Any, cellStyle: UITableViewCell.CellStyle = .default, estimateHeightMode: Bool = false, height: CGFloat = 44.0, pressedHandler: ALCellPressedHandler? = nil, createdHandler: ALCellCreatedHandler? = nil, deselectedHandler: ALCellDeselectedHandler? = nil) { self.className = className self.cellStyle = cellStyle diff --git a/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj b/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj index 1430048..beea59c 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj +++ b/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj @@ -172,6 +172,7 @@ TargetAttributes = { 4558B8C32089C549007436A9 = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1010; }; }; }; @@ -424,7 +425,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = villarroel.lorenzo.TestALTableView; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -443,7 +444,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = villarroel.lorenzo.TestALTableView; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/AppDelegate.swift b/ALTableViewSwift/TestALTableView/TestALTableView/AppDelegate.swift index 32c604c..aa1222e 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/AppDelegate.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let splitViewController = window!.rootViewController as! UISplitViewController let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController From ac7aabbc69e81b37a34980b6ab1b17456df8635f Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 31 Oct 2018 10:28:51 +0100 Subject: [PATCH 04/21] bumped version 0.2.0 --- ALTableView.podspec | 4 ++-- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- README.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index 7b639df..d41118a 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.1.6" + s.version = "0.2.0" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. @@ -25,7 +25,7 @@ This framework is a generic UITableViewDataSource and UITableViewDelegate which s.license = "MIT" s.author = "Abimael Barea, Lorenzo Villarroel" - s.swift_version = '4.0' + s.swift_version = '4.2' s.platform = :ios, "9.0" diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index 8d28050..23d96cb 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.1.6 + 0.2.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 6873106..28a8d27 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 0.2.0 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/README.md b/README.md index cc511f4..2c9fb97 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T This framework is still on development. We cannot guarantee yet that all the features work. -The latest stable version for swift is [0.1.6](https://github.com/ALiOSDev/ALTableView/tree/0.1.6) +The latest stable version for swift is [0.2.0](https://github.com/ALiOSDev/ALTableView/tree/0.2.0), which includes support for swift 4.2 **CocoaPods** @@ -30,7 +30,7 @@ Alternatively, you can try adding [these classes](https://github.com/ALiOSDev/AL Requirements -------- -Swift 4.0 +Swift 4.2 iOS 9.0 How it works From 16e2de6582d8c7cab318c5e600c271631e5aac56 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Mon, 26 Nov 2018 13:34:25 +0100 Subject: [PATCH 05/21] Changed Any to Optional for dataObject --- .../ALTableViewClasses/Elements/ALElement.swift | 6 +++--- .../Elements/HeaderFooter/ALHeaderFooterElement.swift | 6 +++--- .../ALTableViewClasses/Elements/Row/ALRowElement.swift | 8 ++++---- .../TestALTableView/Master/Master2TableViewCell.swift | 2 +- .../TestALTableView/Master/MasterHeaderFooter.swift | 2 +- .../TestALTableView/Master/MasterTableViewCell.swift | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift index 0ab094d..ccb4250 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/ALElement.swift @@ -13,10 +13,10 @@ public class ALElement { internal var estimateHeightMode: Bool internal var height: CGFloat internal let identifier: String - internal let dataObject: Any + internal let dataObject: Any? - init(identifier: String, dataObject: Any,estimateHeightMode: Bool, height: CGFloat) { + init(identifier: String, dataObject: Any?, estimateHeightMode: Bool, height: CGFloat) { self.identifier = identifier self.dataObject = dataObject @@ -26,7 +26,7 @@ public class ALElement { //MARK: - Getters - internal func getDataObject() -> Any { + internal func getDataObject() -> Any? { return self.dataObject } diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/HeaderFooter/ALHeaderFooterElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/HeaderFooter/ALHeaderFooterElement.swift index 82061dd..f04cafa 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/HeaderFooter/ALHeaderFooterElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/HeaderFooter/ALHeaderFooterElement.swift @@ -9,7 +9,7 @@ import UIKit public typealias ALHeaderFooterPressedHandler = (UITableViewHeaderFooterView) -> Void -public typealias ALHeaderFooterCreatedHandler = (Any, UITableViewHeaderFooterView) -> Void +public typealias ALHeaderFooterCreatedHandler = (Any?, UITableViewHeaderFooterView) -> Void public typealias ALHeaderFooterDeselectedHandler = (UITableViewHeaderFooterView) -> Void //Implemented by ALHeaderFooterElement @@ -20,7 +20,7 @@ public protocol ALHeaderFooterElementProtocol { //Implemented by UITableViewCell public protocol ALHeaderFooterProtocol { func viewPressed () -> Void - func viewCreated(dataObject: Any) -> Void + func viewCreated(dataObject: Any?) -> Void } extension ALHeaderFooterProtocol { @@ -28,7 +28,7 @@ extension ALHeaderFooterProtocol { } - public func viewCreated(dataObject: Any) -> Void { + public func viewCreated(dataObject: Any?) -> Void { print("ALHeaderFooterProtocol") } } diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift index cffc5be..8be359f 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift @@ -9,7 +9,7 @@ import UIKit public typealias ALCellPressedHandler = (UIViewController?, UITableViewCell) -> Void -public typealias ALCellCreatedHandler = (Any, UITableViewCell) -> Void +public typealias ALCellCreatedHandler = (Any?, UITableViewCell) -> Void public typealias ALCellDeselectedHandler = (UITableViewCell) -> Void //Implemented by ALRowElement @@ -22,7 +22,7 @@ public protocol ALRowElementProtocol { public protocol ALCellProtocol { func cellPressed (viewController: UIViewController?) -> Void func cellDeselected () -> Void - func cellCreated(dataObject: Any) -> Void + func cellCreated(dataObject: Any?) -> Void } extension ALCellProtocol { @@ -34,7 +34,7 @@ extension ALCellProtocol { } - public func cellCreated(dataObject: Any) -> Void { + public func cellCreated(dataObject: Any?) -> Void { print("ALCellProtocol") } } @@ -54,7 +54,7 @@ public class ALRowElement: ALElement, ALRowElementProtocol { //MARK: - Initializers - public init(className: AnyClass, identifier: String, dataObject: Any, cellStyle: UITableViewCell.CellStyle = .default, estimateHeightMode: Bool = false, height: CGFloat = 44.0, pressedHandler: ALCellPressedHandler? = nil, createdHandler: ALCellCreatedHandler? = nil, deselectedHandler: ALCellDeselectedHandler? = nil) { + public init(className: AnyClass, identifier: String, dataObject: Any?, cellStyle: UITableViewCell.CellStyle = .default, estimateHeightMode: Bool = false, height: CGFloat = 44.0, pressedHandler: ALCellPressedHandler? = nil, createdHandler: ALCellCreatedHandler? = nil, deselectedHandler: ALCellDeselectedHandler? = nil) { self.className = className self.cellStyle = cellStyle diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Master/Master2TableViewCell.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Master/Master2TableViewCell.swift index 3986cf3..4810f1b 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Master/Master2TableViewCell.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Master/Master2TableViewCell.swift @@ -26,7 +26,7 @@ class Master2TableViewCell: UITableViewCell, ALCellProtocol { // Configure the view for the selected state } - public func cellCreated(dataObject: Any) { + public func cellCreated(dataObject: Any?) { if let title = dataObject as? Int { self.label.text = String(title) } diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterHeaderFooter.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterHeaderFooter.swift index ba73834..cdc4b34 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterHeaderFooter.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterHeaderFooter.swift @@ -23,7 +23,7 @@ class MasterHeaderFooter: UITableViewHeaderFooterView, ALHeaderFooterProtocol { } */ - func viewCreated(dataObject: Any) { + func viewCreated(dataObject: Any?) { if let title: String = dataObject as? String { self.labelText.text = title } diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift index d8b2ed8..2147986 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift @@ -16,7 +16,7 @@ class MasterTableViewCell: UITableViewCell, ALCellProtocol { @IBOutlet weak var labelText: UILabel! - public func cellCreated(dataObject: Any) { + public func cellCreated(dataObject: Any?) { if let title = dataObject as? String { self.labelText.text = title } From 4f89d7a9bd938cfb3debadd6f649db543189a41c Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Mon, 26 Nov 2018 13:35:14 +0100 Subject: [PATCH 06/21] bumped version 0.3.0 --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index d41118a..fc95653 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.2.0" + s.version = "0.3.0" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index 23d96cb..dccb7a2 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.2.0 + 0.3.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass From e0adaf7497d519707caab50e2d329257229a4940 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Mon, 26 Nov 2018 13:36:18 +0100 Subject: [PATCH 07/21] updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c9fb97..50d323a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T This framework is still on development. We cannot guarantee yet that all the features work. -The latest stable version for swift is [0.2.0](https://github.com/ALiOSDev/ALTableView/tree/0.2.0), which includes support for swift 4.2 +The latest stable version for swift is [0.3.0](https://github.com/ALiOSDev/ALTableView/tree/0.3.0), which includes support for swift 4.2 **CocoaPods** From 457afaf83e63b78b9279d9805740cac8c64c5776 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 5 Dec 2018 14:49:49 +0100 Subject: [PATCH 08/21] now every row can be configured to be editable or not individually --- .../ALTableView/ALTableView.swift | 3 --- .../ALTableView/ALTableViewEditingManaging.swift | 4 ++-- .../Elements/Row/ALRowElement.swift | 13 ++++++++++++- .../TestALTableView/MasterViewController.swift | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift index 33e9c09..3dff7c4 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift @@ -22,7 +22,6 @@ public class ALTableView: NSObject { public weak var editingDelegate: ALTableViewRowEditingProtocol? public weak var viewController: UIViewController? public weak var tableView: UITableView? - public var editingAllowed: Bool public var movingRowsAllowed: Bool @@ -31,11 +30,9 @@ public class ALTableView: NSObject { public init(sectionElements: Array, viewController: UIViewController, tableView: UITableView, - editingAllowed: Bool = false, movingRowsAllowed: Bool = false) { self.sectionElements = sectionElements - self.editingAllowed = editingAllowed self.movingRowsAllowed = movingRowsAllowed super.init() self.viewController = viewController diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift index ad1e955..abedb55 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift @@ -33,8 +33,8 @@ extension ALTableView { } public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { - - return editingAllowed + let canEditRow = self.getSectionElementAt(index: indexPath.section)?.getRowElementAt(index: indexPath.row)?.editingAllowed ?? false + return canEditRow } public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift index 8be359f..3adac04 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift @@ -47,6 +47,7 @@ public class ALRowElement: ALElement, ALRowElementProtocol { private var className: AnyClass //TODO es posible que el className no sea necesario private let cellStyle: UITableViewCell.CellStyle + internal var editingAllowed: Bool private var pressedHandler: ALCellPressedHandler? private var createdHandler: ALCellCreatedHandler? @@ -54,10 +55,20 @@ public class ALRowElement: ALElement, ALRowElementProtocol { //MARK: - Initializers - public init(className: AnyClass, identifier: String, dataObject: Any?, cellStyle: UITableViewCell.CellStyle = .default, estimateHeightMode: Bool = false, height: CGFloat = 44.0, pressedHandler: ALCellPressedHandler? = nil, createdHandler: ALCellCreatedHandler? = nil, deselectedHandler: ALCellDeselectedHandler? = nil) { + public init(className: AnyClass, + identifier: String, + dataObject: Any?, + cellStyle: UITableViewCell.CellStyle = .default, + estimateHeightMode: Bool = false, + height: CGFloat = 44.0, + editingAllowed: Bool = false, + pressedHandler: ALCellPressedHandler? = nil, + createdHandler: ALCellCreatedHandler? = nil, + deselectedHandler: ALCellDeselectedHandler? = nil) { self.className = className self.cellStyle = cellStyle + self.editingAllowed = editingAllowed self.pressedHandler = pressedHandler self.createdHandler = createdHandler self.deselectedHandler = deselectedHandler diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift b/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift index be18a83..a9ccd63 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift @@ -62,7 +62,7 @@ class MasterViewController: UITableViewController, ALTableViewProtocol { var sectionElements = [ALSectionElement]() for _ in 0...4 { var rowElements = Array() - let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true) + let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true, editingAllowed: true) let rowElement2 = ALRowElement(className:Master2TableViewCell.classForCoder(), identifier: Master2TableViewCell.reuseIdentifier, dataObject: 12, estimateHeightMode: true) rowElements.append(rowElement) rowElements.append(rowElement2) From f18a8b280686e4e82c0c3ac6ed29b166b785628e Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 5 Dec 2018 14:51:27 +0100 Subject: [PATCH 09/21] bumped version 0.3.1 --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index fc95653..5f083d3 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.3.0" + s.version = "0.3.1" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index dccb7a2..ccece00 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.3.0 + 0.3.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 28a8d27..78ce31e 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.2.0 + 0.3.1 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/README.md b/README.md index 50d323a..72f9e38 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T This framework is still on development. We cannot guarantee yet that all the features work. -The latest stable version for swift is [0.3.0](https://github.com/ALiOSDev/ALTableView/tree/0.3.0), which includes support for swift 4.2 +The latest stable version for swift is [0.3.1](https://github.com/ALiOSDev/ALTableView/tree/0.3.1), which includes support for swift 4.2 **CocoaPods** From 746c9ad39256e9e420bcc8e24b6a38c78f196f1f Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 5 Dec 2018 14:55:37 +0100 Subject: [PATCH 10/21] now the removed delegate returns also the dataObject --- .../ALTableView/ALTableViewEditingManaging.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift index abedb55..367914d 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift @@ -10,7 +10,7 @@ import UIKit public protocol ALTableViewRowEditingProtocol: class { func rowMoved(from sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) - func rowDeleted(indexPath: IndexPath) + func rowDeleted(indexPath: IndexPath, dataObject: Any?) } extension ALTableView { @@ -42,7 +42,8 @@ extension ALTableView { switch editingStyle { case .delete: if self.remove(at: indexPath, animation: .automatic) { - editingDelegate?.rowDeleted(indexPath: indexPath) + let dataObject = self.getSectionElementAt(index: indexPath.section)?.getRowElementAt(index: indexPath.row)?.getDataObject() + editingDelegate?.rowDeleted(indexPath: indexPath, dataObject: dataObject) } default: From 674b2213c20024bf5797a9a4b1a2f7af1d7bb842 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 5 Dec 2018 14:56:25 +0100 Subject: [PATCH 11/21] bumped version 0.3.2 --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index 5f083d3..beddb64 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.3.1" + s.version = "0.3.2" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index ccece00..da2cb9e 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.3.1 + 0.3.2 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 78ce31e..4f0c1a9 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.1 + 0.3.2 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/README.md b/README.md index 72f9e38..1079364 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T This framework is still on development. We cannot guarantee yet that all the features work. -The latest stable version for swift is [0.3.1](https://github.com/ALiOSDev/ALTableView/tree/0.3.1), which includes support for swift 4.2 +The latest stable version for swift is [0.3.2](https://github.com/ALiOSDev/ALTableView/tree/0.3.2), which includes support for swift 4.2 **CocoaPods** From 42469c4e40c0586bdfd19cd85bea6676181ff65d Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Fri, 21 Dec 2018 12:09:55 +0100 Subject: [PATCH 12/21] added visibility to altableview methods and created another kind of example --- .../ALTableView.xcodeproj/project.pbxproj | 48 -- .../ALTableView/ALTableViewDelegate.swift | 1 + .../ALTableViewSectionManaging.swift | 10 +- .../Elements/Section/ALSectionElement.swift | 4 +- .../Section/ALSectionElementRow.swift | 2 +- ALTableViewSwift/Podfile | 1 + ALTableViewSwift/Podfile.lock | 17 +- ALTableViewSwift/Pods/Manifest.lock | 17 +- .../Pods/Pods.xcodeproj/project.pbxproj | 683 +++++++++++++----- ALTableViewSwift/Pods/SwipeCellKit/LICENSE | 22 + ALTableViewSwift/Pods/SwipeCellKit/README.md | 250 +++++++ .../Pods/SwipeCellKit/Source/Extensions.swift | 81 +++ .../SwipeAccessibilityCustomAction.swift | 24 + .../SwipeCellKit/Source/SwipeAction.swift | 131 ++++ .../Source/SwipeActionButton.swift | 108 +++ .../Source/SwipeActionTransitioning.swift | 106 +++ .../Source/SwipeActionsView.swift | 314 ++++++++ .../SwipeCellKit/Source/SwipeAnimator.swift | 112 +++ ...wipeCollectionViewCell+Accessibility.swift | 80 ++ .../SwipeCollectionViewCell+Display.swift | 55 ++ .../Source/SwipeCollectionViewCell.swift | 241 ++++++ .../SwipeCollectionViewCellDelegate.swift | 91 +++ .../SwipeCellKit/Source/SwipeController.swift | 520 +++++++++++++ .../SwipeCellKit/Source/SwipeExpanding.swift | 120 +++ .../Source/SwipeExpansionStyle.swift | 239 ++++++ .../SwipeCellKit/Source/SwipeFeedback.swift | 56 ++ .../SwipeCellKit/Source/SwipeOptions.swift | 88 +++ .../SwipeTableViewCell+Accessibility.swift | 80 ++ .../Source/SwipeTableViewCell+Display.swift | 55 ++ .../Source/SwipeTableViewCell.swift | 227 ++++++ .../Source/SwipeTableViewCellDelegate.swift | 92 +++ .../Source/SwipeTransitionLayout.swift | 88 +++ .../Pods/SwipeCellKit/Source/Swipeable.swift | 41 ++ .../Pods-ALTableView-resources.sh | 18 +- .../Pods-ALTableViewTests-frameworks.sh | 13 +- .../Pods-ALTableViewTests-resources.sh | 18 +- ...-TestALTableView-acknowledgements.markdown | 25 + ...ods-TestALTableView-acknowledgements.plist | 31 + .../Pods-TestALTableView-frameworks.sh | 20 +- .../Pods-TestALTableView-resources.sh | 18 +- .../Pods-TestALTableView.debug.xcconfig | 5 + .../Pods-TestALTableView.release.xcconfig | 5 + .../SwipeCellKit/Info.plist | 26 + .../SwipeCellKit/SwipeCellKit-dummy.m | 5 + .../SwipeCellKit/SwipeCellKit-prefix.pch | 12 + .../SwipeCellKit/SwipeCellKit-umbrella.h | 16 + .../SwipeCellKit/SwipeCellKit.modulemap | 6 + .../SwipeCellKit/SwipeCellKit.xcconfig | 9 + .../TestALTableView.xcodeproj/project.pbxproj | 75 +- .../Master/MasterTableViewCell.swift | 31 +- .../MasterViewController.swift | 81 ++- .../Orders/Loading/LoadingTableViewCell.swift | 27 + .../Orders/Loading/LoadingTableViewCell.xib | 38 + .../LoadingRetryTableViewCell.swift | 59 ++ .../LoadingRetryTableViewCell.xib | 41 ++ .../TestALTableView/Orders/OrderElement.swift | 110 +++ .../Orders/OrdersTableViewCell.swift | 102 +++ .../Orders/OrdersTableViewCell.xib | 86 +++ .../TestALTableView/Orders/Styles.swift | 23 + 59 files changed, 4639 insertions(+), 265 deletions(-) create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/LICENSE create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/README.md create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/Extensions.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAccessibilityCustomAction.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAction.swift create mode 100755 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionButton.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionTransitioning.swift create mode 100755 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionsView.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAnimator.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Accessibility.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Display.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCellDelegate.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeController.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpanding.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpansionStyle.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeFeedback.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeOptions.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Accessibility.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Display.swift create mode 100755 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell.swift create mode 100755 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCellDelegate.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTransitionLayout.swift create mode 100644 ALTableViewSwift/Pods/SwipeCellKit/Source/Swipeable.swift create mode 100644 ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/Info.plist create mode 100644 ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-dummy.m create mode 100644 ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-prefix.pch create mode 100644 ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-umbrella.h create mode 100644 ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.modulemap create mode 100644 ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.xcconfig create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.swift create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.xib create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.swift create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.xib create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrderElement.swift create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.swift create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.xib create mode 100644 ALTableViewSwift/TestALTableView/TestALTableView/Orders/Styles.swift diff --git a/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj b/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj index dce2d5b..a6f1570 100644 --- a/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj +++ b/ALTableViewSwift/ALTableView/ALTableView.xcodeproj/project.pbxproj @@ -291,7 +291,6 @@ 453A35782089D4F200187F68 /* Frameworks */, 453A35792089D4F200187F68 /* Headers */, 453A357A2089D4F200187F68 /* Resources */, - 6C777D4F5D4ABE47461B6F38 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -310,8 +309,6 @@ 453A35812089D4F200187F68 /* Sources */, 453A35822089D4F200187F68 /* Frameworks */, 453A35832089D4F200187F68 /* Resources */, - A9CA9B527A6DE6ADC392445F /* [CP] Embed Pods Frameworks */, - 601A1F66D15603514276318E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -378,36 +375,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 601A1F66D15603514276318E /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 6C777D4F5D4ABE47461B6F38 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ALTableView/Pods-ALTableView-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 6F90381A6C22CD03A90626BD /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -426,21 +393,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - A9CA9B527A6DE6ADC392445F /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; BF2F45171CFD0D3D5E98C5BA /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift index f98c1e9..0f9978d 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift @@ -35,6 +35,7 @@ extension ALTableView: UITableViewDelegate { let cellHeight: CGFloat = cell.frame.size.height self.getSectionElementAt(index: indexPath.section)?.setRowElementHeight(row: indexPath.row, height: cellHeight) + print(indexPath) if self.isLastIndexPath(indexPath: indexPath, tableView: tableView) { //We reached the end of the tableView self.delegate?.tableViewDidReachEnd?() diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift index 358f7ff..504dc15 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewSectionManaging.swift @@ -187,10 +187,18 @@ extension ALTableView { extension ALTableView { - internal func getSectionElementAt(index: Int) -> ALSectionElement?{ + public func getSectionElementAt(index: Int) -> ALSectionElement? { return self.sectionElements[ALSafe: index] } + public func getNumberOfSections() -> Int { + return self.sectionElements.count + } + + public func getNumberOfRowsAt(section: Int) -> Int? { + return self.getSectionElementAt(index: section)?.getNumberOfRealRows() + } + private func getIndexSections(position: ALPosition, numberOfSectionElements: Int, operation: ALOperation) -> IndexSet { let indexOperator: ALIndexOperator = operation.getIndexOperator(position: position, numberOfElements: numberOfSectionElements) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElement.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElement.swift index 55f0470..f03368f 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElement.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElement.swift @@ -41,7 +41,7 @@ public class ALSectionElement { //MARK: - Getters - internal func getNumberOfRows() -> Int { + public func getNumberOfRows() -> Int { if self.isOpened { return self.rowElements.count @@ -50,7 +50,7 @@ public class ALSectionElement { } } - internal func getNumberOfRealRows() -> Int { + public func getNumberOfRealRows() -> Int { return self.rowElements.count } diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementRow.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementRow.swift index 4ddec14..771c188 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementRow.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementRow.swift @@ -73,7 +73,7 @@ extension ALSectionElement { extension ALSectionElement { - internal func getRowElementAt(index: Int) -> ALRowElement? { + public func getRowElementAt(index: Int) -> ALRowElement? { return self.rowElements[ALSafe: index] } diff --git a/ALTableViewSwift/Podfile b/ALTableViewSwift/Podfile index 9d1a9a8..a103b6c 100644 --- a/ALTableViewSwift/Podfile +++ b/ALTableViewSwift/Podfile @@ -7,6 +7,7 @@ use_frameworks! def app_pods project 'TestALTableView/TestALTableView.xcodeproj' + pod 'SwipeCellKit', '2.5.0' end def framework_pods diff --git a/ALTableViewSwift/Podfile.lock b/ALTableViewSwift/Podfile.lock index 14a10fd..cc46d96 100644 --- a/ALTableViewSwift/Podfile.lock +++ b/ALTableViewSwift/Podfile.lock @@ -1,3 +1,16 @@ -PODFILE CHECKSUM: 2f5e62e3ae5f1602b31bdc39c8d9af9253e95b97 +PODS: + - SwipeCellKit (2.5.0) -COCOAPODS: 1.4.0 +DEPENDENCIES: + - SwipeCellKit (= 2.5.0) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - SwipeCellKit + +SPEC CHECKSUMS: + SwipeCellKit: d8f2617538ce3021cb0a11d1b93856a06a2f2e20 + +PODFILE CHECKSUM: a24e7a1ed9e3bea698885fc35383601a3a902f5d + +COCOAPODS: 1.5.3 diff --git a/ALTableViewSwift/Pods/Manifest.lock b/ALTableViewSwift/Pods/Manifest.lock index 14a10fd..cc46d96 100644 --- a/ALTableViewSwift/Pods/Manifest.lock +++ b/ALTableViewSwift/Pods/Manifest.lock @@ -1,3 +1,16 @@ -PODFILE CHECKSUM: 2f5e62e3ae5f1602b31bdc39c8d9af9253e95b97 +PODS: + - SwipeCellKit (2.5.0) -COCOAPODS: 1.4.0 +DEPENDENCIES: + - SwipeCellKit (= 2.5.0) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - SwipeCellKit + +SPEC CHECKSUMS: + SwipeCellKit: d8f2617538ce3021cb0a11d1b93856a06a2f2e20 + +PODFILE CHECKSUM: a24e7a1ed9e3bea698885fc35383601a3a902f5d + +COCOAPODS: 1.5.3 diff --git a/ALTableViewSwift/Pods/Pods.xcodeproj/project.pbxproj b/ALTableViewSwift/Pods/Pods.xcodeproj/project.pbxproj index ad2bcf1..78b1b32 100644 --- a/ALTableViewSwift/Pods/Pods.xcodeproj/project.pbxproj +++ b/ALTableViewSwift/Pods/Pods.xcodeproj/project.pbxproj @@ -7,37 +7,98 @@ objects = { /* Begin PBXBuildFile section */ - 3D0B5A7E86517B46BD96F8D5496FEF0A /* Pods-ALTableView-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 193765CA53AF1BEF89157D70EC6AEAA7 /* Pods-ALTableView-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5B560DBC8077686BA0438CE3616DB282 /* Pods-TestALTableView-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = DD898B1F223B78BEF914C1F4CA39EA11 /* Pods-TestALTableView-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8E3C0B5704BE96C238B6717E7A4FA630 /* Pods-ALTableView-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2687CDBD31E918BA983A674A4CE81B1A /* Pods-ALTableView-dummy.m */; }; - 92E9AFA847B2F9F1ADBDBFC176D7448A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; - A3C1BFD6D294FF261CCA31025B37EB8A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; - A6842107B998A260B55DE5A279B40408 /* Pods-ALTableViewTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 967188619D0A4F10CD6A3EB849D47E09 /* Pods-ALTableViewTests-dummy.m */; }; - AD641DA54B9038AAF0718D18A4297473 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; - C7F0767804EE5497280F0F47140A0F34 /* Pods-ALTableViewTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EAD3F5BE26ACFA9CB2C3D57859F28C4C /* Pods-ALTableViewTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EE11EB7D3947D8A14C912A3E0C87C596 /* Pods-TestALTableView-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 97D02FF507439D9805A7BEA22229C1F2 /* Pods-TestALTableView-dummy.m */; }; + 095E8D6D0FCBFCB00AEFA2DEEDF12B71 /* SwipeAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA003A20C3527387C3A39C3452761A1D /* SwipeAnimator.swift */; }; + 1D8B1AE6E9AB0600B03650C6BAFA2F24 /* SwipeFeedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E5CF45D2D750123BB078EB7B375B0E /* SwipeFeedback.swift */; }; + 213344D4B8669E875D5B639BC1231B5A /* SwipeAccessibilityCustomAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2A2C78F90E62D4C6758DE64D2D771F0 /* SwipeAccessibilityCustomAction.swift */; }; + 38ABFA35A32D36CDB99F3859077FF1A6 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7AAEA5B5D2785C87FB2253913E686ED /* Extensions.swift */; }; + 3AAF5B90D53B071454F50365DC98DB24 /* SwipeCollectionViewCell+Display.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22239ADDB87FAD1706C881FFC570A8DC /* SwipeCollectionViewCell+Display.swift */; }; + 421918D88AEE3B97A81B496E84A2CECE /* Pods-ALTableView-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 193765CA53AF1BEF89157D70EC6AEAA7 /* Pods-ALTableView-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4400A34B5F8164147E830FCA8BC92828 /* Swipeable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4113D3C18FCC326736C158562FDC6FC4 /* Swipeable.swift */; }; + 4D47F4EB2A4A2FA0233CCFD1AA06E036 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A16F4CFC63FAC439D7A04994F579A03 /* Foundation.framework */; }; + 50AF56E2B8B1F5D1E498E7BD113320CF /* SwipeCollectionViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C0C9D5ADE765E39BC0BB6AF105B9D00 /* SwipeCollectionViewCellDelegate.swift */; }; + 5FFF57CA7D1A216E8164F168717242A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A16F4CFC63FAC439D7A04994F579A03 /* Foundation.framework */; }; + 665EF7DDA41444FC4EB5B91AB0D059CB /* SwipeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4081885FB3D652A5406B4A431098BDE /* SwipeController.swift */; }; + 6E130C15438AA644ABFB2DADA461186D /* SwipeTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CADFA09C7B4A9C06F2AACF4FDFF0F802 /* SwipeTableViewCellDelegate.swift */; }; + 6F28DA892CA314A0D85D7BB08FFC04A5 /* SwipeTableViewCell+Display.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D26CDCF75B782E07A07DD3252E3E380 /* SwipeTableViewCell+Display.swift */; }; + 719D5FF8DB409ED7CC62AF08233B8325 /* SwipeActionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5B3F853018F6E95992B4E07CA890613 /* SwipeActionButton.swift */; }; + 917C4AF08A5D33195C556C671A010E04 /* SwipeActionTransitioning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 354361ED084775926B8EF62B670FAEA8 /* SwipeActionTransitioning.swift */; }; + 929F3B64B213BE671427B1FCFEFF928B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A16F4CFC63FAC439D7A04994F579A03 /* Foundation.framework */; }; + 99FCCC0959E68A39B8CF962EEE5D633C /* SwipeExpanding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812F14738E47DFACA7EF95849DD65FD5 /* SwipeExpanding.swift */; }; + 9A207AC03784F6B200AD409C639FF4EE /* SwipeCellKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 35A8FA6DBCC9AE6059B1AA0B4F1AF277 /* SwipeCellKit-dummy.m */; }; + 9BA3CD99DF4F7C1552CA93F4C5C4653B /* SwipeExpansionStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D152118CFC9042FFE718E60238BFC5 /* SwipeExpansionStyle.swift */; }; + A115B5008CF451B35F620342D180CF27 /* SwipeCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23024183045FAC608C3F116796C0BA7A /* SwipeCollectionViewCell.swift */; }; + AA5B00A30C11CFA245802DBCAB39EA0E /* SwipeCollectionViewCell+Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 804BBB327B33EE0E2BFC5E678EF74BD1 /* SwipeCollectionViewCell+Accessibility.swift */; }; + AD23D515CC571991AAD81D432540363B /* SwipeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E70684FF0C74D51A16C7D2C652AD0649 /* SwipeTableViewCell.swift */; }; + AE59517F1AB32B208AFD49FB4990B99C /* Pods-TestALTableView-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = DD898B1F223B78BEF914C1F4CA39EA11 /* Pods-TestALTableView-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B30B36DCE3ECA1DF76721D15601BFCB1 /* SwipeTransitionLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFC6DC25A614C54ADF1BBD2FD0566A5D /* SwipeTransitionLayout.swift */; }; + B98E11D082D108F5770AF38FD9F93DC6 /* Pods-TestALTableView-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 97D02FF507439D9805A7BEA22229C1F2 /* Pods-TestALTableView-dummy.m */; }; + CAE6E362C76387F87DC8A5C775729DF0 /* SwipeTableViewCell+Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EBAE04DEF0695F29D8B0BA52A4685E4 /* SwipeTableViewCell+Accessibility.swift */; }; + D1CBFDF4C75E35EE9D4EA0FB7441C1AF /* SwipeAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E15CD5EF99AAD2E96EC791213FE621F /* SwipeAction.swift */; }; + DD0105DF7E7ACB22E7236D73D9C332C7 /* SwipeCellKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 54DBECC9C72FAC59DC6BA752B4AAE1C6 /* SwipeCellKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E88C2ECC8AE24B0ECD310953598F877C /* Pods-ALTableViewTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EAD3F5BE26ACFA9CB2C3D57859F28C4C /* Pods-ALTableViewTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E9F12E04E0A0641566B51DEDC1993EB5 /* SwipeActionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DC63E696A60DDE081BD3EC8E90EFE4 /* SwipeActionsView.swift */; }; + F7E819825F96394C8F8578DAB86E3D18 /* SwipeOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A0F166173353E13F6F5C99A6A347B1 /* SwipeOptions.swift */; }; + F854655F5BD0904E44E34319BE7BA00B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A16F4CFC63FAC439D7A04994F579A03 /* Foundation.framework */; }; + FE5C0668963FD13FB26FE95F555FFE1B /* Pods-ALTableViewTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 967188619D0A4F10CD6A3EB849D47E09 /* Pods-ALTableViewTests-dummy.m */; }; + FEDC03DDB1F2AC128FC70EFB53BA38F5 /* Pods-ALTableView-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2687CDBD31E918BA983A674A4CE81B1A /* Pods-ALTableView-dummy.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 70BDE92CC3BB932B4859D43F173F6A83 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = E7A614404BD7188AC4129765BF7BDE5A; + remoteInfo = "Pods-ALTableView"; + }; + B1DD966FCDE3D18DF67F519FF540EADA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = B9F71D7E9E2043F7DBC166840755C36B; + remoteInfo = SwipeCellKit; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 007F19C5F220CADECB7B31472310EEB4 /* Pods-ALTableViewTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-ALTableViewTests-acknowledgements.plist"; sourceTree = ""; }; 01CD16F3EB0FDC7A7CE13B2E54AE042D /* Pods-TestALTableView.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-TestALTableView.modulemap"; sourceTree = ""; }; 01F687E78D5127CE527641F7B0C865BA /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 08A45AF5E3025FA01A7F1C0224C76DBA /* SwipeCellKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwipeCellKit-prefix.pch"; sourceTree = ""; }; + 0A4F44480E114A41B07C11FFBC94B6BD /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 16ED62C4710E7076D67DB36EF946C0FC /* Pods-ALTableViewTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-ALTableViewTests-acknowledgements.markdown"; sourceTree = ""; }; 193765CA53AF1BEF89157D70EC6AEAA7 /* Pods-ALTableView-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-ALTableView-umbrella.h"; sourceTree = ""; }; - 20D16A866A1AB3E82DBB6708B21B65B0 /* Pods_TestALTableView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_TestALTableView.framework; path = "Pods-TestALTableView.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1D26CDCF75B782E07A07DD3252E3E380 /* SwipeTableViewCell+Display.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SwipeTableViewCell+Display.swift"; path = "Source/SwipeTableViewCell+Display.swift"; sourceTree = ""; }; 21B22BA8E525A652324FACD4839EF515 /* Pods-TestALTableView.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-TestALTableView.release.xcconfig"; sourceTree = ""; }; - 264F1069FF39040055A39C7513E63641 /* Pods_ALTableViewTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_ALTableViewTests.framework; path = "Pods-ALTableViewTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 22239ADDB87FAD1706C881FFC570A8DC /* SwipeCollectionViewCell+Display.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SwipeCollectionViewCell+Display.swift"; path = "Source/SwipeCollectionViewCell+Display.swift"; sourceTree = ""; }; + 23024183045FAC608C3F116796C0BA7A /* SwipeCollectionViewCell.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeCollectionViewCell.swift; path = Source/SwipeCollectionViewCell.swift; sourceTree = ""; }; 2687CDBD31E918BA983A674A4CE81B1A /* Pods-ALTableView-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-ALTableView-dummy.m"; sourceTree = ""; }; + 354361ED084775926B8EF62B670FAEA8 /* SwipeActionTransitioning.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeActionTransitioning.swift; path = Source/SwipeActionTransitioning.swift; sourceTree = ""; }; + 35A8FA6DBCC9AE6059B1AA0B4F1AF277 /* SwipeCellKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SwipeCellKit-dummy.m"; sourceTree = ""; }; + 36EBCE0AED5326CE7655D30423044E26 /* Pods_ALTableView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_ALTableView.framework; path = "Pods-ALTableView.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4113D3C18FCC326736C158562FDC6FC4 /* Swipeable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Swipeable.swift; path = Source/Swipeable.swift; sourceTree = ""; }; + 451A3E436326FE42C11AAD7774A7EAB8 /* SwipeCellKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwipeCellKit.modulemap; sourceTree = ""; }; 45E8547E8AB00D77600768A206CCBBE7 /* Pods-TestALTableView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-TestALTableView.debug.xcconfig"; sourceTree = ""; }; + 4E15CD5EF99AAD2E96EC791213FE621F /* SwipeAction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeAction.swift; path = Source/SwipeAction.swift; sourceTree = ""; }; + 4EBAE04DEF0695F29D8B0BA52A4685E4 /* SwipeTableViewCell+Accessibility.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SwipeTableViewCell+Accessibility.swift"; path = "Source/SwipeTableViewCell+Accessibility.swift"; sourceTree = ""; }; + 501214F2ED32E9BADB553439DE8E29BF /* SwipeCellKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwipeCellKit.xcconfig; sourceTree = ""; }; + 51A6227A6EADAA070CBCC292864D3E43 /* SwipeCellKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwipeCellKit.framework; path = SwipeCellKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 54DBECC9C72FAC59DC6BA752B4AAE1C6 /* SwipeCellKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwipeCellKit-umbrella.h"; sourceTree = ""; }; 57FAE6E3BBE22C89F6B82C687407F7AE /* Pods-ALTableView-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-ALTableView-acknowledgements.markdown"; sourceTree = ""; }; - 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 5A16F4CFC63FAC439D7A04994F579A03 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 6E375A04BFA50856601362052FC1A0B7 /* Pods-ALTableView.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-ALTableView.modulemap"; sourceTree = ""; }; 73844C70D7212B1F54C3D69768465966 /* Pods-ALTableView.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-ALTableView.release.xcconfig"; sourceTree = ""; }; + 76E5CF45D2D750123BB078EB7B375B0E /* SwipeFeedback.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeFeedback.swift; path = Source/SwipeFeedback.swift; sourceTree = ""; }; 78802938915E11AD0D6AE9C556DECAB2 /* Pods-TestALTableView-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-TestALTableView-acknowledgements.plist"; sourceTree = ""; }; + 7C0C9D5ADE765E39BC0BB6AF105B9D00 /* SwipeCollectionViewCellDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeCollectionViewCellDelegate.swift; path = Source/SwipeCollectionViewCellDelegate.swift; sourceTree = ""; }; 7DEEFBEBD54A9805B6B6DD5219189BD2 /* Pods-ALTableViewTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-ALTableViewTests.release.xcconfig"; sourceTree = ""; }; + 804BBB327B33EE0E2BFC5E678EF74BD1 /* SwipeCollectionViewCell+Accessibility.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SwipeCollectionViewCell+Accessibility.swift"; path = "Source/SwipeCollectionViewCell+Accessibility.swift"; sourceTree = ""; }; + 812F14738E47DFACA7EF95849DD65FD5 /* SwipeExpanding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeExpanding.swift; path = Source/SwipeExpanding.swift; sourceTree = ""; }; 83B89FFD1A96FBEE2402C563B36990AF /* Pods-ALTableViewTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-ALTableViewTests-resources.sh"; sourceTree = ""; }; + 85DC63E696A60DDE081BD3EC8E90EFE4 /* SwipeActionsView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeActionsView.swift; path = Source/SwipeActionsView.swift; sourceTree = ""; }; 866C2D78F3450C7CCD0CF0F707498CB5 /* Pods-ALTableView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-ALTableView.debug.xcconfig"; sourceTree = ""; }; 86C7C73ABE278B56B6163C340FF88586 /* Pods-ALTableViewTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-ALTableViewTests.debug.xcconfig"; sourceTree = ""; }; + 90DBCEC68E5B0D9DEC6360F0DBD4F824 /* Pods_TestALTableView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_TestALTableView.framework; path = "Pods-TestALTableView.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 90E70CA1D5967247AF89250DAA129217 /* Pods-TestALTableView-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-TestALTableView-resources.sh"; sourceTree = ""; }; 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 967188619D0A4F10CD6A3EB849D47E09 /* Pods-ALTableViewTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-ALTableViewTests-dummy.m"; sourceTree = ""; }; @@ -45,44 +106,93 @@ 9A610C940B19D3DFF071DD11DE40B802 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A4261D92E1A80F28E06D3B1825F96FE8 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A60CFF31243575E80FCF59FF486A262B /* Pods-TestALTableView-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-TestALTableView-frameworks.sh"; sourceTree = ""; }; + AE5A071C7C958FD624A3FDAFF42C027A /* Pods_ALTableViewTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_ALTableViewTests.framework; path = "Pods-ALTableViewTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; B632A8320E33DD4491A076A5AC34A684 /* Pods-TestALTableView-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-TestALTableView-acknowledgements.markdown"; sourceTree = ""; }; BCBAF0357DA80EB33541E870B6F06028 /* Pods-ALTableView-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-ALTableView-acknowledgements.plist"; sourceTree = ""; }; + C4081885FB3D652A5406B4A431098BDE /* SwipeController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeController.swift; path = Source/SwipeController.swift; sourceTree = ""; }; C427B80433C059E2C83CBA9B4347F3E1 /* Pods-ALTableViewTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-ALTableViewTests-frameworks.sh"; sourceTree = ""; }; + C5D152118CFC9042FFE718E60238BFC5 /* SwipeExpansionStyle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeExpansionStyle.swift; path = Source/SwipeExpansionStyle.swift; sourceTree = ""; }; + C7AAEA5B5D2785C87FB2253913E686ED /* Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = Source/Extensions.swift; sourceTree = ""; }; + CADFA09C7B4A9C06F2AACF4FDFF0F802 /* SwipeTableViewCellDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeTableViewCellDelegate.swift; path = Source/SwipeTableViewCellDelegate.swift; sourceTree = ""; }; D97B0A6A1E6ED4FF16D3658784D1D0F3 /* Pods-ALTableView-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-ALTableView-resources.sh"; sourceTree = ""; }; DD898B1F223B78BEF914C1F4CA39EA11 /* Pods-TestALTableView-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-TestALTableView-umbrella.h"; sourceTree = ""; }; E4D4894D401AE96F2F1D21C70DB06A7C /* Pods-ALTableViewTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-ALTableViewTests.modulemap"; sourceTree = ""; }; - E8B24AA3BF5E0D8AC9E6D188F36DDA7E /* Pods_ALTableView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_ALTableView.framework; path = "Pods-ALTableView.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + E5A0F166173353E13F6F5C99A6A347B1 /* SwipeOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeOptions.swift; path = Source/SwipeOptions.swift; sourceTree = ""; }; + E5B3F853018F6E95992B4E07CA890613 /* SwipeActionButton.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeActionButton.swift; path = Source/SwipeActionButton.swift; sourceTree = ""; }; + E70684FF0C74D51A16C7D2C652AD0649 /* SwipeTableViewCell.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeTableViewCell.swift; path = Source/SwipeTableViewCell.swift; sourceTree = ""; }; + EA003A20C3527387C3A39C3452761A1D /* SwipeAnimator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeAnimator.swift; path = Source/SwipeAnimator.swift; sourceTree = ""; }; EAD3F5BE26ACFA9CB2C3D57859F28C4C /* Pods-ALTableViewTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-ALTableViewTests-umbrella.h"; sourceTree = ""; }; + EFC6DC25A614C54ADF1BBD2FD0566A5D /* SwipeTransitionLayout.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeTransitionLayout.swift; path = Source/SwipeTransitionLayout.swift; sourceTree = ""; }; + F2A2C78F90E62D4C6758DE64D2D771F0 /* SwipeAccessibilityCustomAction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwipeAccessibilityCustomAction.swift; path = Source/SwipeAccessibilityCustomAction.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 3BFCE0A9B1F87F7EC54443E4FE560C68 /* Frameworks */ = { + 2E78AAE9B3A32E72EA6351548F94B4CC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4D47F4EB2A4A2FA0233CCFD1AA06E036 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6AD2A3A6E9E3373655C6E4F6E60BC6B5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A3C1BFD6D294FF261CCA31025B37EB8A /* Foundation.framework in Frameworks */, + 5FFF57CA7D1A216E8164F168717242A7 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - B78E6DD1F79184E2E6D2136571892D4A /* Frameworks */ = { + 8700F2D083BC9325EB1064AFCF3CFF9F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AD641DA54B9038AAF0718D18A4297473 /* Foundation.framework in Frameworks */, + F854655F5BD0904E44E34319BE7BA00B /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - FB1C483A71E9637EED9D2071E4AE642D /* Frameworks */ = { + ED328827E5016C8394DBC43F6F723B29 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 92E9AFA847B2F9F1ADBDBFC176D7448A /* Foundation.framework in Frameworks */, + 929F3B64B213BE671427B1FCFEFF928B /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 03E3D2981BD7A7A79DA075AC890A9384 /* SwipeCellKit */ = { + isa = PBXGroup; + children = ( + C7AAEA5B5D2785C87FB2253913E686ED /* Extensions.swift */, + 4113D3C18FCC326736C158562FDC6FC4 /* Swipeable.swift */, + F2A2C78F90E62D4C6758DE64D2D771F0 /* SwipeAccessibilityCustomAction.swift */, + 4E15CD5EF99AAD2E96EC791213FE621F /* SwipeAction.swift */, + E5B3F853018F6E95992B4E07CA890613 /* SwipeActionButton.swift */, + 85DC63E696A60DDE081BD3EC8E90EFE4 /* SwipeActionsView.swift */, + 354361ED084775926B8EF62B670FAEA8 /* SwipeActionTransitioning.swift */, + EA003A20C3527387C3A39C3452761A1D /* SwipeAnimator.swift */, + 23024183045FAC608C3F116796C0BA7A /* SwipeCollectionViewCell.swift */, + 804BBB327B33EE0E2BFC5E678EF74BD1 /* SwipeCollectionViewCell+Accessibility.swift */, + 22239ADDB87FAD1706C881FFC570A8DC /* SwipeCollectionViewCell+Display.swift */, + 7C0C9D5ADE765E39BC0BB6AF105B9D00 /* SwipeCollectionViewCellDelegate.swift */, + C4081885FB3D652A5406B4A431098BDE /* SwipeController.swift */, + 812F14738E47DFACA7EF95849DD65FD5 /* SwipeExpanding.swift */, + C5D152118CFC9042FFE718E60238BFC5 /* SwipeExpansionStyle.swift */, + 76E5CF45D2D750123BB078EB7B375B0E /* SwipeFeedback.swift */, + E5A0F166173353E13F6F5C99A6A347B1 /* SwipeOptions.swift */, + E70684FF0C74D51A16C7D2C652AD0649 /* SwipeTableViewCell.swift */, + 4EBAE04DEF0695F29D8B0BA52A4685E4 /* SwipeTableViewCell+Accessibility.swift */, + 1D26CDCF75B782E07A07DD3252E3E380 /* SwipeTableViewCell+Display.swift */, + CADFA09C7B4A9C06F2AACF4FDFF0F802 /* SwipeTableViewCellDelegate.swift */, + EFC6DC25A614C54ADF1BBD2FD0566A5D /* SwipeTransitionLayout.swift */, + 2C55A9837D6C18B513716D0C672AC8B6 /* Support Files */, + ); + name = SwipeCellKit; + path = SwipeCellKit; + sourceTree = ""; + }; 24D40FA3632DB98731793434C8E1D4CB /* Pods-ALTableViewTests */ = { isa = PBXGroup; children = ( @@ -101,6 +211,20 @@ path = "Target Support Files/Pods-ALTableViewTests"; sourceTree = ""; }; + 2C55A9837D6C18B513716D0C672AC8B6 /* Support Files */ = { + isa = PBXGroup; + children = ( + 0A4F44480E114A41B07C11FFBC94B6BD /* Info.plist */, + 451A3E436326FE42C11AAD7774A7EAB8 /* SwipeCellKit.modulemap */, + 501214F2ED32E9BADB553439DE8E29BF /* SwipeCellKit.xcconfig */, + 35A8FA6DBCC9AE6059B1AA0B4F1AF277 /* SwipeCellKit-dummy.m */, + 08A45AF5E3025FA01A7F1C0224C76DBA /* SwipeCellKit-prefix.pch */, + 54DBECC9C72FAC59DC6BA752B4AAE1C6 /* SwipeCellKit-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/SwipeCellKit"; + sourceTree = ""; + }; 5918EF8E44FA6DB9469BD166F81BC4F7 /* Pods-TestALTableView */ = { isa = PBXGroup; children = ( @@ -119,6 +243,14 @@ path = "Target Support Files/Pods-TestALTableView"; sourceTree = ""; }; + 5E0D919E635D23B70123790B8308F8EF /* iOS */ = { + isa = PBXGroup; + children = ( + 5A16F4CFC63FAC439D7A04994F579A03 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; 635DDF57676A1B129F10F59DCE6251B6 /* Targets Support Files */ = { isa = PBXGroup; children = ( @@ -129,12 +261,21 @@ name = "Targets Support Files"; sourceTree = ""; }; + 681CC403AA064C99FB621D3F38F8F554 /* Pods */ = { + isa = PBXGroup; + children = ( + 03E3D2981BD7A7A79DA075AC890A9384 /* SwipeCellKit */, + ); + name = Pods; + sourceTree = ""; + }; 7DB346D0F39D3F0E887471402A8071AB = { isa = PBXGroup; children = ( 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, - A5F333DF13D2F1D36A7DB126BCCFF2F4 /* Products */, + 681CC403AA064C99FB621D3F38F8F554 /* Pods */, + CF0BE824E92CB3B5296C522C9D2AC01B /* Products */, 635DDF57676A1B129F10F59DCE6251B6 /* Targets Support Files */, ); sourceTree = ""; @@ -156,111 +297,135 @@ path = "Target Support Files/Pods-ALTableView"; sourceTree = ""; }; - A5F333DF13D2F1D36A7DB126BCCFF2F4 /* Products */ = { - isa = PBXGroup; - children = ( - E8B24AA3BF5E0D8AC9E6D188F36DDA7E /* Pods_ALTableView.framework */, - 264F1069FF39040055A39C7513E63641 /* Pods_ALTableViewTests.framework */, - 20D16A866A1AB3E82DBB6708B21B65B0 /* Pods_TestALTableView.framework */, - ); - name = Products; - sourceTree = ""; - }; BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { isa = PBXGroup; children = ( - D35AF013A5F0BAD4F32504907A52519E /* iOS */, + 5E0D919E635D23B70123790B8308F8EF /* iOS */, ); name = Frameworks; sourceTree = ""; }; - D35AF013A5F0BAD4F32504907A52519E /* iOS */ = { + CF0BE824E92CB3B5296C522C9D2AC01B /* Products */ = { isa = PBXGroup; children = ( - 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */, + 36EBCE0AED5326CE7655D30423044E26 /* Pods_ALTableView.framework */, + AE5A071C7C958FD624A3FDAFF42C027A /* Pods_ALTableViewTests.framework */, + 90DBCEC68E5B0D9DEC6360F0DBD4F824 /* Pods_TestALTableView.framework */, + 51A6227A6EADAA070CBCC292864D3E43 /* SwipeCellKit.framework */, ); - name = iOS; + name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 39D19D584636E2A4235ABED38B9942C3 /* Headers */ = { + 23FD781223C3C9B0A3D1D3F9F742485C /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 5B560DBC8077686BA0438CE3616DB282 /* Pods-TestALTableView-umbrella.h in Headers */, + AE59517F1AB32B208AFD49FB4990B99C /* Pods-TestALTableView-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 3A5D3EC1923A599CBA2F7B28725C7B22 /* Headers */ = { + 674D9EE54B1A4C2191F9DA98B4913F8E /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - C7F0767804EE5497280F0F47140A0F34 /* Pods-ALTableViewTests-umbrella.h in Headers */, + 421918D88AEE3B97A81B496E84A2CECE /* Pods-ALTableView-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - A587EFD8463E93360DA9C4A1908C0D0C /* Headers */ = { + 6BCF434ADB21A831CA3F50784D143EEB /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 3D0B5A7E86517B46BD96F8D5496FEF0A /* Pods-ALTableView-umbrella.h in Headers */, + E88C2ECC8AE24B0ECD310953598F877C /* Pods-ALTableViewTests-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 725F233007E52576EC57B8ABD4FE9DE2 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + DD0105DF7E7ACB22E7236D73D9C332C7 /* SwipeCellKit-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 00E567186B5E9BBD8B75CC28ADAECF62 /* Pods-TestALTableView */ = { + 683F596421617833C662BB2548A663C6 /* Pods-ALTableViewTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 6553FB7C9E9D87F79E88583F807BBE2E /* Build configuration list for PBXNativeTarget "Pods-TestALTableView" */; + buildConfigurationList = 5F11F823CEF9F6B99B750EEC4171527E /* Build configuration list for PBXNativeTarget "Pods-ALTableViewTests" */; buildPhases = ( - 2BB4107440601E916FDF807E8482D86D /* Sources */, - B78E6DD1F79184E2E6D2136571892D4A /* Frameworks */, - 39D19D584636E2A4235ABED38B9942C3 /* Headers */, + 6BCF434ADB21A831CA3F50784D143EEB /* Headers */, + A4260F3D136283FB485FAF776F3E9D95 /* Sources */, + 6AD2A3A6E9E3373655C6E4F6E60BC6B5 /* Frameworks */, + E041551CD51750790EF79DA1C852740D /* Resources */, ); buildRules = ( ); dependencies = ( + 3113B37DE33676465F098795DE536E7A /* PBXTargetDependency */, ); - name = "Pods-TestALTableView"; - productName = "Pods-TestALTableView"; - productReference = 20D16A866A1AB3E82DBB6708B21B65B0 /* Pods_TestALTableView.framework */; + name = "Pods-ALTableViewTests"; + productName = "Pods-ALTableViewTests"; + productReference = AE5A071C7C958FD624A3FDAFF42C027A /* Pods_ALTableViewTests.framework */; productType = "com.apple.product-type.framework"; }; - 9ACBC670A8DA89C3FC1AB5CD2A2D9115 /* Pods-ALTableView */ = { + B9F71D7E9E2043F7DBC166840755C36B /* SwipeCellKit */ = { isa = PBXNativeTarget; - buildConfigurationList = 00ED86C2E784E3E2BC6B94EA8DE9A021 /* Build configuration list for PBXNativeTarget "Pods-ALTableView" */; + buildConfigurationList = 25DB504AE88F4721F9D5AAB1C779AE1C /* Build configuration list for PBXNativeTarget "SwipeCellKit" */; buildPhases = ( - 8F7867AC7D38DADB4778D72EAE11ED5B /* Sources */, - 3BFCE0A9B1F87F7EC54443E4FE560C68 /* Frameworks */, - A587EFD8463E93360DA9C4A1908C0D0C /* Headers */, + 725F233007E52576EC57B8ABD4FE9DE2 /* Headers */, + A64844194129D0EEE8AD7A90D65EA0CE /* Sources */, + 8700F2D083BC9325EB1064AFCF3CFF9F /* Frameworks */, + CA97602B4FDE37B4CB194E46A61651CC /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = "Pods-ALTableView"; - productName = "Pods-ALTableView"; - productReference = E8B24AA3BF5E0D8AC9E6D188F36DDA7E /* Pods_ALTableView.framework */; + name = SwipeCellKit; + productName = SwipeCellKit; + productReference = 51A6227A6EADAA070CBCC292864D3E43 /* SwipeCellKit.framework */; productType = "com.apple.product-type.framework"; }; - BDAF8CDD819045043AB76E1DBABEEB48 /* Pods-ALTableViewTests */ = { + C24FC38AC8DABA2D3150BEE623195F85 /* Pods-TestALTableView */ = { isa = PBXNativeTarget; - buildConfigurationList = 7A22B56DA0D28D6B89179762BA3CE6A7 /* Build configuration list for PBXNativeTarget "Pods-ALTableViewTests" */; + buildConfigurationList = FB2B43105785D7E87C88111DFB8EB4F5 /* Build configuration list for PBXNativeTarget "Pods-TestALTableView" */; buildPhases = ( - 92C6668FC788690834A4174895594066 /* Sources */, - FB1C483A71E9637EED9D2071E4AE642D /* Frameworks */, - 3A5D3EC1923A599CBA2F7B28725C7B22 /* Headers */, + 23FD781223C3C9B0A3D1D3F9F742485C /* Headers */, + ED1C3D449576F2F245B02A80CB57A3C3 /* Sources */, + 2E78AAE9B3A32E72EA6351548F94B4CC /* Frameworks */, + CF3C60A90A0F743BFB0668F9BB4E2FBF /* Resources */, ); buildRules = ( ); dependencies = ( + C59E0FCDAF9A38043BFCF3F987E219A8 /* PBXTargetDependency */, ); - name = "Pods-ALTableViewTests"; - productName = "Pods-ALTableViewTests"; - productReference = 264F1069FF39040055A39C7513E63641 /* Pods_ALTableViewTests.framework */; + name = "Pods-TestALTableView"; + productName = "Pods-TestALTableView"; + productReference = 90DBCEC68E5B0D9DEC6360F0DBD4F824 /* Pods_TestALTableView.framework */; + productType = "com.apple.product-type.framework"; + }; + E7A614404BD7188AC4129765BF7BDE5A /* Pods-ALTableView */ = { + isa = PBXNativeTarget; + buildConfigurationList = AB3C4BA897A14139D6A6CD65F6484D22 /* Build configuration list for PBXNativeTarget "Pods-ALTableView" */; + buildPhases = ( + 674D9EE54B1A4C2191F9DA98B4913F8E /* Headers */, + 0D118295D9B69E3B20E7A2A38D663AA2 /* Sources */, + ED328827E5016C8394DBC43F6F723B29 /* Frameworks */, + 74900BBB737E7764F515F6C8C0FC6187 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Pods-ALTableView"; + productName = "Pods-ALTableView"; + productReference = 36EBCE0AED5326CE7655D30423044E26 /* Pods_ALTableView.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -280,46 +445,197 @@ en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; - productRefGroup = A5F333DF13D2F1D36A7DB126BCCFF2F4 /* Products */; + productRefGroup = CF0BE824E92CB3B5296C522C9D2AC01B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 9ACBC670A8DA89C3FC1AB5CD2A2D9115 /* Pods-ALTableView */, - BDAF8CDD819045043AB76E1DBABEEB48 /* Pods-ALTableViewTests */, - 00E567186B5E9BBD8B75CC28ADAECF62 /* Pods-TestALTableView */, + E7A614404BD7188AC4129765BF7BDE5A /* Pods-ALTableView */, + 683F596421617833C662BB2548A663C6 /* Pods-ALTableViewTests */, + C24FC38AC8DABA2D3150BEE623195F85 /* Pods-TestALTableView */, + B9F71D7E9E2043F7DBC166840755C36B /* SwipeCellKit */, ); }; /* End PBXProject section */ +/* Begin PBXResourcesBuildPhase section */ + 74900BBB737E7764F515F6C8C0FC6187 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CA97602B4FDE37B4CB194E46A61651CC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CF3C60A90A0F743BFB0668F9BB4E2FBF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E041551CD51750790EF79DA1C852740D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ - 2BB4107440601E916FDF807E8482D86D /* Sources */ = { + 0D118295D9B69E3B20E7A2A38D663AA2 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - EE11EB7D3947D8A14C912A3E0C87C596 /* Pods-TestALTableView-dummy.m in Sources */, + FEDC03DDB1F2AC128FC70EFB53BA38F5 /* Pods-ALTableView-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 8F7867AC7D38DADB4778D72EAE11ED5B /* Sources */ = { + A4260F3D136283FB485FAF776F3E9D95 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8E3C0B5704BE96C238B6717E7A4FA630 /* Pods-ALTableView-dummy.m in Sources */, + FE5C0668963FD13FB26FE95F555FFE1B /* Pods-ALTableViewTests-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 92C6668FC788690834A4174895594066 /* Sources */ = { + A64844194129D0EEE8AD7A90D65EA0CE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - A6842107B998A260B55DE5A279B40408 /* Pods-ALTableViewTests-dummy.m in Sources */, + 38ABFA35A32D36CDB99F3859077FF1A6 /* Extensions.swift in Sources */, + 4400A34B5F8164147E830FCA8BC92828 /* Swipeable.swift in Sources */, + 213344D4B8669E875D5B639BC1231B5A /* SwipeAccessibilityCustomAction.swift in Sources */, + D1CBFDF4C75E35EE9D4EA0FB7441C1AF /* SwipeAction.swift in Sources */, + 719D5FF8DB409ED7CC62AF08233B8325 /* SwipeActionButton.swift in Sources */, + E9F12E04E0A0641566B51DEDC1993EB5 /* SwipeActionsView.swift in Sources */, + 917C4AF08A5D33195C556C671A010E04 /* SwipeActionTransitioning.swift in Sources */, + 095E8D6D0FCBFCB00AEFA2DEEDF12B71 /* SwipeAnimator.swift in Sources */, + 9A207AC03784F6B200AD409C639FF4EE /* SwipeCellKit-dummy.m in Sources */, + AA5B00A30C11CFA245802DBCAB39EA0E /* SwipeCollectionViewCell+Accessibility.swift in Sources */, + 3AAF5B90D53B071454F50365DC98DB24 /* SwipeCollectionViewCell+Display.swift in Sources */, + A115B5008CF451B35F620342D180CF27 /* SwipeCollectionViewCell.swift in Sources */, + 50AF56E2B8B1F5D1E498E7BD113320CF /* SwipeCollectionViewCellDelegate.swift in Sources */, + 665EF7DDA41444FC4EB5B91AB0D059CB /* SwipeController.swift in Sources */, + 99FCCC0959E68A39B8CF962EEE5D633C /* SwipeExpanding.swift in Sources */, + 9BA3CD99DF4F7C1552CA93F4C5C4653B /* SwipeExpansionStyle.swift in Sources */, + 1D8B1AE6E9AB0600B03650C6BAFA2F24 /* SwipeFeedback.swift in Sources */, + F7E819825F96394C8F8578DAB86E3D18 /* SwipeOptions.swift in Sources */, + CAE6E362C76387F87DC8A5C775729DF0 /* SwipeTableViewCell+Accessibility.swift in Sources */, + 6F28DA892CA314A0D85D7BB08FFC04A5 /* SwipeTableViewCell+Display.swift in Sources */, + AD23D515CC571991AAD81D432540363B /* SwipeTableViewCell.swift in Sources */, + 6E130C15438AA644ABFB2DADA461186D /* SwipeTableViewCellDelegate.swift in Sources */, + B30B36DCE3ECA1DF76721D15601BFCB1 /* SwipeTransitionLayout.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ED1C3D449576F2F245B02A80CB57A3C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B98E11D082D108F5770AF38FD9F93DC6 /* Pods-TestALTableView-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 3113B37DE33676465F098795DE536E7A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Pods-ALTableView"; + target = E7A614404BD7188AC4129765BF7BDE5A /* Pods-ALTableView */; + targetProxy = 70BDE92CC3BB932B4859D43F173F6A83 /* PBXContainerItemProxy */; + }; + C59E0FCDAF9A38043BFCF3F987E219A8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SwipeCellKit; + target = B9F71D7E9E2043F7DBC166840755C36B /* SwipeCellKit */; + targetProxy = B1DD966FCDE3D18DF67F519FF540EADA /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ - 26F954BA177A9A46FFFD4E23ED11D67A /* Release */ = { + 043D418830EF07E955A5591744B88D6F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 501214F2ED32E9BADB553439DE8E29BF /* SwipeCellKit.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SwipeCellKit/SwipeCellKit-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SwipeCellKit/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SwipeCellKit/SwipeCellKit.modulemap"; + PRODUCT_MODULE_NAME = SwipeCellKit; + PRODUCT_NAME = SwipeCellKit; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 2C270B9887BFBE343EE8D5B460C1BCB6 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 73844C70D7212B1F54C3D69768465966 /* Pods-ALTableView.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-ALTableView/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-ALTableView/Pods-ALTableView.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 60DAF49CA7A9F362148D49C3C3123B2A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -351,15 +667,19 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_ALLOWED = NO; CODE_SIGNING_REQUIRED = NO; COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; + DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=1", + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -369,50 +689,21 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SYMROOT = "${SRCROOT}/../build"; }; - name = Release; - }; - 4434A7CB1FFE35A9C21E7CA6139E2B8F /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 866C2D78F3450C7CCD0CF0F707498CB5 /* Pods-ALTableView.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-ALTableView/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-ALTableView/Pods-ALTableView.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_ALTableView; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; name = Debug; }; - 70A8A342D58A748EF6D712734F08453E /* Debug */ = { + 62480D73BBA5AD65A8658CADFC7F587F /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 45E8547E8AB00D77600768A206CCBBE7 /* Pods-TestALTableView.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -425,26 +716,33 @@ INFOPLIST_FILE = "Target Support Files/Pods-TestALTableView/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-TestALTableView/Pods-TestALTableView.modulemap"; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_TestALTableView; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 85867FA5E694E2E954D5248A6B9967E2 /* Release */ = { + 74F7F1F226644D8F6A2F8EFD94721820 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 73844C70D7212B1F54C3D69768465966 /* Pods-ALTableView.release.xcconfig */; + baseConfigurationReference = 21B22BA8E525A652324FACD4839EF515 /* Pods-TestALTableView.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -454,19 +752,25 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-ALTableView/Info.plist"; + INFOPLIST_FILE = "Target Support Files/Pods-TestALTableView/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-ALTableView/Pods-ALTableView.modulemap"; + MODULEMAP_FILE = "Target Support Files/Pods-TestALTableView/Pods-TestALTableView.modulemap"; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_ALTableView; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -474,10 +778,11 @@ }; name = Release; }; - A5C5126DED695AEB1F76DC7F254CDB89 /* Debug */ = { + 8F19602818DD5C8C37DEB62206288650 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 86C7C73ABE278B56B6163C340FF88586 /* Pods-ALTableViewTests.debug.xcconfig */; + baseConfigurationReference = 7DEEFBEBD54A9805B6B6DD5219189BD2 /* Pods-ALTableViewTests.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -490,26 +795,32 @@ INFOPLIST_FILE = "Target Support Files/Pods-ALTableViewTests/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests.modulemap"; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_ALTableViewTests; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; - C775B24DFE05EE1692673EA6D25AE700 /* Release */ = { + BAAE417611EDFF2A8848ABB8FCE209C4 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 21B22BA8E525A652324FACD4839EF515 /* Pods-TestALTableView.release.xcconfig */; + baseConfigurationReference = 866C2D78F3450C7CCD0CF0F707498CB5 /* Pods-ALTableView.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -519,27 +830,30 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-TestALTableView/Info.plist"; + INFOPLIST_FILE = "Target Support Files/Pods-ALTableView/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-TestALTableView/Pods-TestALTableView.modulemap"; + MODULEMAP_FILE = "Target Support Files/Pods-ALTableView/Pods-ALTableView.modulemap"; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_TestALTableView; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; - E2BF6D6731C31DE69900B7B24E6F0445 /* Debug */ = { + C4EAA84F44D044E108500A81C635F21E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -571,18 +885,16 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_ALLOWED = NO; CODE_SIGNING_REQUIRED = NO; COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", + "POD_CONFIGURATION_RELEASE=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -592,20 +904,19 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SYMROOT = "${SRCROOT}/../build"; }; - name = Debug; + name = Release; }; - E9CF497A28B47D745A51C1C82351C68F /* Release */ = { + E5CCC796CECF9DDE2B8E7095E041317F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7DEEFBEBD54A9805B6B6DD5219189BD2 /* Pods-ALTableViewTests.release.xcconfig */; + baseConfigurationReference = 86C7C73ABE278B56B6163C340FF88586 /* Pods-ALTableViewTests.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -618,17 +929,58 @@ INFOPLIST_FILE = "Target Support Files/Pods-ALTableViewTests/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests.modulemap"; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_ALTableViewTests; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + F3B5403FED35B3BA058A95F2E57FC908 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 501214F2ED32E9BADB553439DE8E29BF /* SwipeCellKit.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SwipeCellKit/SwipeCellKit-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SwipeCellKit/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SwipeCellKit/SwipeCellKit.modulemap"; + PRODUCT_MODULE_NAME = SwipeCellKit; + PRODUCT_NAME = SwipeCellKit; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -638,11 +990,11 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 00ED86C2E784E3E2BC6B94EA8DE9A021 /* Build configuration list for PBXNativeTarget "Pods-ALTableView" */ = { + 25DB504AE88F4721F9D5AAB1C779AE1C /* Build configuration list for PBXNativeTarget "SwipeCellKit" */ = { isa = XCConfigurationList; buildConfigurations = ( - 4434A7CB1FFE35A9C21E7CA6139E2B8F /* Debug */, - 85867FA5E694E2E954D5248A6B9967E2 /* Release */, + 043D418830EF07E955A5591744B88D6F /* Debug */, + F3B5403FED35B3BA058A95F2E57FC908 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -650,26 +1002,35 @@ 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - E2BF6D6731C31DE69900B7B24E6F0445 /* Debug */, - 26F954BA177A9A46FFFD4E23ED11D67A /* Release */, + 60DAF49CA7A9F362148D49C3C3123B2A /* Debug */, + C4EAA84F44D044E108500A81C635F21E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5F11F823CEF9F6B99B750EEC4171527E /* Build configuration list for PBXNativeTarget "Pods-ALTableViewTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E5CCC796CECF9DDE2B8E7095E041317F /* Debug */, + 8F19602818DD5C8C37DEB62206288650 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 6553FB7C9E9D87F79E88583F807BBE2E /* Build configuration list for PBXNativeTarget "Pods-TestALTableView" */ = { + AB3C4BA897A14139D6A6CD65F6484D22 /* Build configuration list for PBXNativeTarget "Pods-ALTableView" */ = { isa = XCConfigurationList; buildConfigurations = ( - 70A8A342D58A748EF6D712734F08453E /* Debug */, - C775B24DFE05EE1692673EA6D25AE700 /* Release */, + BAAE417611EDFF2A8848ABB8FCE209C4 /* Debug */, + 2C270B9887BFBE343EE8D5B460C1BCB6 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 7A22B56DA0D28D6B89179762BA3CE6A7 /* Build configuration list for PBXNativeTarget "Pods-ALTableViewTests" */ = { + FB2B43105785D7E87C88111DFB8EB4F5 /* Build configuration list for PBXNativeTarget "Pods-TestALTableView" */ = { isa = XCConfigurationList; buildConfigurations = ( - A5C5126DED695AEB1F76DC7F254CDB89 /* Debug */, - E9CF497A28B47D745A51C1C82351C68F /* Release */, + 62480D73BBA5AD65A8658CADFC7F587F /* Debug */, + 74F7F1F226644D8F6A2F8EFD94721820 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/ALTableViewSwift/Pods/SwipeCellKit/LICENSE b/ALTableViewSwift/Pods/SwipeCellKit/LICENSE new file mode 100644 index 0000000..cbf1c85 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/LICENSE @@ -0,0 +1,22 @@ +MIT License +Copyright (c) 2017 Jeremy Koch + +http://jerkoch.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/ALTableViewSwift/Pods/SwipeCellKit/README.md b/ALTableViewSwift/Pods/SwipeCellKit/README.md new file mode 100644 index 0000000..3cf30bf --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/README.md @@ -0,0 +1,250 @@ +# SwipeCellKit + +[![Build Status](https://travis-ci.org/jerkoch/SwipeCellKit.svg)](https://travis-ci.org/jerkoch/SwipeCellKit) +[![Version Status](https://img.shields.io/cocoapods/v/SwipeCellKit.svg)][podLink] +[![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat)](https://developer.apple.com/swift/) +[![license MIT](https://img.shields.io/cocoapods/l/SwipeCellKit.svg)][mitLink] +[![Platform](https://img.shields.io/cocoapods/p/SwipeCellKit.svg)][docsLink] +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Twitter](https://img.shields.io/badge/twitter-@mkurabi-blue.svg?style=flat)](https://twitter.com/mkurabi) + +*Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift.* + +

+ +## About + +A swipeable `UITableViewCell` or `UICollectionViewCell` with support for: + +* Left and right swipe actions +* Action buttons with: *text only, text + image, image only* +* Haptic Feedback +* Customizable transitions: *Border, Drag, and Reveal* +* Customizable action button behavior during swipe +* Animated expansion when dragging past threshold +* Customizable expansion animations +* Support for both `UITableView` and `UICollectionView` +* Accessibility + +## Background + +Check out my [blog post](https://jerkoch.com/2017/02/07/swiper-no-swiping.html) on how *SwipeCellKit* came to be. + +## Demo + +### Transition Styles + +The transition style describes how the action buttons are exposed during the swipe. + +#### Border + +

+ +#### Drag + +

+ +#### Reveal + +

+ +#### Customized + +

+ +### Expansion Styles + +The expansion style describes the behavior when the cell is swiped past a defined threshold. + +#### None + +

+ +#### Selection + +

+ +#### Destructive + +

+ +#### Customized + +

+ +## Requirements + +* Swift 4.1 +* Xcode 9+ +* iOS 9.0+ + +## Installation + +#### [CocoaPods](http://cocoapods.org) (recommended) + +````ruby +use_frameworks! + +# Latest release in CocoaPods +pod 'SwipeCellKit' + +# Get the latest on develop +pod 'SwipeCellKit', :git => 'https://github.com/SwipeCellKit/SwipeCellKit.git', :branch => 'develop' + +# If you like to live dangerously +pod 'SwipeCellKit', :git => 'https://github.com/SwipeCellKit/SwipeCellKit.git', :branch => 'swift_4.2' +```` + +#### [Carthage](https://github.com/Carthage/Carthage) + +````bash +github "SwipeCellKit/SwipeCellKit" +```` + +## Documentation + +Read the [docs][docsLink]. Generated with [jazzy](https://github.com/realm/jazzy). Hosted by [GitHub Pages](https://pages.github.com). + +## Usage for UITableView + +Set the `delegate` property on `SwipeTableViewCell`: + +````swift +override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! SwipeTableViewCell + cell.delegate = self + return cell +} +```` + +Adopt the `SwipeTableViewCellDelegate` protocol: + +````swift +func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? { + guard orientation == .right else { return nil } + + let deleteAction = SwipeAction(style: .destructive, title: "Delete") { action, indexPath in + // handle action by updating model with deletion + } + + // customize the action appearance + deleteAction.image = UIImage(named: "delete") + + return [deleteAction] +} +```` + +Optionally, you can implement the `editActionsOptionsForRowAt` method to customize the behavior of the swipe actions: + +````swift +func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions { + var options = SwipeOptions() + options.expansionStyle = .destructive + options.transitionStyle = .border + return options +} +```` +## Usage for UICollectionView + +Set the `delegate` property on `SwipeCollectionViewCell`: + +````swift +override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! as! SwipeCollectionViewCell + cell.delegate = self + return cell +} +```` + +Adopt the `SwipeCollectionViewCellDelegate` protocol: + +````swift +func collectionView(_ collectionView: UICollectionView, editActionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? { + guard orientation == .right else { return nil } + + let deleteAction = SwipeAction(style: .destructive, title: "Delete") { action, indexPath in + // handle action by updating model with deletion + } + + // customize the action appearance + deleteAction.image = UIImage(named: "delete") + + return [deleteAction] +} +```` + +Optionally, you can implement the `editActionsOptionsForItemAt` method to customize the behavior of the swipe actions: + +````swift +func collectionView(_ collectionView: UICollectionView, editActionsOptionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions { + var options = SwipeOptions() + options.expansionStyle = .destructive + options.transitionStyle = .border + return options +} +```` +### Transitions + +Three built-in transition styles are provided by `SwipeTransitionStyle`: + +* .border: The visible action area is equally divide between all action buttons. +* .drag: The visible action area is dragged, pinned to the cell, with each action button fully sized as it is exposed. +* .reveal: The visible action area sits behind the cell, pinned to the edge of the table view, and is revealed as the cell is dragged aside. + +See [Customizing Transitions](https://github.com/SwipeCellKit/SwipeCellKit/blob/develop/Guides/Advanced.md) for more details on customizing button appearance as the swipe is performed. + +#### Transition Delegate + +Transition for a `SwipeAction` can be observered by setting a `SwipeActionTransitioning` on the `transitionDelegate` property. This allows you to observe what percentage is visible and access to the underlying `UIButton` for that `SwipeAction`. + +### Expansion + +Four built-in expansion styles are provided by `SwipeExpansionStyle`: + +* .selection +* .destructive (like Mail.app) +* .destructiveAfterFill (like Mailbox/Tweetbot) +* .fill + +Much effort has gone into making `SwipeExpansionStyle` extremely customizable. If these built-in styles do not meet your needs, see [Customizing Expansion](https://github.com/SwipeCellKit/SwipeCellKit/blob/develop/Guides/Advanced.md) for more details on creating custom styles. + +The built-in `.fill` expansion style requires manual action fulfillment. This means your action handler must call `SwipeAction.fulfill(style:)` at some point during or after invocation to resolve the fill expansion. The supplied `ExpansionFulfillmentStyle` allows you to delete or reset the cell at some later point (possibly after further user interaction). + +The built-in `.destructive`, and `.destructiveAfterFill` expansion styles are configured to automatically perform row deletion when the action handler is invoked (automatic fulfillment). Your deletion behavior may require coordination with other row animations (eg. inside `beginUpdates` and `endUpdates`). In this case, you can easily create a custom `SwipeExpansionStyle` which requires manual fulfillment to trigger deletion: + +````swift +var options = SwipeTableOptions() +options.expansionStyle = .destructive(automaticallyDelete: false) +```` + +> **NOTE**: You must call `SwipeAction.fulfill(with style:)` at some point while/after your action handler is invoked to trigger deletion. Do not call `deleteRows` directly. + +````swift +let delete = SwipeAction(style: .destructive, title: nil) { action, indexPath in + // Update model + self.emails.remove(at: indexPath.row) + action.fulfill(with: .delete) +} +```` + +## Advanced + +See the [Advanced Guide](https://github.com/SwipeCellKit/SwipeCellKit/blob/develop/Guides/Advanced.md) for more details on customization. + +## Credits + +Maintained by [**@mkurabi**](https://twitter.com/mkurabi). + +## Showcase + +We're interested in knowing [who's using *SwipeCellKit*](https://github.com/SwipeCellKit/SwipeCellKit/blob/develop/SHOWCASE.md) in their app. Please submit a pull request to add your app! + +## License + +`SwipeCellKit` is released under an [MIT License][mitLink]. See `LICENSE` for details. + +*Please provide attribution, it is greatly appreciated.* + +[podLink]:https://cocoapods.org/pods/SwipeCellKit +[docsLink]:https://swipecellkit.github.io/SwipeCellKit/ +[mitLink]:http://opensource.org/licenses/MIT diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/Extensions.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/Extensions.swift new file mode 100644 index 0000000..7aeca3d --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/Extensions.swift @@ -0,0 +1,81 @@ +// +// Extensions.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +extension UITableView { + var swipeCells: [SwipeTableViewCell] { + return visibleCells.compactMap({ $0 as? SwipeTableViewCell }) + } + + func hideSwipeCell() { + swipeCells.forEach { $0.hideSwipe(animated: true) } + } +} + +extension UICollectionView { + var swipeCells: [SwipeCollectionViewCell] { + return visibleCells as? [SwipeCollectionViewCell] ?? [] + } + + func hideSwipeCell() { + swipeCells.forEach { $0.hideSwipe(animated: true) } + } + + func setGestureEnabled(_ enabled: Bool) { + gestureRecognizers?.forEach { + guard $0 != panGestureRecognizer else { return } + + $0.isEnabled = enabled + } + } +} + +extension UIScrollView { + var swipeables: [Swipeable] { + switch self { + case let tableView as UITableView: + return tableView.swipeCells + case let collectionView as UICollectionView: + return collectionView.swipeCells + default: + return [] + } + } + + func hideSwipeables() { + switch self { + case let tableView as UITableView: + tableView.hideSwipeCell() + case let collectionView as UICollectionView: + collectionView.hideSwipeCell() + default: + return + } + } +} + +extension UIPanGestureRecognizer { + func elasticTranslation(in view: UIView?, withLimit limit: CGSize, fromOriginalCenter center: CGPoint, applyingRatio ratio: CGFloat = 0.20) -> CGPoint { + let translation = self.translation(in: view) + + guard let sourceView = self.view else { + return translation + } + + let updatedCenter = CGPoint(x: center.x + translation.x, y: center.y + translation.y) + let distanceFromCenter = CGSize(width: abs(updatedCenter.x - sourceView.bounds.midX), + height: abs(updatedCenter.y - sourceView.bounds.midY)) + + let inverseRatio = 1.0 - ratio + let scale: (x: CGFloat, y: CGFloat) = (updatedCenter.x < sourceView.bounds.midX ? -1 : 1, updatedCenter.y < sourceView.bounds.midY ? -1 : 1) + let x = updatedCenter.x - (distanceFromCenter.width > limit.width ? inverseRatio * (distanceFromCenter.width - limit.width) * scale.x : 0) + let y = updatedCenter.y - (distanceFromCenter.height > limit.height ? inverseRatio * (distanceFromCenter.height - limit.height) * scale.y : 0) + + return CGPoint(x: x, y: y) + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAccessibilityCustomAction.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAccessibilityCustomAction.swift new file mode 100644 index 0000000..c76aed9 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAccessibilityCustomAction.swift @@ -0,0 +1,24 @@ +// +// SwipeAccessibilityCustomAction.swift +// SwipeCellKit +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +class SwipeAccessibilityCustomAction: UIAccessibilityCustomAction { + let action: SwipeAction + let indexPath: IndexPath + + init(action: SwipeAction, indexPath: IndexPath, target: Any, selector: Selector) { + + self.action = action + self.indexPath = indexPath + + let name = action.accessibilityLabel ?? action.title ?? action.image?.accessibilityIdentifier ?? "" + + super.init(name: name, target: target, selector: selector) + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAction.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAction.swift new file mode 100644 index 0000000..783ad14 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAction.swift @@ -0,0 +1,131 @@ +// +// SwipeAction.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/// Constants that help define the appearance of action buttons. +public enum SwipeActionStyle: Int { + /// Apply a style that reflects standard non-destructive actions. + case `default` + + /// Apply a style that reflects destructive actions. + case destructive +} + +/** + The `SwipeAction` object defines a single action to present when the user swipes horizontally in a table/collection item. + + This class lets you define one or more custom actions to display for a given item in your table/collection. Each instance of this class represents a single action to perform and includes the text, formatting information, and behavior for the corresponding button. + */ +public class SwipeAction: NSObject { + /// An optional unique action identifier. + public var identifier: String? + + /// The title of the action button. + /// + /// - note: You must specify a title or an image. + public var title: String? + + /// The style applied to the action button. + public var style: SwipeActionStyle + + /// The object that is notified as transitioning occurs. + public var transitionDelegate: SwipeActionTransitioning? + + /// The font to use for the title of the action button. + /// + /// - note: If you do not specify a font, a 15pt system font is used. + public var font: UIFont? + + /// The text color of the action button. + /// + /// - note: If you do not specify a color, white is used. + public var textColor: UIColor? + + /// The highlighted text color of the action button. + /// + /// - note: If you do not specify a color, `textColor` is used. + public var highlightedTextColor: UIColor? + + /// The image used for the action button. + /// + /// - note: You must specify a title or an image. + public var image: UIImage? + + /// The highlighted image used for the action button. + /// + /// - note: If you do not specify a highlight image, the default `image` is used for the highlighted state. + public var highlightedImage: UIImage? + + /// The closure to execute when the user taps the button associated with this action. + public var handler: ((SwipeAction, IndexPath) -> Void)? + + /// The background color of the action button. + /// + /// - note: Use this property to specify the background color for your button. If you do not specify a value for this property, the framework assigns a default color based on the value in the style property. + public var backgroundColor: UIColor? + + /// The highlighted background color of the action button. + /// + /// - note: Use this property to specify the highlighted background color for your button. + public var highlightedBackgroundColor: UIColor? + + /// The visual effect to apply to the action button. + /// + /// - note: Assigning a visual effect object to this property adds that effect to the background of the action button. + public var backgroundEffect: UIVisualEffect? + + /// A Boolean value that determines whether the actions menu is automatically hidden upon selection. + /// + /// - note: When set to `true`, the actions menu is automatically hidden when the action is selected. The default value is `false`. + public var hidesWhenSelected = false + + /** + Constructs a new `SwipeAction` instance. + + - parameter style: The style of the action button. + - parameter title: The title of the action button. + - parameter handler: The closure to execute when the user taps the button associated with this action. + */ + public init(style: SwipeActionStyle, title: String?, handler: ((SwipeAction, IndexPath) -> Void)?) { + self.title = title + self.style = style + self.handler = handler + } + + /** + Calling this method performs the configured expansion completion animation including deletion, if necessary. Calling this method more than once has no effect. + + You should only call this method from the implementation of your action `handler` method. + + - parameter style: The desired style for completing the expansion action. + */ + public func fulfill(with style: ExpansionFulfillmentStyle) { + completionHandler?(style) + } + + // MARK: - Internal + + internal var completionHandler: ((ExpansionFulfillmentStyle) -> Void)? +} + +/// Describes how expansion should be resolved once the action has been fulfilled. +public enum ExpansionFulfillmentStyle { + /// Implies the item will be deleted upon action fulfillment. + case delete + + /// Implies the item will be reset and the actions view hidden upon action fulfillment. + case reset +} + +// MARK: - Internal + +internal extension SwipeAction { + var hasBackgroundColor: Bool { + return backgroundColor != .clear && backgroundEffect == nil + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionButton.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionButton.swift new file mode 100755 index 0000000..8e83b1f --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionButton.swift @@ -0,0 +1,108 @@ +// +// SwipeActionButton.swift +// +// Created by Jeremy Koch. +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +class SwipeActionButton: UIButton { + var spacing: CGFloat = 8 + var shouldHighlight = true + var highlightedBackgroundColor: UIColor? + + var maximumImageHeight: CGFloat = 0 + var verticalAlignment: SwipeVerticalAlignment = .centerFirstBaseline + + + var currentSpacing: CGFloat { + return (currentTitle?.isEmpty == false && imageHeight > 0) ? spacing : 0 + } + + var alignmentRect: CGRect { + let contentRect = self.contentRect(forBounds: bounds) + let titleHeight = titleBoundingRect(with: verticalAlignment == .centerFirstBaseline ? CGRect.infinite.size : contentRect.size).integral.height + let totalHeight = imageHeight + titleHeight + currentSpacing + + return contentRect.center(size: CGSize(width: contentRect.width, height: totalHeight)) + } + + private var imageHeight: CGFloat { + get { + return currentImage == nil ? 0 : maximumImageHeight + } + } + + override var intrinsicContentSize: CGSize { + return CGSize(width: UIView.noIntrinsicMetric, height: contentEdgeInsets.top + alignmentRect.height + contentEdgeInsets.bottom) + } + + convenience init(action: SwipeAction) { + self.init(frame: .zero) + + contentHorizontalAlignment = .center + + tintColor = action.textColor ?? .white + let highlightedTextColor = action.highlightedTextColor ?? tintColor + highlightedBackgroundColor = action.highlightedBackgroundColor ?? UIColor.black.withAlphaComponent(0.1) + + titleLabel?.font = action.font ?? UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.medium) + titleLabel?.textAlignment = .center + titleLabel?.lineBreakMode = .byWordWrapping + titleLabel?.numberOfLines = 0 + + accessibilityLabel = action.accessibilityLabel + + setTitle(action.title, for: .normal) + setTitleColor(tintColor, for: .normal) + setTitleColor(highlightedTextColor, for: .highlighted) + setImage(action.image, for: .normal) + setImage(action.highlightedImage ?? action.image, for: .highlighted) + } + + override var isHighlighted: Bool { + didSet { + guard shouldHighlight else { return } + + backgroundColor = isHighlighted ? highlightedBackgroundColor : .clear + } + } + + func preferredWidth(maximum: CGFloat) -> CGFloat { + let width = maximum > 0 ? maximum : CGFloat.greatestFiniteMagnitude + let textWidth = titleBoundingRect(with: CGSize(width: width, height: CGFloat.greatestFiniteMagnitude)).width + let imageWidth = currentImage?.size.width ?? 0 + + return min(width, max(textWidth, imageWidth) + contentEdgeInsets.left + contentEdgeInsets.right) + } + + func titleBoundingRect(with size: CGSize) -> CGRect { + guard let title = currentTitle, let font = titleLabel?.font else { return .zero } + + return title.boundingRect(with: size, + options: [.usesLineFragmentOrigin], + attributes: [NSAttributedString.Key.font: font], + context: nil).integral + } + + override func titleRect(forContentRect contentRect: CGRect) -> CGRect { + var rect = contentRect.center(size: titleBoundingRect(with: contentRect.size).size) + rect.origin.y = alignmentRect.minY + imageHeight + currentSpacing + return rect.integral + } + + override func imageRect(forContentRect contentRect: CGRect) -> CGRect { + var rect = contentRect.center(size: currentImage?.size ?? .zero) + rect.origin.y = alignmentRect.minY + (imageHeight - rect.height) / 2 + return rect + } +} + +extension CGRect { + func center(size: CGSize) -> CGRect { + let dx = width - size.width + let dy = height - size.height + return CGRect(x: origin.x + dx * 0.5, y: origin.y + dy * 0.5, width: size.width, height: size.height) + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionTransitioning.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionTransitioning.swift new file mode 100644 index 0000000..8a316f1 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionTransitioning.swift @@ -0,0 +1,106 @@ +// +// SwipeActionTransitioning.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/** + Adopt the `SwipeActionTransitioning` protocol in objects that implement custom appearance of actions during transition. + */ +public protocol SwipeActionTransitioning { + /** + Tells the delegate that transition change has occured. + */ + func didTransition(with context: SwipeActionTransitioningContext) -> Void +} + +/** + The `SwipeActionTransitioningContext` type provides information relevant to a specific action as transitioning occurs. + */ +public struct SwipeActionTransitioningContext { + /// The unique action identifier. + public let actionIdentifier: String? + + /// The button that is changing. + public let button: UIButton + + /// The old visibility percentage between 0.0 and 1.0. + public let newPercentVisible: CGFloat + + /// The new visibility percentage between 0.0 and 1.0. + public let oldPercentVisible: CGFloat + + internal let wrapperView: UIView + + internal init(actionIdentifier: String?, button: UIButton, newPercentVisible: CGFloat, oldPercentVisible: CGFloat, wrapperView: UIView) { + self.actionIdentifier = actionIdentifier + self.button = button + self.newPercentVisible = newPercentVisible + self.oldPercentVisible = oldPercentVisible + self.wrapperView = wrapperView + } + + /// Sets the background color behind the action button. + /// + /// - parameter color: The background color. + public func setBackgroundColor(_ color: UIColor?) { + wrapperView.backgroundColor = color + } +} + +/** + A scale transition object drives the custom appearance of actions during transition. + + As button's percentage visibility crosses the `threshold`, the `ScaleTransition` object will animate from `initialScale` to `identity`. The default settings provide a "pop-like" effect as the buttons are exposed more than 50%. + */ +public struct ScaleTransition: SwipeActionTransitioning { + + /// Returns a `ScaleTransition` instance with default transition options. + public static var `default`: ScaleTransition { return ScaleTransition() } + + /// The duration of the animation. + public let duration: Double + + /// The initial scale factor used before the action button percent visible is greater than the threshold. + public let initialScale: CGFloat + + /// The percent visible threshold that triggers the scaling animation. + public let threshold: CGFloat + + /** + Contructs a new `ScaleTransition` instance. + + - parameter duration: The duration of the animation. + + - parameter initialScale: The initial scale factor used before the action button percent visible is greater than the threshold. + + - parameter threshold: The percent visible threshold that triggers the scaling animation. + + - returns: The new `ScaleTransition` instance. + */ + public init(duration: Double = 0.15, initialScale: CGFloat = 0.8, threshold: CGFloat = 0.5) { + self.duration = duration + self.initialScale = initialScale + self.threshold = threshold + } + + /// :nodoc: + public func didTransition(with context: SwipeActionTransitioningContext) -> Void { + if context.oldPercentVisible == 0 { + context.button.transform = .init(scaleX: initialScale, y: initialScale) + } + + if context.oldPercentVisible < threshold && context.newPercentVisible >= threshold { + UIView.animate(withDuration: duration) { + context.button.transform = .identity + } + } else if context.oldPercentVisible >= threshold && context.newPercentVisible < threshold { + UIView.animate(withDuration: duration) { + context.button.transform = .init(scaleX: self.initialScale, y: self.initialScale) + } + } + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionsView.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionsView.swift new file mode 100755 index 0000000..ecd3304 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeActionsView.swift @@ -0,0 +1,314 @@ +// +// SwipeActionsView.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +protocol SwipeActionsViewDelegate: class { + func swipeActionsView(_ swipeActionsView: SwipeActionsView, didSelect action: SwipeAction) +} + +class SwipeActionsView: UIView { + weak var delegate: SwipeActionsViewDelegate? + + let transitionLayout: SwipeTransitionLayout + var layoutContext: ActionsViewLayoutContext + + var feedbackGenerator: SwipeFeedback + + var expansionAnimator: SwipeAnimator? + + var expansionDelegate: SwipeExpanding? { + return options.expansionDelegate ?? (expandableAction?.hasBackgroundColor == false ? ScaleAndAlphaExpansion.default : nil) + } + + weak var safeAreaInsetView: UIView? + let orientation: SwipeActionsOrientation + let actions: [SwipeAction] + let options: SwipeOptions + + var buttons: [SwipeActionButton] = [] + + var minimumButtonWidth: CGFloat = 0 + var maximumImageHeight: CGFloat { + return actions.reduce(0, { initial, next in max(initial, next.image?.size.height ?? 0) }) + } + + var safeAreaMargin: CGFloat { + guard #available(iOS 11, *) else { return 0 } + guard let scrollView = self.safeAreaInsetView else { return 0 } + return orientation == .left ? scrollView.safeAreaInsets.left : scrollView.safeAreaInsets.right + } + + var visibleWidth: CGFloat = 0 { + didSet { + // If necessary, adjust for safe areas + visibleWidth = max(0, visibleWidth - safeAreaMargin) + + let preLayoutVisibleWidths = transitionLayout.visibleWidthsForViews(with: layoutContext) + + layoutContext = ActionsViewLayoutContext.newContext(for: self) + + transitionLayout.container(view: self, didChangeVisibleWidthWithContext: layoutContext) + + setNeedsLayout() + layoutIfNeeded() + + notifyVisibleWidthChanged(oldWidths: preLayoutVisibleWidths, + newWidths: transitionLayout.visibleWidthsForViews(with: layoutContext)) + } + } + + var preferredWidth: CGFloat { + return minimumButtonWidth * CGFloat(actions.count) + safeAreaMargin + } + + var contentSize: CGSize { + if options.expansionStyle?.elasticOverscroll != true || visibleWidth < preferredWidth { + return CGSize(width: visibleWidth, height: bounds.height) + } else { + let scrollRatio = max(0, visibleWidth - preferredWidth) + return CGSize(width: preferredWidth + (scrollRatio * 0.25), height: bounds.height) + } + } + + private(set) var expanded: Bool = false + + var expandableAction: SwipeAction? { + return options.expansionStyle != nil ? actions.last : nil + } + + init(contentEdgeInsets: UIEdgeInsets, + maxSize: CGSize, + safeAreaInsetView: UIView, + options: SwipeOptions, + orientation: SwipeActionsOrientation, + actions: [SwipeAction]) { + + self.safeAreaInsetView = safeAreaInsetView + self.options = options + self.orientation = orientation + self.actions = actions.reversed() + + switch options.transitionStyle { + case .border: + transitionLayout = BorderTransitionLayout() + case .reveal: + transitionLayout = RevealTransitionLayout() + default: + transitionLayout = DragTransitionLayout() + } + + self.layoutContext = ActionsViewLayoutContext(numberOfActions: actions.count, orientation: orientation) + + feedbackGenerator = SwipeFeedback(style: .light) + feedbackGenerator.prepare() + + super.init(frame: .zero) + + clipsToBounds = true + translatesAutoresizingMaskIntoConstraints = false + backgroundColor = options.backgroundColor ?? #colorLiteral(red: 0.862745098, green: 0.862745098, blue: 0.862745098, alpha: 1) + + buttons = addButtons(for: self.actions, withMaximum: maxSize, contentEdgeInsets: contentEdgeInsets) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func addButtons(for actions: [SwipeAction], withMaximum size: CGSize, contentEdgeInsets: UIEdgeInsets) -> [SwipeActionButton] { + let buttons: [SwipeActionButton] = actions.map({ action in + let actionButton = SwipeActionButton(action: action) + actionButton.addTarget(self, action: #selector(actionTapped(button:)), for: .touchUpInside) + actionButton.autoresizingMask = [.flexibleHeight, orientation == .right ? .flexibleRightMargin : .flexibleLeftMargin] + actionButton.spacing = options.buttonSpacing ?? 8 + actionButton.contentEdgeInsets = buttonEdgeInsets(fromOptions: options) + return actionButton + }) + + let maximum = options.maximumButtonWidth ?? (size.width - 30) / CGFloat(actions.count) + let minimum = options.minimumButtonWidth ?? min(maximum, 74) + minimumButtonWidth = buttons.reduce(minimum, { initial, next in max(initial, next.preferredWidth(maximum: maximum)) }) + + + buttons.enumerated().forEach { (index, button) in + let action = actions[index] + let frame = CGRect(origin: .zero, size: CGSize(width: bounds.width, height: bounds.height)) + let wrapperView = SwipeActionButtonWrapperView(frame: frame, action: action, orientation: orientation, contentWidth: minimumButtonWidth) + wrapperView.translatesAutoresizingMaskIntoConstraints = false + wrapperView.addSubview(button) + + if let effect = action.backgroundEffect { + let effectView = UIVisualEffectView(effect: effect) + effectView.frame = wrapperView.frame + effectView.autoresizingMask = [.flexibleHeight, .flexibleWidth] + effectView.contentView.addSubview(wrapperView) + addSubview(effectView) + } else { + addSubview(wrapperView) + } + + button.frame = wrapperView.contentRect + button.maximumImageHeight = maximumImageHeight + button.verticalAlignment = options.buttonVerticalAlignment + button.shouldHighlight = action.hasBackgroundColor + + wrapperView.leftAnchor.constraint(equalTo: leftAnchor).isActive = true + wrapperView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true + + let topConstraint = wrapperView.topAnchor.constraint(equalTo: topAnchor, constant: contentEdgeInsets.top) + topConstraint.priority = contentEdgeInsets.top == 0 ? .required : .defaultHigh + topConstraint.isActive = true + + let bottomConstraint = wrapperView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -1 * contentEdgeInsets.bottom) + bottomConstraint.priority = contentEdgeInsets.bottom == 0 ? .required : .defaultHigh + bottomConstraint.isActive = true + + if contentEdgeInsets != .zero { + let heightConstraint = wrapperView.heightAnchor.constraint(greaterThanOrEqualToConstant: button.intrinsicContentSize.height) + heightConstraint.priority = .required + heightConstraint.isActive = true + } + } + return buttons + } + + @objc func actionTapped(button: SwipeActionButton) { + guard let index = buttons.index(of: button) else { return } + + delegate?.swipeActionsView(self, didSelect: actions[index]) + } + + func buttonEdgeInsets(fromOptions options: SwipeOptions) -> UIEdgeInsets { + let padding = options.buttonPadding ?? 8 + return UIEdgeInsets(top: padding, left: padding, bottom: padding, right: padding) + } + + func setExpanded(expanded: Bool, feedback: Bool = false) { + guard self.expanded != expanded else { return } + + self.expanded = expanded + + if feedback { + feedbackGenerator.impactOccurred() + feedbackGenerator.prepare() + } + + let timingParameters = expansionDelegate?.animationTimingParameters(buttons: buttons.reversed(), expanding: expanded) + + if expansionAnimator?.isRunning == true { + expansionAnimator?.stopAnimation(true) + } + + if #available(iOS 10, *) { + expansionAnimator = UIViewPropertyAnimator(duration: timingParameters?.duration ?? 0.6, dampingRatio: 1.0) + } else { + expansionAnimator = UIViewSpringAnimator(duration: timingParameters?.duration ?? 0.6, + damping: 1.0, + initialVelocity: 1.0) + } + + expansionAnimator?.addAnimations { + self.setNeedsLayout() + self.layoutIfNeeded() + } + + expansionAnimator?.startAnimation(afterDelay: timingParameters?.delay ?? 0) + + notifyExpansion(expanded: expanded) + } + + func notifyVisibleWidthChanged(oldWidths: [CGFloat], newWidths: [CGFloat]) { + DispatchQueue.main.async { + oldWidths.enumerated().forEach { index, oldWidth in + let newWidth = newWidths[index] + if oldWidth != newWidth { + let context = SwipeActionTransitioningContext(actionIdentifier: self.actions[index].identifier, + button: self.buttons[index], + newPercentVisible: newWidth / self.minimumButtonWidth, + oldPercentVisible: oldWidth / self.minimumButtonWidth, + wrapperView: self.subviews[index]) + + self.actions[index].transitionDelegate?.didTransition(with: context) + } + } + } + } + + func notifyExpansion(expanded: Bool) { + guard let expandedButton = buttons.last else { return } + + expansionDelegate?.actionButton(expandedButton, didChange: expanded, otherActionButtons: buttons.dropLast().reversed()) + } + + func createDeletionMask() -> UIView { + let mask = UIView(frame: CGRect(x: min(0, frame.minX), y: 0, width: bounds.width * 2, height: bounds.height)) + mask.backgroundColor = UIColor.white + return mask + } + + override func layoutSubviews() { + super.layoutSubviews() + + for subview in subviews.enumerated() { + transitionLayout.layout(view: subview.element, atIndex: subview.offset, with: layoutContext) + } + + if expanded { + subviews.last?.frame.origin.x = 0 + bounds.origin.x + } + } +} + +class SwipeActionButtonWrapperView: UIView { + let contentRect: CGRect + var actionBackgroundColor: UIColor? + + init(frame: CGRect, action: SwipeAction, orientation: SwipeActionsOrientation, contentWidth: CGFloat) { + switch orientation { + case .left: + contentRect = CGRect(x: frame.width - contentWidth, y: 0, width: contentWidth, height: frame.height) + case .right: + contentRect = CGRect(x: 0, y: 0, width: contentWidth, height: frame.height) + } + + super.init(frame: frame) + + configureBackgroundColor(with: action) + } + + override func draw(_ rect: CGRect) { + super.draw(rect) + + if let actionBackgroundColor = self.actionBackgroundColor, let context = UIGraphicsGetCurrentContext() { + actionBackgroundColor.setFill() + context.fill(rect); + } + } + + func configureBackgroundColor(with action: SwipeAction) { + guard action.hasBackgroundColor else { + isOpaque = false + return + } + + if let backgroundColor = action.backgroundColor { + actionBackgroundColor = backgroundColor + } else { + switch action.style { + case .destructive: + actionBackgroundColor = #colorLiteral(red: 1, green: 0.2352941176, blue: 0.1882352941, alpha: 1) + default: + actionBackgroundColor = #colorLiteral(red: 0.862745098, green: 0.862745098, blue: 0.862745098, alpha: 1) + } + } + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAnimator.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAnimator.swift new file mode 100644 index 0000000..8ae0832 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeAnimator.swift @@ -0,0 +1,112 @@ +// +// SwipeAnimator.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import Foundation + +protocol SwipeAnimator { + /// A Boolean value indicating whether the animation is currently running. + var isRunning: Bool { get } + + /** + The animation to be run by the SwipeAnimator + + - parameter animation: The closure to be executed by the animator + */ + func addAnimations(_ animation: @escaping () -> Void) + + /** + Completion handler for the animation that is going to be started + + - parameter completion: The closure to be execute on completion of the animator + */ + func addCompletion(completion: @escaping (Bool) -> Void) + + /** + Starts the defined animation + */ + func startAnimation() + + /** + Starts the defined animation after the given delay + + - parameter delay: Delay of the animation + */ + func startAnimation(afterDelay delay: TimeInterval) + + /** + Stops the animations at their current positions. + + - parameter withoutFinishing: A Boolean indicating whether any final actions should be performed. + */ + func stopAnimation(_ withoutFinishing: Bool) +} + +@available(iOS 10.0, *) +extension UIViewPropertyAnimator: SwipeAnimator { + func addCompletion(completion: @escaping (Bool) -> Void) { + addCompletion { position in + completion(position == .end) + } + } +} + +class UIViewSpringAnimator: SwipeAnimator { + var isRunning: Bool = false + + let duration:TimeInterval + let damping:CGFloat + let velocity:CGFloat + + var animations:(() -> Void)? + var completion:((Bool) -> Void)? + + required init(duration: TimeInterval, + damping: CGFloat, + initialVelocity velocity: CGFloat = 0) { + self.duration = duration + self.damping = damping + self.velocity = velocity + } + + func addAnimations(_ animations: @escaping () -> Void) { + self.animations = animations + } + + func addCompletion(completion: @escaping (Bool) -> Void) { + self.completion = { [weak self] finished in + guard self?.isRunning == true else { return } + + self?.isRunning = false + self?.animations = nil + self?.completion = nil + + completion(finished) + } + } + + func startAnimation() { + self.startAnimation(afterDelay: 0) + } + + func startAnimation(afterDelay delay:TimeInterval) { + guard let animations = animations else { return } + + isRunning = true + + UIView.animate(withDuration: duration, + delay: delay, + usingSpringWithDamping: damping, + initialSpringVelocity: velocity, + options: [.curveEaseInOut, .allowUserInteraction], + animations: animations, + completion: completion) + } + + func stopAnimation(_ withoutFinishing: Bool) { + isRunning = false + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Accessibility.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Accessibility.swift new file mode 100644 index 0000000..c9f9f48 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Accessibility.swift @@ -0,0 +1,80 @@ +// +// SwipeCollectionViewCell+Accessibility.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +extension SwipeCollectionViewCell { + /// :nodoc: + open override func accessibilityElementCount() -> Int { + guard state != .center else { + return super.accessibilityElementCount() + } + + return 1 + } + + /// :nodoc: + open override func accessibilityElement(at index: Int) -> Any? { + guard state != .center else { + return super.accessibilityElement(at: index) + } + + return actionsView + } + + /// :nodoc: + open override func index(ofAccessibilityElement element: Any) -> Int { + guard state != .center else { + return super.index(ofAccessibilityElement: element) + } + + return element is SwipeActionsView ? 0 : NSNotFound + } +} + +extension SwipeCollectionViewCell { + /// :nodoc: + open override var accessibilityCustomActions: [UIAccessibilityCustomAction]? { + get { + guard let collectionView = collectionView, let indexPath = collectionView.indexPath(for: self) else { + return super.accessibilityCustomActions + } + + let leftActions = delegate?.collectionView(collectionView, editActionsForItemAt: indexPath, for: .left) ?? [] + let rightActions = delegate?.collectionView(collectionView, editActionsForItemAt: indexPath, for: .right) ?? [] + + let actions = [rightActions.first, leftActions.first].compactMap({ $0 }) + rightActions.dropFirst() + leftActions.dropFirst() + + if actions.count > 0 { + return actions.map({ SwipeAccessibilityCustomAction(action: $0, + indexPath: indexPath, + target: self, + selector: #selector(performAccessibilityCustomAction(accessibilityCustomAction:))) }) + } else { + return super.accessibilityCustomActions + } + } + + set { + super.accessibilityCustomActions = newValue + } + } + + @objc func performAccessibilityCustomAction(accessibilityCustomAction: SwipeAccessibilityCustomAction) -> Bool { + guard let collectionView = collectionView else { return false } + + let swipeAction = accessibilityCustomAction.action + + swipeAction.handler?(swipeAction, accessibilityCustomAction.indexPath) + + if swipeAction.style == .destructive { + collectionView.deleteItems(at: [accessibilityCustomAction.indexPath]) + } + + return true + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Display.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Display.swift new file mode 100644 index 0000000..684fd24 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell+Display.swift @@ -0,0 +1,55 @@ +// +// SwipeCollectionViewCell+Display.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +extension SwipeCollectionViewCell { + /// The point at which the origin of the cell is offset from the non-swiped origin. + public var swipeOffset: CGFloat { + set { setSwipeOffset(newValue, animated: false) } + get { return contentView.frame.midX - bounds.midX } + } + + /** + Hides the swipe actions and returns the cell to center. + + - parameter animated: Specify `true` to animate the hiding of the swipe actions or `false` to hide it immediately. + + - parameter completion: The closure to be executed once the animation has finished. A `Boolean` argument indicates whether or not the animations actually finished before the completion handler was called. + */ + public func hideSwipe(animated: Bool, completion: ((Bool) -> Void)? = nil) { + swipeController.hideSwipe(animated: animated, completion: completion) + } + + /** + Shows the swipe actions for the specified orientation. + + - parameter orientation: The side of the cell on which to show the swipe actions. + + - parameter animated: Specify `true` to animate the showing of the swipe actions or `false` to show them immediately. + + - parameter completion: The closure to be executed once the animation has finished. A `Boolean` argument indicates whether or not the animations actually finished before the completion handler was called. + */ + public func showSwipe(orientation: SwipeActionsOrientation, animated: Bool = true, completion: ((Bool) -> Void)? = nil) { + setSwipeOffset(.greatestFiniteMagnitude * orientation.scale * -1, + animated: animated, + completion: completion) + } + + /** + The point at which the origin of the cell is offset from the non-swiped origin. + + - parameter offset: A point (expressed in points) that is offset from the non-swiped origin. + + - parameter animated: Specify `true` to animate the transition to the new offset, `false` to make the transition immediate. + + - parameter completion: The closure to be executed once the animation has finished. A `Boolean` argument indicates whether or not the animations actually finished before the completion handler was called. + */ + public func setSwipeOffset(_ offset: CGFloat, animated: Bool = true, completion: ((Bool) -> Void)? = nil) { + swipeController.setSwipeOffset(offset, animated: animated, completion: completion) + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell.swift new file mode 100644 index 0000000..5736c41 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCell.swift @@ -0,0 +1,241 @@ +// +// SwipeCollectionViewCell.swift +// SwipeCellKit +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/** + The `SwipeCollectionViewCell` class extends `UICollectionViewCell` and provides more flexible options for cell swiping behavior. + + + The default behavior closely matches the stock Mail.app. If you want to customize the transition style (ie. how the action buttons are exposed), or the expansion style (the behavior when the row is swiped passes a defined threshold), you can return the appropriately configured `SwipeOptions` via the `SwipeCollectionViewCellDelegate` delegate. + */ +open class SwipeCollectionViewCell: UICollectionViewCell { + /// The object that acts as the delegate of the `SwipeCollectionViewCell`. + public weak var delegate: SwipeCollectionViewCellDelegate? + + var state = SwipeState.center + var actionsView: SwipeActionsView? + var scrollView: UIScrollView? { + return collectionView + } + var indexPath: IndexPath? { + return collectionView?.indexPath(for: self) + } + var panGestureRecognizer: UIGestureRecognizer + { + return swipeController.panGestureRecognizer; + } + + var swipeController: SwipeController! + var isPreviouslySelected = false + + weak var collectionView: UICollectionView? + + /// :nodoc: + open override var frame: CGRect { + set { super.frame = state.isActive ? CGRect(origin: CGPoint(x: frame.minX, y: newValue.minY), size: newValue.size) : newValue } + get { return super.frame } + } + + /// :nodoc: + open override var isHighlighted: Bool { + set { + guard state == .center else { return } + super.isHighlighted = newValue + } + get { return super.isHighlighted } + } + + /// :nodoc: + open override var layoutMargins: UIEdgeInsets { + get { + return frame.origin.x != 0 ? swipeController.originalLayoutMargins : super.layoutMargins + } + set { + super.layoutMargins = newValue + } + } + + /// :nodoc: + override public init(frame: CGRect) { + super.init(frame: frame) + + configure() + } + + /// :nodoc: + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + + configure() + } + + deinit { + collectionView?.panGestureRecognizer.removeTarget(self, action: nil) + } + + func configure() { + contentView.clipsToBounds = false + + swipeController = SwipeController(swipeable: self, actionsContainerView: contentView) + swipeController.delegate = self + } + + /// :nodoc: + override open func prepareForReuse() { + super.prepareForReuse() + + reset() + resetSelectedState() + } + + /// :nodoc: + override open func didMoveToSuperview() { + super.didMoveToSuperview() + + var view: UIView = self + while let superview = view.superview { + view = superview + + if let collectionView = view as? UICollectionView { + self.collectionView = collectionView + + swipeController.scrollView = scrollView + + collectionView.panGestureRecognizer.removeTarget(self, action: nil) + collectionView.panGestureRecognizer.addTarget(self, action: #selector(handleCollectionPan(gesture:))) + return + } + } + } + + /// :nodoc: + open override func willMove(toWindow newWindow: UIWindow?) { + super.willMove(toWindow: newWindow) + + if newWindow == nil { + reset() + } + } + + // Override so we can accept touches anywhere within the cell's original frame. + // This is required to detect touches on the `SwipeActionsView` sitting alongside the + // `SwipeCollectionViewCell`. + /// :nodoc: + override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool { + guard let superview = superview else { return false } + + let point = convert(point, to: superview) + + if !UIAccessibility.isVoiceOverRunning { + for cell in collectionView?.swipeCells ?? [] { + if (cell.state == .left || cell.state == .right) && !cell.contains(point: point) { + collectionView?.hideSwipeCell() + return false + } + } + } + + return contains(point: point) + } + + func contains(point: CGPoint) -> Bool { + return frame.contains(point) + } + + // Override hitTest(_:with:) here so that we can make sure our `actionsView` gets the touch event + // if it's supposed to, since otherwise, our `contentView` will swallow it and pass it up to + // the collection view. + /// :nodoc: + open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + guard let actionsView = actionsView else { return super.hitTest(point, with: event) } + let modifiedPoint = actionsView.convert(point, from: self) + return actionsView.hitTest(modifiedPoint, with: event) ?? super.hitTest(point, with: event) + } + + /// :nodoc: + override open func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { + return swipeController.gestureRecognizerShouldBegin(gestureRecognizer) + } + + /// :nodoc: + open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + swipeController.traitCollectionDidChange(from: previousTraitCollection, to: self.traitCollection) + } + + @objc func handleCollectionPan(gesture: UIPanGestureRecognizer) { + if gesture.state == .began { + hideSwipe(animated: true) + } + } + + func reset() { + contentView.clipsToBounds = false + swipeController.reset() + collectionView?.setGestureEnabled(true) + } + + func resetSelectedState() { + if isPreviouslySelected { + if let collectionView = collectionView, let indexPath = collectionView.indexPath(for: self) { + collectionView.selectItem(at: indexPath, animated: false, scrollPosition: []) + } + } + isPreviouslySelected = false + } +} + +extension SwipeCollectionViewCell: SwipeControllerDelegate { + func swipeController(_ controller: SwipeController, canBeginEditingSwipeableFor orientation: SwipeActionsOrientation) -> Bool { + return true + } + + func swipeController(_ controller: SwipeController, editActionsForSwipeableFor orientation: SwipeActionsOrientation) -> [SwipeAction]? { + guard let collectionView = collectionView, let indexPath = collectionView.indexPath(for: self) else { return nil } + + return delegate?.collectionView(collectionView, editActionsForItemAt: indexPath, for: orientation) + } + + func swipeController(_ controller: SwipeController, editActionsOptionsForSwipeableFor orientation: SwipeActionsOrientation) -> SwipeOptions { + guard let collectionView = collectionView, let indexPath = collectionView.indexPath(for: self) else { return SwipeOptions() } + + return delegate?.collectionView(collectionView, editActionsOptionsForItemAt: indexPath, for: orientation) ?? SwipeOptions() + } + + func swipeController(_ controller: SwipeController, visibleRectFor scrollView: UIScrollView) -> CGRect? { + guard let collectionView = collectionView else { return nil } + + return delegate?.visibleRect(for: collectionView) + } + + func swipeController(_ controller: SwipeController, willBeginEditingSwipeableFor orientation: SwipeActionsOrientation) { + guard let collectionView = collectionView, let indexPath = collectionView.indexPath(for: self) else { return } + + // Remove highlight and deselect any selected cells + super.isHighlighted = false + isPreviouslySelected = isSelected + collectionView.deselectItem(at: indexPath, animated: false) + + delegate?.collectionView(collectionView, willBeginEditingItemAt: indexPath, for: orientation) + } + + func swipeController(_ controller: SwipeController, didEndEditingSwipeableFor orientation: SwipeActionsOrientation) { + guard let collectionView = collectionView, let indexPath = collectionView.indexPath(for: self), let actionsView = self.actionsView else { return } + + resetSelectedState() + + delegate?.collectionView(collectionView, didEndEditingItemAt: indexPath, for: actionsView.orientation) + } + + func swipeController(_ controller: SwipeController, didDeleteSwipeableAt indexPath: IndexPath) { + collectionView?.deleteItems(at: [indexPath]) + } +} + diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCellDelegate.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCellDelegate.swift new file mode 100644 index 0000000..3383d39 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeCollectionViewCellDelegate.swift @@ -0,0 +1,91 @@ +// +// SwipeCollectionViewCellDelegate.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/** + The `SwipeCollectionViewCellDelegate` protocol is adopted by an object that manages the display of action buttons when the item is swiped. + */ +public protocol SwipeCollectionViewCellDelegate: class { + /** + Asks the delegate for the actions to display in response to a swipe in the specified item. + + - parameter collectionView: The collection view object which owns the item requesting this information. + + - parameter indexPath: The index path of the item. + + - parameter orientation: The side of the item requesting this information. + + - returns: An array of `SwipeAction` objects representing the actions for the item. Each action you provide is used to create a button that the user can tap. Returning `nil` will prevent swiping for the supplied orientation. + */ + func collectionView(_ collectionView: UICollectionView, editActionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? + + /** + Asks the delegate for the display options to be used while presenting the action buttons. + + - parameter collectionView: The collection view object which owns the item requesting this information. + + - parameter indexPath: The index path of the item. + + - parameter orientation: The side of the item requesting this information. + + - returns: A `SwipeOptions` instance which configures the behavior of the action buttons. + + - note: If not implemented, a default `SwipeOptions` instance is used. + */ + func collectionView(_ collectionView: UICollectionView, editActionsOptionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions + + /** + Tells the delegate that the collection view is about to go into editing mode. + + - parameter collectionView: The collection view object providing this information. + + - parameter indexPath: The index path of the item. + + - parameter orientation: The side of the item. + */ + func collectionView(_ collectionView: UICollectionView, willBeginEditingItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) + + /** + Tells the delegate that the collection view has left editing mode. + + - parameter collectionView: The collection view object providing this information. + + - parameter indexPath: The index path of the item. + + - parameter orientation: The side of the item. + */ + func collectionView(_ collectionView: UICollectionView, didEndEditingItemAt indexPath: IndexPath?, for orientation: SwipeActionsOrientation) + + /** + Asks the delegate for visibile rectangle of the collection view, which is used to ensure swipe actions are vertically centered within the visible portion of the item. + + - parameter collectionView: The collection view object providing this information. + + - returns: The visible rectangle of the collection view. + + - note: The returned rectange should be in the collection view's own coordinate system. Returning `nil` will result in no vertical offset to be be calculated. + */ + func visibleRect(for collectionView: UICollectionView) -> CGRect? +} + +/** + Default implementation of `SwipeCollectionViewCellDelegate` methods + */ +public extension SwipeCollectionViewCellDelegate { + func collectionView(_ collectionView: UICollectionView, editActionsOptionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions { + return SwipeOptions() + } + + func collectionView(_ collectionView: UICollectionView, willBeginEditingItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) {} + + func collectionView(_ collectionView: UICollectionView, didEndEditingItemAt indexPath: IndexPath?, for orientation: SwipeActionsOrientation) {} + + func visibleRect(for collectionView: UICollectionView) -> CGRect? { + return nil + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeController.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeController.swift new file mode 100644 index 0000000..84190d5 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeController.swift @@ -0,0 +1,520 @@ +// +// SwipeController.swift +// SwipeCellKit +// +// Created by Mohammad Kurabi on 5/19/18. +// + +import Foundation + +protocol SwipeControllerDelegate: class { + + func swipeController(_ controller: SwipeController, canBeginEditingSwipeableFor orientation: SwipeActionsOrientation) -> Bool + + func swipeController(_ controller: SwipeController, editActionsForSwipeableFor orientation: SwipeActionsOrientation) -> [SwipeAction]? + + func swipeController(_ controller: SwipeController, editActionsOptionsForSwipeableFor orientation: SwipeActionsOrientation) -> SwipeOptions + + func swipeController(_ controller: SwipeController, willBeginEditingSwipeableFor orientation: SwipeActionsOrientation) + + func swipeController(_ controller: SwipeController, didEndEditingSwipeableFor orientation: SwipeActionsOrientation) + + func swipeController(_ controller: SwipeController, didDeleteSwipeableAt indexPath: IndexPath) + + func swipeController(_ controller: SwipeController, visibleRectFor scrollView: UIScrollView) -> CGRect? + +} + +class SwipeController: NSObject { + + weak var swipeable: (UIView & Swipeable)? + weak var actionsContainerView: UIView? + + weak var delegate: SwipeControllerDelegate? + weak var scrollView: UIScrollView? + + var animator: SwipeAnimator? + + let elasticScrollRatio: CGFloat = 0.4 + + var originalCenter: CGFloat = 0 + var scrollRatio: CGFloat = 1.0 + var originalLayoutMargins: UIEdgeInsets = .zero + + lazy var panGestureRecognizer: UIPanGestureRecognizer = { + let gesture = UIPanGestureRecognizer(target: self, action: #selector(handlePan(gesture:))) + gesture.delegate = self + return gesture + }() + + lazy var tapGestureRecognizer: UITapGestureRecognizer = { + let gesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(gesture:))) + gesture.delegate = self + return gesture + }() + + init(swipeable: UIView & Swipeable, actionsContainerView: UIView) { + self.swipeable = swipeable + self.actionsContainerView = actionsContainerView + + super.init() + + configure() + } + + @objc func handlePan(gesture: UIPanGestureRecognizer) { + guard let target = actionsContainerView, var swipeable = self.swipeable else { return } + + let velocity = gesture.velocity(in: target) + + if delegate?.swipeController(self, canBeginEditingSwipeableFor: velocity.x > 0 ? .left : .right) == false { + return + } + + switch gesture.state { + case .began: + if let swipeable = scrollView?.swipeables.first(where: { $0.state == .dragging }) as? UIView, swipeable != self.swipeable { + return + } + + stopAnimatorIfNeeded() + + originalCenter = target.center.x + + if swipeable.state == .center || swipeable.state == .animatingToCenter { + let orientation: SwipeActionsOrientation = velocity.x > 0 ? .left : .right + + showActionsView(for: orientation) + } + case .changed: + guard let actionsView = swipeable.actionsView, let actionsContainerView = self.actionsContainerView else { return } + guard swipeable.state.isActive else { return } + + if swipeable.state == .animatingToCenter { + let swipedCell = scrollView?.swipeables.first(where: { $0.state == .dragging || $0.state == .left || $0.state == .right }) as? UIView + if let swipedCell = swipedCell, swipedCell != self.swipeable { + return + } + } + + let translation = gesture.translation(in: target).x + scrollRatio = 1.0 + + // Check if dragging past the center of the opposite direction of action view, if so + // then we need to apply elasticity + if (translation + originalCenter - swipeable.bounds.midX) * actionsView.orientation.scale > 0 { + target.center.x = gesture.elasticTranslation(in: target, + withLimit: .zero, + fromOriginalCenter: CGPoint(x: originalCenter, y: 0)).x + swipeable.actionsView?.visibleWidth = abs((swipeable as Swipeable).frame.minX) + scrollRatio = elasticScrollRatio + return + } + + if let expansionStyle = actionsView.options.expansionStyle, let scrollView = scrollView { + + let referenceFrame = actionsContainerView != swipeable ? actionsContainerView.frame : nil; + let expanded = expansionStyle.shouldExpand(view: swipeable, gesture: gesture, in: scrollView, within: referenceFrame) + let targetOffset = expansionStyle.targetOffset(for: swipeable) + let currentOffset = abs(translation + originalCenter - swipeable.bounds.midX) + + if expanded && !actionsView.expanded && targetOffset > currentOffset { + let centerForTranslationToEdge = swipeable.bounds.midX - targetOffset * actionsView.orientation.scale + let delta = centerForTranslationToEdge - originalCenter + + animate(toOffset: centerForTranslationToEdge) + gesture.setTranslation(CGPoint(x: delta, y: 0), in: swipeable.superview!) + } else { + target.center.x = gesture.elasticTranslation(in: target, + withLimit: CGSize(width: targetOffset, height: 0), + fromOriginalCenter: CGPoint(x: originalCenter, y: 0), + applyingRatio: expansionStyle.targetOverscrollElasticity).x + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + } + + actionsView.setExpanded(expanded: expanded, feedback: true) + } else { + target.center.x = gesture.elasticTranslation(in: target, + withLimit: CGSize(width: actionsView.preferredWidth, height: 0), + fromOriginalCenter: CGPoint(x: originalCenter, y: 0), + applyingRatio: elasticScrollRatio).x + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + + if (target.center.x - originalCenter) / translation != 1.0 { + scrollRatio = elasticScrollRatio + } + } + case .ended, .cancelled, .failed: + guard let actionsView = swipeable.actionsView, let actionsContainerView = self.actionsContainerView else { return } + if swipeable.state.isActive == false && swipeable.bounds.midX == target.center.x { + return + } + + swipeable.state = targetState(forVelocity: velocity) + + if actionsView.expanded == true, let expandedAction = actionsView.expandableAction { + perform(action: expandedAction) + } else { + let targetOffset = targetCenter(active: swipeable.state.isActive) + let distance = targetOffset - actionsContainerView.center.x + let normalizedVelocity = velocity.x * scrollRatio / distance + + animate(toOffset: targetOffset, withInitialVelocity: normalizedVelocity) { _ in + if self.swipeable?.state == .center { + self.reset() + } + } + + if !swipeable.state.isActive { + delegate?.swipeController(self, didEndEditingSwipeableFor: actionsView.orientation) + } + } + default: break + } + } + + @discardableResult + func showActionsView(for orientation: SwipeActionsOrientation) -> Bool { + guard let actions = delegate?.swipeController(self, editActionsForSwipeableFor: orientation), actions.count > 0 else { return false } + guard let swipeable = self.swipeable else { return false } + + originalLayoutMargins = swipeable.layoutMargins + + configureActionsView(with: actions, for: orientation) + + delegate?.swipeController(self, willBeginEditingSwipeableFor: orientation) + + return true + } + + func configureActionsView(with actions: [SwipeAction], for orientation: SwipeActionsOrientation) { + guard var swipeable = self.swipeable, + let actionsContainerView = self.actionsContainerView, + let scrollView = self.scrollView else { + return + } + + let options = delegate?.swipeController(self, editActionsOptionsForSwipeableFor: orientation) ?? SwipeOptions() + + swipeable.actionsView?.removeFromSuperview() + swipeable.actionsView = nil + + var contentEdgeInsets = UIEdgeInsets.zero + if let visibleTableViewRect = delegate?.swipeController(self, visibleRectFor: scrollView) { + + let frame = (swipeable as Swipeable).frame + let visibleSwipeableRect = frame.intersection(visibleTableViewRect) + if visibleSwipeableRect.isNull == false { + let top = visibleSwipeableRect.minY > frame.minY ? max(0, visibleSwipeableRect.minY - frame.minY) : 0 + let bottom = max(0, frame.size.height - visibleSwipeableRect.size.height - top) + contentEdgeInsets = UIEdgeInsets(top: top, left: 0, bottom: bottom, right: 0) + } + } + + let actionsView = SwipeActionsView(contentEdgeInsets: contentEdgeInsets, + maxSize: swipeable.bounds.size, + safeAreaInsetView: scrollView, + options: options, + orientation: orientation, + actions: actions) + actionsView.delegate = self + + actionsContainerView.addSubview(actionsView) + + actionsView.heightAnchor.constraint(equalTo: swipeable.heightAnchor).isActive = true + actionsView.widthAnchor.constraint(equalTo: swipeable.widthAnchor, multiplier: 2).isActive = true + actionsView.topAnchor.constraint(equalTo: swipeable.topAnchor).isActive = true + + if orientation == .left { + actionsView.rightAnchor.constraint(equalTo: actionsContainerView.leftAnchor).isActive = true + } else { + actionsView.leftAnchor.constraint(equalTo: actionsContainerView.rightAnchor).isActive = true + } + + actionsView.setNeedsUpdateConstraints() + + swipeable.actionsView = actionsView + + swipeable.state = .dragging + } + + func animate(duration: Double = 0.7, toOffset offset: CGFloat, withInitialVelocity velocity: CGFloat = 0, completion: ((Bool) -> Void)? = nil) { + stopAnimatorIfNeeded() + + swipeable?.layoutIfNeeded() + + let animator: SwipeAnimator = { + if velocity != 0 { + if #available(iOS 10, *) { + let velocity = CGVector(dx: velocity, dy: velocity) + let parameters = UISpringTimingParameters(mass: 1.0, stiffness: 100, damping: 18, initialVelocity: velocity) + return UIViewPropertyAnimator(duration: 0.0, timingParameters: parameters) + } else { + return UIViewSpringAnimator(duration: duration, damping: 1.0, initialVelocity: velocity) + } + } else { + if #available(iOS 10, *) { + return UIViewPropertyAnimator(duration: duration, dampingRatio: 1.0) + } else { + return UIViewSpringAnimator(duration: duration, damping: 1.0) + } + } + }() + + animator.addAnimations({ + guard let swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return } + + actionsContainerView.center = CGPoint(x: offset, y: actionsContainerView.center.y) + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + swipeable.layoutIfNeeded() + }) + + if let completion = completion { + animator.addCompletion(completion: completion) + } + + self.animator = animator + + animator.startAnimation() + } + + func traitCollectionDidChange(from previousTraitCollrection: UITraitCollection?, to traitCollection: UITraitCollection) { + guard let swipeable = self.swipeable, + let actionsContainerView = self.actionsContainerView, + previousTraitCollrection != nil else { + return + } + + if swipeable.state == .left || swipeable.state == .right { + let targetOffset = targetCenter(active: swipeable.state.isActive) + actionsContainerView.center = CGPoint(x: targetOffset, y: actionsContainerView.center.y) + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + swipeable.layoutIfNeeded() + } + } + + func stopAnimatorIfNeeded() { + if animator?.isRunning == true { + animator?.stopAnimation(true) + } + } + + @objc func handleTap(gesture: UITapGestureRecognizer) { + hideSwipe(animated: true) + } + + @objc func handleTablePan(gesture: UIPanGestureRecognizer) { + if gesture.state == .began { + hideSwipe(animated: true) + } + } + + func targetState(forVelocity velocity: CGPoint) -> SwipeState { + guard let actionsView = swipeable?.actionsView else { return .center } + + switch actionsView.orientation { + case .left: + return (velocity.x < 0 && !actionsView.expanded) ? .center : .left + case .right: + return (velocity.x > 0 && !actionsView.expanded) ? .center : .right + } + } + + func targetCenter(active: Bool) -> CGFloat { + guard let swipeable = self.swipeable else { return 0 } + guard let actionsView = swipeable.actionsView, active == true else { return swipeable.bounds.midX } + + return swipeable.bounds.midX - actionsView.preferredWidth * actionsView.orientation.scale + } + + func configure() { + swipeable?.addGestureRecognizer(tapGestureRecognizer) + swipeable?.addGestureRecognizer(panGestureRecognizer) + } + + func reset() { + swipeable?.state = .center + + swipeable?.actionsView?.removeFromSuperview() + swipeable?.actionsView = nil + } + +} + +extension SwipeController: UIGestureRecognizerDelegate { + func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { + if gestureRecognizer == tapGestureRecognizer { + if UIAccessibility.isVoiceOverRunning { + scrollView?.hideSwipeables() + } + + let swipedCell = scrollView?.swipeables.first(where: { + $0.state.isActive || + $0.panGestureRecognizer.state == .began || + $0.panGestureRecognizer.state == .changed || + $0.panGestureRecognizer.state == .ended + }) + return swipedCell == nil ? false : true + } + + if gestureRecognizer == panGestureRecognizer, + let view = gestureRecognizer.view, + let gestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer { + let translation = gestureRecognizer.translation(in: view) + return abs(translation.y) <= abs(translation.x) + } + + return true + } +} + +extension SwipeController: SwipeActionsViewDelegate { + func swipeActionsView(_ swipeActionsView: SwipeActionsView, didSelect action: SwipeAction) { + perform(action: action) + } + + func perform(action: SwipeAction) { + guard let actionsView = swipeable?.actionsView else { return } + + if action == actionsView.expandableAction, let expansionStyle = actionsView.options.expansionStyle { + // Trigger the expansion (may already be expanded from drag) + actionsView.setExpanded(expanded: true) + + switch expansionStyle.completionAnimation { + case .bounce: + perform(action: action, hide: true) + case .fill(let fillOption): + performFillAction(action: action, fillOption: fillOption) + } + } else { + perform(action: action, hide: action.hidesWhenSelected) + } + } + + func perform(action: SwipeAction, hide: Bool) { + guard let indexPath = swipeable?.indexPath else { return } + + if hide { + hideSwipe(animated: true) + } + + action.handler?(action, indexPath) + } + + func performFillAction(action: SwipeAction, fillOption: SwipeExpansionStyle.FillOptions) { + guard let swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return } + guard let actionsView = swipeable.actionsView, let indexPath = swipeable.indexPath else { return } + + let newCenter = swipeable.bounds.midX - (swipeable.bounds.width + actionsView.minimumButtonWidth) * actionsView.orientation.scale + + action.completionHandler = { [weak self] style in + guard let `self` = self else { return } + action.completionHandler = nil + + self.delegate?.swipeController(self, didEndEditingSwipeableFor: actionsView.orientation) + + switch style { + case .delete: + actionsContainerView.mask = actionsView.createDeletionMask() + + self.delegate?.swipeController(self, didDeleteSwipeableAt: indexPath) + + UIView.animate(withDuration: 0.3, animations: { + guard let actionsContainerView = self.actionsContainerView else { return } + + actionsContainerView.center.x = newCenter + actionsContainerView.mask?.frame.size.height = 0 + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + + if fillOption.timing == .after { + actionsView.alpha = 0 + } + }) { [weak self] _ in + self?.actionsContainerView?.mask = nil + self?.reset() + } + case .reset: + self.hideSwipe(animated: true) + } + } + + let invokeAction = { + action.handler?(action, indexPath) + + if let style = fillOption.autoFulFillmentStyle { + action.fulfill(with: style) + } + } + + animate(duration: 0.3, toOffset: newCenter) { _ in + if fillOption.timing == .after { + invokeAction() + } + } + + if fillOption.timing == .with { + invokeAction() + } + } + + func hideSwipe(animated: Bool, completion: ((Bool) -> Void)? = nil) { + guard var swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return } + guard swipeable.state == .left || swipeable.state == .right else { return } + guard let actionView = swipeable.actionsView else { return } + + swipeable.state = .animatingToCenter + + let targetCenter = self.targetCenter(active: false) + + if animated { + animate(toOffset: targetCenter) { complete in + self.reset() + completion?(complete) + } + } else { + actionsContainerView.center = CGPoint(x: targetCenter, y: actionsContainerView.center.y) + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + reset() + } + + delegate?.swipeController(self, didEndEditingSwipeableFor: actionView.orientation) + } + + func showSwipe(orientation: SwipeActionsOrientation, animated: Bool = true, completion: ((Bool) -> Void)? = nil) { + setSwipeOffset(.greatestFiniteMagnitude * orientation.scale * -1, + animated: animated, + completion: completion) + } + + func setSwipeOffset(_ offset: CGFloat, animated: Bool = true, completion: ((Bool) -> Void)? = nil) { + guard var swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return } + + guard offset != 0 else { + hideSwipe(animated: animated, completion: completion) + return + } + + let orientation: SwipeActionsOrientation = offset > 0 ? .left : .right + let targetState = SwipeState(orientation: orientation) + + if swipeable.state != targetState { + guard showActionsView(for: orientation) else { return } + + scrollView?.hideSwipeables() + + swipeable.state = targetState + } + + let maxOffset = min(swipeable.bounds.width, abs(offset)) * orientation.scale * -1 + let targetCenter = abs(offset) == CGFloat.greatestFiniteMagnitude ? self.targetCenter(active: true) : swipeable.bounds.midX + maxOffset + + if animated { + animate(toOffset: targetCenter) { complete in + completion?(complete) + } + } else { + actionsContainerView.center.x = targetCenter + swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX) + } + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpanding.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpanding.swift new file mode 100644 index 0000000..44bf558 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpanding.swift @@ -0,0 +1,120 @@ +// +// SwipeExpanding.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/** + Adopt the `SwipeExpanding` protocol in objects that implement custom appearance of actions during expansion. + */ +public protocol SwipeExpanding { + + /** + Asks your object for the animation timing parameters. + + - parameter buttons: The expansion action button, which includes expanding action plus the remaining actions in the view. + + - parameter expanding: The new expansion state. + + - parameter otherActionButtons: The other action buttons in the view, not including the action button being expanded. + */ + + func animationTimingParameters(buttons: [UIButton], expanding: Bool) -> SwipeExpansionAnimationTimingParameters + + /** + Tells your object when the expansion state is changing. + + - parameter button: The expansion action button. + + - parameter expanding: The new expansion state. + + - parameter otherActionButtons: The other action buttons in the view, not including the action button being expanded. + */ + func actionButton(_ button: UIButton, didChange expanding: Bool, otherActionButtons: [UIButton]) +} + +/** + Specifies timing information for the overall expansion animation. + */ +public struct SwipeExpansionAnimationTimingParameters { + + /// Returns a `SwipeExpansionAnimationTimingParameters` instance with default animation parameters. + public static var `default`: SwipeExpansionAnimationTimingParameters { return SwipeExpansionAnimationTimingParameters() } + + /// The duration of the expansion animation. + public var duration: Double + + /// The delay before starting the expansion animation. + public var delay: Double + + /** + Contructs a new `SwipeExpansionAnimationTimingParameters` instance. + + - parameter duration: The duration of the animation. + + - parameter delay: The delay before starting the expansion animation. + + - returns: The new `SwipeExpansionAnimationTimingParameters` instance. + */ + public init(duration: Double = 0.6, delay: Double = 0) { + self.duration = duration + self.delay = delay + } +} + +/** + A scale and alpha expansion object drives the custom appearance of the effected actions during expansion. + */ +public struct ScaleAndAlphaExpansion: SwipeExpanding { + + /// Returns a `ScaleAndAlphaExpansion` instance with default expansion options. + public static var `default`: ScaleAndAlphaExpansion { return ScaleAndAlphaExpansion() } + + /// The duration of the animation. + public let duration: Double + + /// The scale factor used during animation. + public let scale: CGFloat + + /// The inter-button delay between animations. + public let interButtonDelay: Double + + /** + Contructs a new `ScaleAndAlphaExpansion` instance. + + - parameter duration: The duration of the animation. + + - parameter scale: The scale factor used during animation. + + - parameter interButtonDelay: The inter-button delay between animations. + + - returns: The new `ScaleAndAlphaExpansion` instance. + */ + public init(duration: Double = 0.15, scale: CGFloat = 0.8, interButtonDelay: Double = 0.1) { + self.duration = duration + self.scale = scale + self.interButtonDelay = interButtonDelay + } + + /// :nodoc: + public func animationTimingParameters(buttons: [UIButton], expanding: Bool) -> SwipeExpansionAnimationTimingParameters { + var timingParameters = SwipeExpansionAnimationTimingParameters.default + timingParameters.delay = expanding ? interButtonDelay : 0 + return timingParameters + } + + /// :nodoc: + public func actionButton(_ button: UIButton, didChange expanding: Bool, otherActionButtons: [UIButton]) { + let buttons = expanding ? otherActionButtons : otherActionButtons.reversed() + + buttons.enumerated().forEach { index, button in + UIView.animate(withDuration: duration, delay: interButtonDelay * Double(expanding ? index : index + 1), options: [], animations: { + button.transform = expanding ? .init(scaleX: self.scale, y: self.scale) : .identity + button.alpha = expanding ? 0.0 : 1.0 + }, completion: nil) + } + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpansionStyle.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpansionStyle.swift new file mode 100644 index 0000000..40a2012 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeExpansionStyle.swift @@ -0,0 +1,239 @@ +// +// SwipeExpansionStyle.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/// Describes the expansion style. Expansion is the behavior when the cell is swiped past a defined threshold. +public struct SwipeExpansionStyle { + /// The default action performs a selection-type behavior. The cell bounces back to its unopened state upon selection and the row remains in the table/collection view. + public static var selection: SwipeExpansionStyle { return SwipeExpansionStyle(target: .percentage(0.5), + elasticOverscroll: true, + completionAnimation: .bounce) } + + /// The default action performs a destructive behavior. The cell is removed from the table/collection view in an animated fashion. + public static var destructive: SwipeExpansionStyle { return .destructive(automaticallyDelete: true, timing: .with) } + + /// The default action performs a destructive behavior after the fill animation completes. The cell is removed from the table/collection view in an animated fashion. + public static var destructiveAfterFill: SwipeExpansionStyle { return .destructive(automaticallyDelete: true, timing: .after) } + + /// The default action performs a fill behavior. + /// + /// - note: The action handle must call `SwipeAction.fulfill(style:)` to resolve the fill expansion. + public static var fill: SwipeExpansionStyle { return SwipeExpansionStyle(target: .edgeInset(30), + additionalTriggers: [.overscroll(30)], + completionAnimation: .fill(.manual(timing: .after))) } + + /** + Returns a `SwipeExpansionStyle` instance for the default action which peforms destructive behavior with the specified options. + + - parameter automaticallyDelete: Specifies if row/item deletion should be peformed automatically. If `false`, you must call `SwipeAction.fulfill(with style:)` at some point while/after your action handler is invoked to trigger deletion. + + - parameter timing: The timing which specifies when the action handler will be invoked with respect to the fill animation. + + - returns: The new `SwipeExpansionStyle` instance. + */ + public static func destructive(automaticallyDelete: Bool, timing: FillOptions.HandlerInvocationTiming = .with) -> SwipeExpansionStyle { + return SwipeExpansionStyle(target: .edgeInset(30), + additionalTriggers: [.touchThreshold(0.8)], + completionAnimation: .fill(automaticallyDelete ? .automatic(.delete, timing: timing) : .manual(timing: timing))) + } + + /// The relative target expansion threshold. Expansion will occur at the specified value. + public let target: Target + + /// Additional triggers to useful for determining if expansion should occur. + public let additionalTriggers: [Trigger] + + /// Specifies if buttons should expand to fully fill overscroll, or expand at a percentage relative to the overscroll. + public let elasticOverscroll: Bool + + /// Specifies the expansion animation completion style. + public let completionAnimation: CompletionAnimation + + /// Specifies the minimum amount of overscroll required if the configured target is less than the fully exposed action view. + public var minimumTargetOverscroll: CGFloat = 20 + + /// The amount of elasticity applied when dragging past the expansion target. + /// + /// - note: Default value is 0.2. Valid range is from 0.0 for no movement past the expansion target, to 1.0 for unrestricted movement with dragging. + public var targetOverscrollElasticity: CGFloat = 0.2 + + var minimumExpansionTranslation: CGFloat = 8.0 + + /** + Contructs a new `SwipeExpansionStyle` instance. + + - parameter target: The relative target expansion threshold. Expansion will occur at the specified value. + + - parameter additionalTriggers: Additional triggers to useful for determining if expansion should occur. + + - parameter elasticOverscroll: Specifies if buttons should expand to fully fill overscroll, or expand at a percentage relative to the overscroll. + + - parameter completionAnimation: Specifies the expansion animation completion style. + + - returns: The new `SwipeExpansionStyle` instance. + */ + public init(target: Target, additionalTriggers: [Trigger] = [], elasticOverscroll: Bool = false, completionAnimation: CompletionAnimation = .bounce) { + self.target = target + self.additionalTriggers = additionalTriggers + self.elasticOverscroll = elasticOverscroll + self.completionAnimation = completionAnimation + } + + func shouldExpand(view: Swipeable, gesture: UIPanGestureRecognizer, in superview: UIView, within frame: CGRect? = nil) -> Bool { + guard let actionsView = view.actionsView, let gestureView = gesture.view else { return false } + guard abs(gesture.translation(in: gestureView).x) > minimumExpansionTranslation else { return false } + + let xDelta = floor(abs(frame?.minX ?? view.frame.minX)) + if xDelta <= actionsView.preferredWidth { + return false + } else if xDelta > targetOffset(for: view) { + return true + } + + // Use the frame instead of superview as Swipeable may not be full width of superview + let referenceFrame: CGRect = frame != nil ? view.frame : superview.bounds + for trigger in additionalTriggers { + if trigger.isTriggered(view: view, gesture: gesture, in: superview, referenceFrame: referenceFrame) { + return true + } + } + + return false + } + + func targetOffset(for view: Swipeable) -> CGFloat { + return target.offset(for: view, minimumOverscroll: minimumTargetOverscroll) + } +} + +extension SwipeExpansionStyle { + /// Describes the relative target expansion threshold. Expansion will occur at the specified value. + public enum Target { + /// The target is specified by a percentage. + case percentage(CGFloat) + + /// The target is specified by a edge inset. + case edgeInset(CGFloat) + + func offset(for view: Swipeable, minimumOverscroll: CGFloat) -> CGFloat { + guard let actionsView = view.actionsView else { return .greatestFiniteMagnitude } + + let offset: CGFloat = { + switch self { + case .percentage(let value): + return view.frame.width * value + case .edgeInset(let value): + return view.frame.width - value + } + }() + + return max(actionsView.preferredWidth + minimumOverscroll, offset) + } + } + + /// Describes additional triggers to useful for determining if expansion should occur. + public enum Trigger { + /// The trigger is specified by a touch occuring past the supplied percentage in the superview. + case touchThreshold(CGFloat) + + /// The trigger is specified by the distance in points past the fully exposed action view. + case overscroll(CGFloat) + + func isTriggered(view: Swipeable, gesture: UIPanGestureRecognizer, in superview: UIView, referenceFrame: CGRect) -> Bool { + guard let actionsView = view.actionsView else { return false } + + switch self { + case .touchThreshold(let value): + let location = gesture.location(in: superview).x - referenceFrame.origin.x + let locationRatio = (actionsView.orientation == .left ? location : referenceFrame.width - location) / referenceFrame.width + return locationRatio > value + case .overscroll(let value): + return abs(view.frame.minX) > actionsView.preferredWidth + value + } + } + } + + /// Describes the expansion animation completion style. + public enum CompletionAnimation { + /// The expansion will completely fill the item. + case fill(FillOptions) + + /// The expansion will bounce back from the trigger point and hide the action view, resetting the item. + case bounce + } + + /// Specifies the options for the fill completion animation. + public struct FillOptions { + /// Describes when the action handler will be invoked with respect to the fill animation. + public enum HandlerInvocationTiming { + /// The action handler is invoked with the fill animation. + case with + + /// The action handler is invoked after the fill animation completes. + case after + } + + /** + Returns a `FillOptions` instance with automatic fulfillemnt. + + - parameter style: The fulfillment style describing how expansion should be resolved once the action has been fulfilled. + + - parameter timing: The timing which specifies when the action handler will be invoked with respect to the fill animation. + + - returns: The new `FillOptions` instance. + */ + public static func automatic(_ style: ExpansionFulfillmentStyle, timing: HandlerInvocationTiming) -> FillOptions { + return FillOptions(autoFulFillmentStyle: style, timing: timing) + } + + /** + Returns a `FillOptions` instance with manual fulfillemnt. + + - parameter timing: The timing which specifies when the action handler will be invoked with respect to the fill animation. + + - returns: The new `FillOptions` instance. + */ + public static func manual(timing: HandlerInvocationTiming) -> FillOptions { + return FillOptions(autoFulFillmentStyle: nil, timing: timing) + } + + /// The fulfillment style describing how expansion should be resolved once the action has been fulfilled. + public let autoFulFillmentStyle: ExpansionFulfillmentStyle? + + /// The timing which specifies when the action handler will be invoked with respect to the fill animation. + public let timing: HandlerInvocationTiming + } +} + +extension SwipeExpansionStyle.Target: Equatable { + /// :nodoc: + public static func ==(lhs: SwipeExpansionStyle.Target, rhs: SwipeExpansionStyle.Target) -> Bool { + switch (lhs, rhs) { + case (.percentage(let lhs), .percentage(let rhs)): + return lhs == rhs + case (.edgeInset(let lhs), .edgeInset(let rhs)): + return lhs == rhs + default: + return false + } + } +} + +extension SwipeExpansionStyle.CompletionAnimation: Equatable { + /// :nodoc: + public static func ==(lhs: SwipeExpansionStyle.CompletionAnimation, rhs: SwipeExpansionStyle.CompletionAnimation) -> Bool { + switch (lhs, rhs) { + case (.fill, .fill): + return true + case (.bounce, .bounce): + return true + default: + return false + } + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeFeedback.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeFeedback.swift new file mode 100644 index 0000000..6c2be8e --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeFeedback.swift @@ -0,0 +1,56 @@ +// +// SwipeFeedback.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +final class SwipeFeedback { + enum Style { + case light + case medium + case heavy + } + + @available(iOS 10.0.1, *) + private var feedbackGenerator: UIImpactFeedbackGenerator? { + get { + return _feedbackGenerator as? UIImpactFeedbackGenerator + } + set { + _feedbackGenerator = newValue + } + } + + private var _feedbackGenerator: Any? + + init(style: Style) { + if #available(iOS 10.0.1, *) { + switch style { + case .light: + feedbackGenerator = UIImpactFeedbackGenerator(style: .light) + case .medium: + feedbackGenerator = UIImpactFeedbackGenerator(style: .medium) + case .heavy: + feedbackGenerator = UIImpactFeedbackGenerator(style: .heavy) + } + } else { + _feedbackGenerator = nil + } + } + + func prepare() { + if #available(iOS 10.0.1, *) { + feedbackGenerator?.prepare() + } + } + + func impactOccurred() { + if #available(iOS 10.0.1, *) { + feedbackGenerator?.impactOccurred() + } + } +} + diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeOptions.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeOptions.swift new file mode 100644 index 0000000..31227b3 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeOptions.swift @@ -0,0 +1,88 @@ +// +// Options.swift +// +// Created by Jeremy Koch. +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/// :nodoc: +public typealias SwipeTableOptions = SwipeOptions + +/// The `SwipeOptions` class provides options for transistion and expansion behavior for swiped cell. +public struct SwipeOptions { + /// The transition style. Transition is the style of how the action buttons are exposed during the swipe. + public var transitionStyle: SwipeTransitionStyle = .border + + /// The expansion style. Expansion is the behavior when the cell is swiped past a defined threshold. + public var expansionStyle: SwipeExpansionStyle? + + /// The object that is notified when expansion changes. + /// + /// - note: If an `expansionDelegate` is not provided, and the expanding action is configured with a clear background, the system automatically uses the default `ScaleAndAlphaExpansion` to show/hide underlying actions. + public var expansionDelegate: SwipeExpanding? + + /// The background color behind the action buttons. + public var backgroundColor: UIColor? + + /// The largest allowable button width. + /// + /// - note: By default, the value is set to the table/collection view divided by the number of action buttons minus some additional padding. If the value is set to 0, then word wrapping will not occur and the buttons will grow as large as needed to fit the entire title/image. + public var maximumButtonWidth: CGFloat? + + /// The smallest allowable button width. + /// + /// - note: By default, the system chooses an appropriate size. + public var minimumButtonWidth: CGFloat? + + /// The vertical alignment mode used for when a button image and title are present. + public var buttonVerticalAlignment: SwipeVerticalAlignment = .centerFirstBaseline + + /// The amount of space, in points, between the border and the button image or title. + public var buttonPadding: CGFloat? + + /// The amount of space, in points, between the button image and the button title. + public var buttonSpacing: CGFloat? + + /// Constructs a new `SwipeOptions` instance with default options. + public init() {} +} + +/// Describes the transition style. Transition is the style of how the action buttons are exposed during the swipe. +public enum SwipeTransitionStyle { + /// The visible action area is equally divide between all action buttons. + case border + + /// The visible action area is dragged, pinned to the cell, with each action button fully sized as it is exposed. + case drag + + /// The visible action area sits behind the cell, pinned to the edge of the table/collection view, and is revealed as the cell is dragged aside. + case reveal +} + +/// Describes which side of the cell that the action buttons will be displayed. +public enum SwipeActionsOrientation: CGFloat { + /// The left side of the cell. + case left = -1 + + /// The right side of the cell. + case right = 1 + + var scale: CGFloat { + return rawValue + } +} + +/// Describes the alignment mode used when action button images and titles are provided. +public enum SwipeVerticalAlignment { + /// All actions will be inspected and the tallest image and first baseline offset of title text will be used to create the alignment rectangle. + /// + /// - note: This mode will ensure the image and first line of each button title and consistently aligned across the swipe view. + case centerFirstBaseline + + /// The action button image height and full title height are used to create the aligment rectange. + /// + /// - note: Buttons with varying number of lines will not be consistently aligned across the swipe view. + case center +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Accessibility.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Accessibility.swift new file mode 100644 index 0000000..beac214 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Accessibility.swift @@ -0,0 +1,80 @@ +// +// SwipeTableViewCell+Accessibility.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +extension SwipeTableViewCell { + /// :nodoc: + open override func accessibilityElementCount() -> Int { + guard state != .center else { + return super.accessibilityElementCount() + } + + return 1 + } + + /// :nodoc: + open override func accessibilityElement(at index: Int) -> Any? { + guard state != .center else { + return super.accessibilityElement(at: index) + } + + return actionsView + } + + /// :nodoc: + open override func index(ofAccessibilityElement element: Any) -> Int { + guard state != .center else { + return super.index(ofAccessibilityElement: element) + } + + return element is SwipeActionsView ? 0 : NSNotFound + } +} + +extension SwipeTableViewCell { + /// :nodoc: + open override var accessibilityCustomActions: [UIAccessibilityCustomAction]? { + get { + guard let tableView = tableView, let indexPath = tableView.indexPath(for: self) else { + return super.accessibilityCustomActions + } + + let leftActions = delegate?.tableView(tableView, editActionsForRowAt: indexPath, for: .left) ?? [] + let rightActions = delegate?.tableView(tableView, editActionsForRowAt: indexPath, for: .right) ?? [] + + let actions = [rightActions.first, leftActions.first].compactMap({ $0 }) + rightActions.dropFirst() + leftActions.dropFirst() + + if actions.count > 0 { + return actions.map({ SwipeAccessibilityCustomAction(action: $0, + indexPath: indexPath, + target: self, + selector: #selector(performAccessibilityCustomAction(accessibilityCustomAction:))) }) + } else { + return super.accessibilityCustomActions + } + } + + set { + super.accessibilityCustomActions = newValue + } + } + + @objc func performAccessibilityCustomAction(accessibilityCustomAction: SwipeAccessibilityCustomAction) -> Bool { + guard let tableView = tableView else { return false } + + let swipeAction = accessibilityCustomAction.action + + swipeAction.handler?(swipeAction, accessibilityCustomAction.indexPath) + + if swipeAction.style == .destructive { + tableView.deleteRows(at: [accessibilityCustomAction.indexPath], with: .fade) + } + + return true + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Display.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Display.swift new file mode 100644 index 0000000..85133b5 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell+Display.swift @@ -0,0 +1,55 @@ +// +// SwipeTableViewCell+Display.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +extension SwipeTableViewCell { + /// The point at which the origin of the cell is offset from the non-swiped origin. + public var swipeOffset: CGFloat { + set { setSwipeOffset(newValue, animated: false) } + get { return frame.midX - bounds.midX } + } + + /** + Hides the swipe actions and returns the cell to center. + + - parameter animated: Specify `true` to animate the hiding of the swipe actions or `false` to hide it immediately. + + - parameter completion: The closure to be executed once the animation has finished. A `Boolean` argument indicates whether or not the animations actually finished before the completion handler was called. + */ + public func hideSwipe(animated: Bool, completion: ((Bool) -> Void)? = nil) { + swipeController.hideSwipe(animated: animated, completion: completion) + } + + /** + Shows the swipe actions for the specified orientation. + + - parameter orientation: The side of the cell on which to show the swipe actions. + + - parameter animated: Specify `true` to animate the showing of the swipe actions or `false` to show them immediately. + + - parameter completion: The closure to be executed once the animation has finished. A `Boolean` argument indicates whether or not the animations actually finished before the completion handler was called. + */ + public func showSwipe(orientation: SwipeActionsOrientation, animated: Bool = true, completion: ((Bool) -> Void)? = nil) { + setSwipeOffset(.greatestFiniteMagnitude * orientation.scale * -1, + animated: animated, + completion: completion) + } + + /** + The point at which the origin of the cell is offset from the non-swiped origin. + + - parameter offset: A point (expressed in points) that is offset from the non-swiped origin. + + - parameter animated: Specify `true` to animate the transition to the new offset, `false` to make the transition immediate. + + - parameter completion: The closure to be executed once the animation has finished. A `Boolean` argument indicates whether or not the animations actually finished before the completion handler was called. + */ + public func setSwipeOffset(_ offset: CGFloat, animated: Bool = true, completion: ((Bool) -> Void)? = nil) { + swipeController.setSwipeOffset(offset, animated: animated, completion: completion) + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell.swift new file mode 100755 index 0000000..e5d5f09 --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCell.swift @@ -0,0 +1,227 @@ +// +// SwipeTableViewCell.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/** + The `SwipeTableViewCell` class extends `UITableViewCell` and provides more flexible options for cell swiping behavior. + + + The default behavior closely matches the stock Mail.app. If you want to customize the transition style (ie. how the action buttons are exposed), or the expansion style (the behavior when the row is swiped passes a defined threshold), you can return the appropriately configured `SwipeOptions` via the `SwipeTableViewCellDelegate` delegate. + */ +open class SwipeTableViewCell: UITableViewCell { + + /// The object that acts as the delegate of the `SwipeTableViewCell`. + public weak var delegate: SwipeTableViewCellDelegate? + + var state = SwipeState.center + var actionsView: SwipeActionsView? + var scrollView: UIScrollView? { + return tableView + } + var indexPath: IndexPath? { + return tableView?.indexPath(for: self) + } + var panGestureRecognizer: UIGestureRecognizer + { + return swipeController.panGestureRecognizer; + } + + var swipeController: SwipeController! + var isPreviouslySelected = false + + weak var tableView: UITableView? + + /// :nodoc: + open override var frame: CGRect { + set { super.frame = state.isActive ? CGRect(origin: CGPoint(x: frame.minX, y: newValue.minY), size: newValue.size) : newValue } + get { return super.frame } + } + + /// :nodoc: + open override var layoutMargins: UIEdgeInsets { + get { + return frame.origin.x != 0 ? swipeController.originalLayoutMargins : super.layoutMargins + } + set { + super.layoutMargins = newValue + } + } + + /// :nodoc: + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + + configure() + } + + /// :nodoc: + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + + configure() + } + + deinit { + tableView?.panGestureRecognizer.removeTarget(self, action: nil) + } + + func configure() { + clipsToBounds = false + + swipeController = SwipeController(swipeable: self, actionsContainerView: self) + swipeController.delegate = self + } + + /// :nodoc: + override open func prepareForReuse() { + super.prepareForReuse() + + reset() + resetSelectedState() + } + + /// :nodoc: + override open func didMoveToSuperview() { + super.didMoveToSuperview() + + var view: UIView = self + while let superview = view.superview { + view = superview + + if let tableView = view as? UITableView { + self.tableView = tableView + + swipeController.scrollView = tableView; + + tableView.panGestureRecognizer.removeTarget(self, action: nil) + tableView.panGestureRecognizer.addTarget(self, action: #selector(handleTablePan(gesture:))) + return + } + } + } + + /// :nodoc: + override open func setEditing(_ editing: Bool, animated: Bool) { + super.setEditing(editing, animated: animated) + + if editing { + hideSwipe(animated: false) + } + } + + // Override so we can accept touches anywhere within the cell's minY/maxY. + // This is required to detect touches on the `SwipeActionsView` sitting alongside the + // `SwipeTableCell`. + /// :nodoc: + override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool { + guard let superview = superview else { return false } + + let point = convert(point, to: superview) + + if !UIAccessibility.isVoiceOverRunning { + for cell in tableView?.swipeCells ?? [] { + if (cell.state == .left || cell.state == .right) && !cell.contains(point: point) { + tableView?.hideSwipeCell() + return false + } + } + } + + return contains(point: point) + } + + func contains(point: CGPoint) -> Bool { + return point.y > frame.minY && point.y < frame.maxY + } + + /// :nodoc: + override open func setHighlighted(_ highlighted: Bool, animated: Bool) { + if state == .center { + super.setHighlighted(highlighted, animated: animated) + } + } + + /// :nodoc: + override open func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { + return swipeController.gestureRecognizerShouldBegin(gestureRecognizer) + } + + /// :nodoc: + open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + swipeController.traitCollectionDidChange(from: previousTraitCollection, to: self.traitCollection) + } + + @objc func handleTablePan(gesture: UIPanGestureRecognizer) { + if gesture.state == .began { + hideSwipe(animated: true) + } + } + + func reset() { + swipeController.reset() + clipsToBounds = false + } + + func resetSelectedState() { + if isPreviouslySelected { + if let tableView = tableView, let indexPath = tableView.indexPath(for: self) { + tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none) + } + } + isPreviouslySelected = false + } +} + +extension SwipeTableViewCell: SwipeControllerDelegate { + func swipeController(_ controller: SwipeController, canBeginEditingSwipeableFor orientation: SwipeActionsOrientation) -> Bool { + return self.isEditing == false + } + + func swipeController(_ controller: SwipeController, editActionsForSwipeableFor orientation: SwipeActionsOrientation) -> [SwipeAction]? { + guard let tableView = tableView, let indexPath = tableView.indexPath(for: self) else { return nil } + + return delegate?.tableView(tableView, editActionsForRowAt: indexPath, for: orientation) + } + + func swipeController(_ controller: SwipeController, editActionsOptionsForSwipeableFor orientation: SwipeActionsOrientation) -> SwipeOptions { + guard let tableView = tableView, let indexPath = tableView.indexPath(for: self) else { return SwipeOptions() } + + return delegate?.tableView(tableView, editActionsOptionsForRowAt: indexPath, for: orientation) ?? SwipeOptions() + } + + func swipeController(_ controller: SwipeController, visibleRectFor scrollView: UIScrollView) -> CGRect? { + guard let tableView = tableView else { return nil } + + return delegate?.visibleRect(for: tableView) + } + + func swipeController(_ controller: SwipeController, willBeginEditingSwipeableFor orientation: SwipeActionsOrientation) { + guard let tableView = tableView, let indexPath = tableView.indexPath(for: self) else { return } + + // Remove highlight and deselect any selected cells + super.setHighlighted(false, animated: false) + isPreviouslySelected = isSelected + tableView.deselectRow(at: indexPath, animated: false) + + delegate?.tableView(tableView, willBeginEditingRowAt: indexPath, for: orientation) + } + + func swipeController(_ controller: SwipeController, didEndEditingSwipeableFor orientation: SwipeActionsOrientation) { + guard let tableView = tableView, let indexPath = tableView.indexPath(for: self), let actionsView = self.actionsView else { return } + + resetSelectedState() + + delegate?.tableView(tableView, didEndEditingRowAt: indexPath, for: actionsView.orientation) + } + + func swipeController(_ controller: SwipeController, didDeleteSwipeableAt indexPath: IndexPath) { + tableView?.deleteRows(at: [indexPath], with: .none) + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCellDelegate.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCellDelegate.swift new file mode 100755 index 0000000..2cf23ba --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTableViewCellDelegate.swift @@ -0,0 +1,92 @@ +// +// SwipeTableViewCellDelegate.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +/** + The `SwipeTableViewCellDelegate` protocol is adopted by an object that manages the display of action buttons when the cell is swiped. + */ +public protocol SwipeTableViewCellDelegate: class { + + /** + Asks the delegate for the actions to display in response to a swipe in the specified row. + + - parameter tableView: The table view object which owns the cell requesting this information. + + - parameter indexPath: The index path of the row. + + - parameter orientation: The side of the cell requesting this information. + + - returns: An array of `SwipeAction` objects representing the actions for the row. Each action you provide is used to create a button that the user can tap. Returning `nil` will prevent swiping for the supplied orientation. + */ + func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? + + /** + Asks the delegate for the display options to be used while presenting the action buttons. + + - parameter tableView: The table view object which owns the cell requesting this information. + + - parameter indexPath: The index path of the row. + + - parameter orientation: The side of the cell requesting this information. + + - returns: A `SwipeOptions` instance which configures the behavior of the action buttons. + + - note: If not implemented, a default `SwipeOptions` instance is used. + */ + func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions + + /** + Tells the delegate that the table view is about to go into editing mode. + + - parameter tableView: The table view object providing this information. + + - parameter indexPath: The index path of the row. + + - parameter orientation: The side of the cell. + */ + func tableView(_ tableView: UITableView, willBeginEditingRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) + + /** + Tells the delegate that the table view has left editing mode. + + - parameter tableView: The table view object providing this information. + + - parameter indexPath: The index path of the row. + + - parameter orientation: The side of the cell. + */ + func tableView(_ tableView: UITableView, didEndEditingRowAt indexPath: IndexPath?, for orientation: SwipeActionsOrientation) + + /** + Asks the delegate for visibile rectangle of the table view, which is used to ensure swipe actions are vertically centered within the visible portion of the cell. + + - parameter tableView: The table view object providing this information. + + - returns: The visible rectangle of the table view. + + - note: The returned rectange should be in the table view's own coordinate system. Returning `nil` will result in no vertical offset to be be calculated. + */ + func visibleRect(for tableView: UITableView) -> CGRect? +} + +/** + Default implementation of `SwipeTableViewCellDelegate` methods + */ +public extension SwipeTableViewCellDelegate { + func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions { + return SwipeOptions() + } + + func tableView(_ tableView: UITableView, willBeginEditingRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) {} + + func tableView(_ tableView: UITableView, didEndEditingRowAt indexPath: IndexPath?, for orientation: SwipeActionsOrientation) {} + + func visibleRect(for tableView: UITableView) -> CGRect? { + return nil + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTransitionLayout.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTransitionLayout.swift new file mode 100644 index 0000000..15baf8e --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/SwipeTransitionLayout.swift @@ -0,0 +1,88 @@ +// +// SwipeTransitionLayout.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +// MARK: - Layout Protocol + +protocol SwipeTransitionLayout { + func container(view: UIView, didChangeVisibleWidthWithContext context: ActionsViewLayoutContext) + func layout(view: UIView, atIndex index: Int, with context: ActionsViewLayoutContext) + func visibleWidthsForViews(with context: ActionsViewLayoutContext) -> [CGFloat] +} + +// MARK: - Layout Context + +struct ActionsViewLayoutContext { + let numberOfActions: Int + let orientation: SwipeActionsOrientation + let contentSize: CGSize + let visibleWidth: CGFloat + let minimumButtonWidth: CGFloat + + init(numberOfActions: Int, orientation: SwipeActionsOrientation, contentSize: CGSize = .zero, visibleWidth: CGFloat = 0, minimumButtonWidth: CGFloat = 0) { + self.numberOfActions = numberOfActions + self.orientation = orientation + self.contentSize = contentSize + self.visibleWidth = visibleWidth + self.minimumButtonWidth = minimumButtonWidth + } + + static func newContext(for actionsView: SwipeActionsView) -> ActionsViewLayoutContext { + return ActionsViewLayoutContext(numberOfActions: actionsView.actions.count, + orientation: actionsView.orientation, + contentSize: actionsView.contentSize, + visibleWidth: actionsView.visibleWidth, + minimumButtonWidth: actionsView.minimumButtonWidth) + } +} + +// MARK: - Supported Layout Implementations + +class BorderTransitionLayout: SwipeTransitionLayout { + func container(view: UIView, didChangeVisibleWidthWithContext context: ActionsViewLayoutContext) { + } + + func layout(view: UIView, atIndex index: Int, with context: ActionsViewLayoutContext) { + let diff = context.visibleWidth - context.contentSize.width + view.frame.origin.x = (CGFloat(index) * context.contentSize.width / CGFloat(context.numberOfActions) + diff) * context.orientation.scale + } + + func visibleWidthsForViews(with context: ActionsViewLayoutContext) -> [CGFloat] { + let diff = context.visibleWidth - context.contentSize.width + let visibleWidth = context.contentSize.width / CGFloat(context.numberOfActions) + diff + + // visible widths are all the same regardless of the action view position + return (0.. [CGFloat] { + return (0.. [CGFloat] { + return super.visibleWidthsForViews(with: context).reversed() + } +} diff --git a/ALTableViewSwift/Pods/SwipeCellKit/Source/Swipeable.swift b/ALTableViewSwift/Pods/SwipeCellKit/Source/Swipeable.swift new file mode 100644 index 0000000..ba0474a --- /dev/null +++ b/ALTableViewSwift/Pods/SwipeCellKit/Source/Swipeable.swift @@ -0,0 +1,41 @@ +// +// Swipeable.swift +// +// Created by Jeremy Koch +// Copyright © 2017 Jeremy Koch. All rights reserved. +// + +import UIKit + +// MARK: - Internal + +protocol Swipeable { + var state: SwipeState { get set } + + var actionsView: SwipeActionsView? { get set } + + var frame: CGRect { get } + + var scrollView: UIScrollView? { get } + + var indexPath: IndexPath? { get } + + var panGestureRecognizer: UIGestureRecognizer { get } +} + +extension SwipeTableViewCell: Swipeable {} +extension SwipeCollectionViewCell: Swipeable {} + +enum SwipeState: Int { + case center = 0 + case left + case right + case dragging + case animatingToCenter + + init(orientation: SwipeActionsOrientation) { + self = orientation == .left ? .left : .right + } + + var isActive: Bool { return self != .center } +} diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableView/Pods-ALTableView-resources.sh b/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableView/Pods-ALTableView-resources.sh index a7df440..345301f 100755 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableView/Pods-ALTableView-resources.sh +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableView/Pods-ALTableView-resources.sh @@ -1,5 +1,13 @@ #!/bin/sh set -e +set -u +set -o pipefail + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" @@ -12,7 +20,7 @@ XCASSET_FILES=() # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") -case "${TARGETED_DEVICE_FAMILY}" in +case "${TARGETED_DEVICE_FAMILY:-}" in 1,2) TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" ;; @@ -92,7 +100,7 @@ if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then fi rm -f "$RESOURCES_TO_COPY" -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) @@ -102,5 +110,9 @@ then fi done <<<"$OTHER_XCASSETS" - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi fi diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-frameworks.sh b/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-frameworks.sh index 881cbae..08e3eaa 100755 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-frameworks.sh +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-frameworks.sh @@ -1,9 +1,18 @@ #!/bin/sh set -e +set -u +set -o pipefail + +if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then + # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy + # frameworks to, so exit 0 (signalling the script phase was successful). + exit 0 +fi echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" # Used as a return value for each invocation of `strip_invalid_archs` function. @@ -92,10 +101,10 @@ install_dsym() { # Signs a framework with the provided identity code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then # Use the current code_sign_identitiy echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then code_sign_cmd="$code_sign_cmd &" diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-resources.sh b/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-resources.sh index a7df440..345301f 100755 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-resources.sh +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-ALTableViewTests/Pods-ALTableViewTests-resources.sh @@ -1,5 +1,13 @@ #!/bin/sh set -e +set -u +set -o pipefail + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" @@ -12,7 +20,7 @@ XCASSET_FILES=() # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") -case "${TARGETED_DEVICE_FAMILY}" in +case "${TARGETED_DEVICE_FAMILY:-}" in 1,2) TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" ;; @@ -92,7 +100,7 @@ if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then fi rm -f "$RESOURCES_TO_COPY" -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) @@ -102,5 +110,9 @@ then fi done <<<"$OTHER_XCASSETS" - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi fi diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.markdown b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.markdown index 102af75..3da9935 100644 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.markdown +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.markdown @@ -1,3 +1,28 @@ # Acknowledgements This application makes use of the following third party libraries: + +## SwipeCellKit + +MIT License +Copyright (c) 2017 Jeremy Koch + +http://jerkoch.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. Generated by CocoaPods - https://cocoapods.org diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.plist b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.plist index 7acbad1..e7a3311 100644 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.plist +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-acknowledgements.plist @@ -12,6 +12,37 @@ Type PSGroupSpecifier + + FooterText + MIT License +Copyright (c) 2017 Jeremy Koch + +http://jerkoch.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + License + MIT + Title + SwipeCellKit + Type + PSGroupSpecifier + FooterText Generated by CocoaPods - https://cocoapods.org diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-frameworks.sh b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-frameworks.sh index 881cbae..2f26918 100755 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-frameworks.sh +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-frameworks.sh @@ -1,9 +1,18 @@ #!/bin/sh set -e +set -u +set -o pipefail + +if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then + # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy + # frameworks to, so exit 0 (signalling the script phase was successful). + exit 0 +fi echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" # Used as a return value for each invocation of `strip_invalid_archs` function. @@ -92,10 +101,10 @@ install_dsym() { # Signs a framework with the provided identity code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then # Use the current code_sign_identitiy echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then code_sign_cmd="$code_sign_cmd &" @@ -132,6 +141,13 @@ strip_invalid_archs() { STRIP_BINARY_RETVAL=1 } + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/SwipeCellKit/SwipeCellKit.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/SwipeCellKit/SwipeCellKit.framework" +fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then wait fi diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-resources.sh b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-resources.sh index a7df440..345301f 100755 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-resources.sh +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-resources.sh @@ -1,5 +1,13 @@ #!/bin/sh set -e +set -u +set -o pipefail + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" @@ -12,7 +20,7 @@ XCASSET_FILES=() # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") -case "${TARGETED_DEVICE_FAMILY}" in +case "${TARGETED_DEVICE_FAMILY:-}" in 1,2) TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" ;; @@ -92,7 +100,7 @@ if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then fi rm -f "$RESOURCES_TO_COPY" -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) @@ -102,5 +110,9 @@ then fi done <<<"$OTHER_XCASSETS" - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi fi diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.debug.xcconfig b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.debug.xcconfig index de1609e..7df937c 100644 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.debug.xcconfig +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.debug.xcconfig @@ -1,5 +1,10 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwipeCellKit" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwipeCellKit/SwipeCellKit.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "SwipeCellKit" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. diff --git a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.release.xcconfig b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.release.xcconfig index de1609e..7df937c 100644 --- a/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.release.xcconfig +++ b/ALTableViewSwift/Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView.release.xcconfig @@ -1,5 +1,10 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwipeCellKit" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwipeCellKit/SwipeCellKit.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "SwipeCellKit" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. diff --git a/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/Info.plist b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/Info.plist new file mode 100644 index 0000000..3e85049 --- /dev/null +++ b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.5.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-dummy.m b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-dummy.m new file mode 100644 index 0000000..4b646ed --- /dev/null +++ b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SwipeCellKit : NSObject +@end +@implementation PodsDummy_SwipeCellKit +@end diff --git a/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-prefix.pch b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-umbrella.h b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-umbrella.h new file mode 100644 index 0000000..0ecad30 --- /dev/null +++ b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double SwipeCellKitVersionNumber; +FOUNDATION_EXPORT const unsigned char SwipeCellKitVersionString[]; + diff --git a/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.modulemap b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.modulemap new file mode 100644 index 0000000..3987bf9 --- /dev/null +++ b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.modulemap @@ -0,0 +1,6 @@ +framework module SwipeCellKit { + umbrella header "SwipeCellKit-umbrella.h" + + export * + module * { export * } +} diff --git a/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.xcconfig b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.xcconfig new file mode 100644 index 0000000..d2d5aac --- /dev/null +++ b/ALTableViewSwift/Pods/Target Support Files/SwipeCellKit/SwipeCellKit.xcconfig @@ -0,0 +1,9 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwipeCellKit +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwipeCellKit +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj b/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj index beea59c..60ca460 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj +++ b/ALTableViewSwift/TestALTableView/TestALTableView.xcodeproj/project.pbxproj @@ -7,6 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 4533371221CCE81900D7B60E /* OrdersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4533371021CCE81900D7B60E /* OrdersTableViewCell.swift */; }; + 4533371321CCE81900D7B60E /* OrdersTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4533371121CCE81900D7B60E /* OrdersTableViewCell.xib */; }; + 4533371521CCE83E00D7B60E /* OrderElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4533371421CCE83E00D7B60E /* OrderElement.swift */; }; + 4533371721CCE89A00D7B60E /* Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4533371621CCE89A00D7B60E /* Styles.swift */; }; + 4533371E21CCEA2500D7B60E /* LoadingRetryTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4533371921CCEA2500D7B60E /* LoadingRetryTableViewCell.swift */; }; + 4533371F21CCEA2500D7B60E /* LoadingRetryTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4533371A21CCEA2500D7B60E /* LoadingRetryTableViewCell.xib */; }; + 4533372021CCEA2500D7B60E /* LoadingTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4533371C21CCEA2500D7B60E /* LoadingTableViewCell.xib */; }; + 4533372121CCEA2500D7B60E /* LoadingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4533371D21CCEA2500D7B60E /* LoadingTableViewCell.swift */; }; 453A35C32089D58800187F68 /* ALTableView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 453A35C22089D58800187F68 /* ALTableView.framework */; }; 453A35C42089D58800187F68 /* ALTableView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 453A35C22089D58800187F68 /* ALTableView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 453A35CC2089D5ED00187F68 /* Master2TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 453A35C62089D5ED00187F68 /* Master2TableViewCell.swift */; }; @@ -39,6 +47,14 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 4533371021CCE81900D7B60E /* OrdersTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrdersTableViewCell.swift; sourceTree = ""; }; + 4533371121CCE81900D7B60E /* OrdersTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OrdersTableViewCell.xib; sourceTree = ""; }; + 4533371421CCE83E00D7B60E /* OrderElement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderElement.swift; sourceTree = ""; }; + 4533371621CCE89A00D7B60E /* Styles.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Styles.swift; sourceTree = ""; }; + 4533371921CCEA2500D7B60E /* LoadingRetryTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingRetryTableViewCell.swift; sourceTree = ""; }; + 4533371A21CCEA2500D7B60E /* LoadingRetryTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingRetryTableViewCell.xib; sourceTree = ""; }; + 4533371C21CCEA2500D7B60E /* LoadingTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingTableViewCell.xib; sourceTree = ""; }; + 4533371D21CCEA2500D7B60E /* LoadingTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingTableViewCell.swift; sourceTree = ""; }; 453A35C22089D58800187F68 /* ALTableView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ALTableView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 453A35C62089D5ED00187F68 /* Master2TableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Master2TableViewCell.swift; sourceTree = ""; }; 453A35C72089D5ED00187F68 /* MasterTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterTableViewCell.swift; sourceTree = ""; }; @@ -81,6 +97,37 @@ name = Pods; sourceTree = ""; }; + 4533370F21CCE81900D7B60E /* Orders */ = { + isa = PBXGroup; + children = ( + 4533371B21CCEA2500D7B60E /* Loading */, + 4533371821CCEA2500D7B60E /* LoadingRetry */, + 4533371621CCE89A00D7B60E /* Styles.swift */, + 4533371421CCE83E00D7B60E /* OrderElement.swift */, + 4533371021CCE81900D7B60E /* OrdersTableViewCell.swift */, + 4533371121CCE81900D7B60E /* OrdersTableViewCell.xib */, + ); + path = Orders; + sourceTree = ""; + }; + 4533371821CCEA2500D7B60E /* LoadingRetry */ = { + isa = PBXGroup; + children = ( + 4533371921CCEA2500D7B60E /* LoadingRetryTableViewCell.swift */, + 4533371A21CCEA2500D7B60E /* LoadingRetryTableViewCell.xib */, + ); + path = LoadingRetry; + sourceTree = ""; + }; + 4533371B21CCEA2500D7B60E /* Loading */ = { + isa = PBXGroup; + children = ( + 4533371C21CCEA2500D7B60E /* LoadingTableViewCell.xib */, + 4533371D21CCEA2500D7B60E /* LoadingTableViewCell.swift */, + ); + path = Loading; + sourceTree = ""; + }; 453A35C52089D5ED00187F68 /* Master */ = { isa = PBXGroup; children = ( @@ -116,6 +163,7 @@ 4558B8C62089C549007436A9 /* TestALTableView */ = { isa = PBXGroup; children = ( + 4533370F21CCE81900D7B60E /* Orders */, 453A35C52089D5ED00187F68 /* Master */, 4558B8C72089C549007436A9 /* AppDelegate.swift */, 4558B8C92089C549007436A9 /* MasterViewController.swift */, @@ -148,7 +196,6 @@ 4558B8C12089C549007436A9 /* Frameworks */, 4558B8C22089C549007436A9 /* Resources */, E8F1D4376B8F17649291124E /* [CP] Embed Pods Frameworks */, - EAE7479F19E4F7D79B455E7F /* [CP] Copy Pods Resources */, 453A356D2089D29A00187F68 /* Embed Frameworks */, ); buildRules = ( @@ -202,7 +249,10 @@ 453A35D02089D5ED00187F68 /* MasterHeaderFooter.xib in Resources */, 4558B8D42089C54A007436A9 /* LaunchScreen.storyboard in Resources */, 4558B8D12089C54A007436A9 /* Assets.xcassets in Resources */, + 4533372021CCEA2500D7B60E /* LoadingTableViewCell.xib in Resources */, 453A35CF2089D5ED00187F68 /* Master2TableViewCell.xib in Resources */, + 4533371321CCE81900D7B60E /* OrdersTableViewCell.xib in Resources */, + 4533371F21CCEA2500D7B60E /* LoadingRetryTableViewCell.xib in Resources */, 4558B8CF2089C549007436A9 /* Main.storyboard in Resources */, 453A35D12089D5ED00187F68 /* MasterTableViewCell.xib in Resources */, ); @@ -235,30 +285,18 @@ files = ( ); inputPaths = ( + "${SRCROOT}/../Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/SwipeCellKit/SwipeCellKit.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwipeCellKit.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - EAE7479F19E4F7D79B455E7F /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-TestALTableView/Pods-TestALTableView-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -266,9 +304,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4533371721CCE89A00D7B60E /* Styles.swift in Sources */, 453A35CD2089D5ED00187F68 /* MasterTableViewCell.swift in Sources */, 4558B8CC2089C549007436A9 /* DetailViewController.swift in Sources */, + 4533371221CCE81900D7B60E /* OrdersTableViewCell.swift in Sources */, + 4533371521CCE83E00D7B60E /* OrderElement.swift in Sources */, + 4533371E21CCEA2500D7B60E /* LoadingRetryTableViewCell.swift in Sources */, 4558B8CA2089C549007436A9 /* MasterViewController.swift in Sources */, + 4533372121CCEA2500D7B60E /* LoadingTableViewCell.swift in Sources */, 453A35CC2089D5ED00187F68 /* Master2TableViewCell.swift in Sources */, 4558B8C82089C549007436A9 /* AppDelegate.swift in Sources */, 453A35CE2089D5ED00187F68 /* MasterHeaderFooter.swift in Sources */, diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift index 2147986..d2c4c65 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Master/MasterTableViewCell.swift @@ -8,8 +8,9 @@ import UIKit import ALTableView +import SwipeCellKit -class MasterTableViewCell: UITableViewCell, ALCellProtocol { +class MasterTableViewCell: SwipeTableViewCell, ALCellProtocol { static let nib = "MasterTableViewCell" static let reuseIdentifier = "MasterTableViewCellReuseIdentifier" @@ -20,6 +21,7 @@ class MasterTableViewCell: UITableViewCell, ALCellProtocol { if let title = dataObject as? String { self.labelText.text = title } + delegate = self } public func cellPressed(viewController: UIViewController?) { @@ -31,3 +33,30 @@ class MasterTableViewCell: UITableViewCell, ALCellProtocol { } } + +extension MasterTableViewCell: SwipeTableViewCellDelegate { + + func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? { + var actions = [SwipeAction]() + switch orientation { + case .right: + let deleteAction = SwipeAction(style: .destructive, title: "Delete") { action, indexPath in + print("cell deleted") + // handle action by updating model with deletion + } + actions.append(deleteAction) + break + case .left: + let wishlistAction = SwipeAction(style: .default, title: "Wishlist") { action, indexPath in + print("cell wishlist") + // handle action by updating model with deletion + } + wishlistAction.backgroundColor = .blue + actions.append(wishlistAction) + break + } + + return actions + } + +} diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift b/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift index a9ccd63..3c2adfc 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift @@ -26,10 +26,11 @@ class MasterViewController: UITableViewController, ALTableViewProtocol { let sectionElements = self.createElements() - self.alTableView = ALTableView(sectionElements: sectionElements, viewController: self, tableView: self.tableView) + self.alTableView = ALTableView(sectionElements: [ALSectionElement](), viewController: self, tableView: self.tableView) self.alTableView?.delegate = self self.registerCells() - self.tableView.reloadData() + self.alTableView?.replaceAllSections(sectionElements: sectionElements) +// self.tableView.reloadData() self.navigationItem.leftBarButtonItem = self.editButtonItem; self.alTableView?.addPullToRefresh(title: NSAttributedString(string: "Refreshing..."), backgroundColor: .green, tintColor: .blue) } @@ -58,29 +59,73 @@ class MasterViewController: UITableViewController, ALTableViewProtocol { } } - func createElements() -> [ALSectionElement] { - var sectionElements = [ALSectionElement]() - for _ in 0...4 { +// func createElements() -> [ALSectionElement] { +// var sectionElements = [ALSectionElement]() +// var rowElements = Array() +// for _ in 0...8 { +// +// let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true, editingAllowed: true) +// let rowElement2 = ALRowElement(className:Master2TableViewCell.classForCoder(), identifier: Master2TableViewCell.reuseIdentifier, dataObject: 12, estimateHeightMode: true) +// rowElements.append(rowElement) +// rowElements.append(rowElement2) +// +// +// +// +// } +// +// let headerElement = ALHeaderFooterElement(identifier: MasterHeaderFooter.reuseIdentifier, dataObject: "Header Test", estimateHeightMode: true) +// +// let section = ALSectionElement(rowElements: rowElements, headerElement: headerElement, footerElement: nil, isExpandable: true) +// +// sectionElements.append(section) +//// sectionElements.append(ALSectionElement(rowElements: [ALRowElement](), headerElement: nil, footerElement: nil, isExpandable: true)) +// +// return sectionElements +// } + + func createElements() -> [ALSectionElement] { + var sectionElements = [ALSectionElement]() var rowElements = Array() - let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true, editingAllowed: true) - let rowElement2 = ALRowElement(className:Master2TableViewCell.classForCoder(), identifier: Master2TableViewCell.reuseIdentifier, dataObject: 12, estimateHeightMode: true) - rowElements.append(rowElement) - rowElements.append(rowElement2) - - let headerElement = ALHeaderFooterElement(identifier: MasterHeaderFooter.reuseIdentifier, dataObject: "Header Test", estimateHeightMode: true) - - let section = ALSectionElement(rowElements: rowElements, headerElement: headerElement, footerElement: nil, isExpandable: true) - + for i in 0...8 { + let element = OrderElement(orderId: TextStyles.ordersElement(text: "\(i)"), + orderAmount: TextStyles.ordersElement(text: "\(i)\(i)\(i)"), + orderCreationDate: Date(), + orderStatus: TextStyles.ordersElement(text: "status \(i)\(i)\(i)"), + delegate: nil) + + let rowElement = ALRowElement(className: OrdersTableViewCell.classForCoder(), + identifier: OrdersTableViewCell.reuseIdentifier, + dataObject: element, + estimateHeightMode: true, + height: 92.0) +// let rowElement = ALRowElement(className: OrdersTableViewCell.classForCoder(), +// identifier: OrdersTableViewCell.reuseIdentifier, +// dataObject: element, +// estimateHeightMode: true) + rowElements.append(rowElement) + + + } + let section = ALSectionElement(rowElements: rowElements, headerElement: nil, footerElement: nil, isExpandable: true) + sectionElements.append(section) + + return sectionElements } - - return sectionElements - } func registerCells() { self.alTableView?.registerCell(nibName: MasterTableViewCell.nib, reuseIdentifier: MasterTableViewCell.reuseIdentifier) self.alTableView?.registerCell(nibName: Master2TableViewCell.nib, reuseIdentifier: Master2TableViewCell.reuseIdentifier) self.alTableView?.registerHeaderFooter(nibName: MasterHeaderFooter.nib, reuseIdentifier: MasterHeaderFooter.reuseIdentifier) + + + alTableView?.registerCell(nibName: OrdersTableViewCell.nib, + reuseIdentifier: OrdersTableViewCell.reuseIdentifier) + alTableView?.registerCell(nibName: LoadingTableViewCell.nib, + reuseIdentifier: LoadingTableViewCell.reuseIdentifier) + alTableView?.registerCell(nibName: LoadingRetryTableViewCell.nib, + reuseIdentifier: LoadingRetryTableViewCell.reuseIdentifier) } func tableViewPullToRefresh() { @@ -88,7 +133,7 @@ class MasterViewController: UITableViewController, ALTableViewProtocol { } func tableViewDidReachEnd() { - print("End Reached") + print("tableViewDidReachEnd") } } diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.swift new file mode 100644 index 0000000..646d70b --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.swift @@ -0,0 +1,27 @@ +// +// LoadingTableViewCell.swift +// bimbaylola +// +// Created by lorenzo villarroel perez on 20/12/2018. +// Copyright © 2018 BimbaYLola. All rights reserved. +// + +import UIKit +import ALTableView + +class LoadingTableViewCell: UITableViewCell, ALCellProtocol { + + class var nib: String { + return "LoadingTableViewCell" + } + class var reuseIdentifier: String { + return "LoadingTableViewCellReuseIdentifier" + } + + @IBOutlet weak var activityIndicator: UIActivityIndicatorView! + + func cellCreated(dataObject: Any?) { + activityIndicator.startAnimating() + } + +} diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.xib b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.xib new file mode 100644 index 0000000..ba985fb --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Loading/LoadingTableViewCell.xib @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.swift new file mode 100644 index 0000000..8b8f866 --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.swift @@ -0,0 +1,59 @@ +// +// LoadingRetryTableViewCell.swift +// BimbaYLola +// +// Created by lorenzo villarroel perez on 20/12/2018. +// Copyright © 2018 BimbaYLola. All rights reserved. +// + +import UIKit +import ALTableView + +class LoadingRetryTableViewCell: UITableViewCell, ALCellProtocol { + + @IBOutlet weak var btShowMore: SecondaryButton! + + class var nib: String { + return "LoadingRetryTableViewCell" + } + class var reuseIdentifier: String { + return "LoadingRetryTableViewCellReuseIdentifier" + } + + func cellCreated(dataObject: Any?) { + btShowMore.isUserInteractionEnabled = false + btShowMore.setTitle("PRODUCTS_GRID_SHOW_MORE", for: .normal) + } + +} + +class SecondaryButton: UIButton { + + override var intrinsicContentSize: CGSize { + get { + let baseSize = super.intrinsicContentSize + return CGSize(width: baseSize.width + titleEdgeInsets.left + titleEdgeInsets.right, + height: baseSize.height + titleEdgeInsets.top + titleEdgeInsets.bottom) + } + set { + + } + } + + override func awakeFromNib() { + super.awakeFromNib() + + setTitleColor(.black, for: .normal) + titleLabel?.font = UIFont.systemFont(ofSize: 15.0) + + backgroundColor = .white + + layer.borderWidth = 1.0 + layer.borderColor = UIColor.black.cgColor + + titleEdgeInsets = UIEdgeInsets(top: 0.0, left: 16.0, bottom: 0.0, right: 16.0) + + + } + +} diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.xib b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.xib new file mode 100644 index 0000000..ff8e983 --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/LoadingRetry/LoadingRetryTableViewCell.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrderElement.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrderElement.swift new file mode 100644 index 0000000..d371403 --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrderElement.swift @@ -0,0 +1,110 @@ +// +// OrderElement.swift +// bimbaylola +// +// Created by Michel Goñi on 07/12/2018. +// Copyright © 2018 BimbaYLola. All rights reserved. +// + +import UIKit + +enum DeliveryStatus: String { + case delivered + case pickUp + case incidence + case processing + case preparing + case shipped + case unknown + + func retrieveStatusColor() -> UIColor { + + switch self { + case .delivered: + return .green + case .pickUp: + return .blue + case .incidence: + return .purple + case .processing: + return .orange + case .preparing: + return .yellow + case .shipped: + return .blue + case .unknown: + return .blue + } + } +} + +protocol OrderRepresentable { + var image: UIImage? { get } + var orderId: TextConfigurableProtocol { get } + var orderAmount: TextConfigurableProtocol { get } + var orderCreationDate: Date { get } + var orderStatus: TextConfigurableProtocol { get } + var orderStatusType: DeliveryStatus? {get} + var delegate: OrderIdProtocol? {get} +} + +struct OrderElement: OrderRepresentable { + + var image: UIImage? + var orderId: TextConfigurableProtocol + var orderAmount: TextConfigurableProtocol + var orderCreationDate: Date + var orderStatus: TextConfigurableProtocol + var orderStatusType: DeliveryStatus? + weak var delegate: OrderIdProtocol? + + init(image: UIImage? = nil,orderId: TextConfigurableProtocol,orderAmount: TextConfigurableProtocol,orderCreationDate:Date, orderStatus: TextConfigurableProtocol, delegate: OrderIdProtocol?) { + + self.image = image + self.orderId = orderId + self.orderAmount = orderAmount + self.orderCreationDate = orderCreationDate + self.orderStatus = orderStatus + self.orderStatusType = getStatus(orderStatus: self.orderStatus.text) + self.delegate = delegate + + } + + // MARK: - Private methods + private func getStatus(orderStatus: String) -> DeliveryStatus { + + return DeliveryStatus(rawValue: orderStatus) ?? .unknown + + } +} + + +protocol TextConfigurableProtocol { + var text: String { get set } + var font: UIFont { get set } + var color: UIColor { get set } + var alignment: NSTextAlignment { get set } + func isEmpty() -> Bool +} + +extension TextConfigurableProtocol { + func isEmpty() -> Bool { + return text.isEmpty + } +} + +struct TextConfigurable: TextConfigurableProtocol { + var text: String + var font: UIFont + var color: UIColor + var alignment: NSTextAlignment + + static func defaultEmptyMember() -> TextConfigurable { + return TextConfigurable(text: "", font: UIFont.systemFont(ofSize: 16.0), color: .black, alignment: .left) + } + + static func defaultMember () -> TextConfigurable { + return TextConfigurable(text: " ", font: UIFont.systemFont(ofSize: 16.0), color: .black, alignment: .left) + } +} + diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.swift new file mode 100644 index 0000000..8397133 --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.swift @@ -0,0 +1,102 @@ +// +// OrdersTableViewCell.swift +// bimbaylola +// +// Created by Michel Goñi on 07/12/2018. +// Copyright © 2018 BimbaYLola. All rights reserved. +// + +import UIKit +import ALTableView + +protocol OrdersElementConfigurable { + func configure(element: OrderRepresentable) +} + +protocol OrderIdProtocol: class { + func orderIdSelected(orderId: Int) +} + +class OrdersTableViewCell: UITableViewCell, ALCellProtocol, OrdersElementConfigurable { + + @IBOutlet weak var lbOrderId: UILabel! + @IBOutlet weak var lbOrderDate: UILabel! + @IBOutlet weak var imgOrderStatus: UIImageView! + @IBOutlet weak var lbOrderStatus: UILabel! + @IBOutlet weak var lbOrderAmount: UILabel! + + private var element: OrderRepresentable? + + class var nib: String { + return "OrdersTableViewCell" + } + class var reuseIdentifier: String { + return "OrdersTableViewCellReuseIdentifier" + } + + // MARK: - ALCellProtocol + + public func cellCreated(dataObject: Any?) { + if let element = dataObject as? OrderRepresentable { + self.element = element + configure(element: element) + } + + } + + func cellPressed(viewController: UIViewController?) { + + if let orderid = element?.orderId { + element?.delegate?.orderIdSelected(orderId: Int(orderid.text) ?? 0) + } + + } + + // MARK: - OrdersElementConfigurable + func configure(element: OrderRepresentable) { + lbOrderId.configure(textConfigurable: TextStyles.ordersElement(text: element.orderId.text)) + lbOrderDate.configure(textConfigurable: TextStyles.ordersElementDate(text: element.orderCreationDate.string(withFormat: "dd/MM/yyyy"))) + imgOrderStatus.layer.masksToBounds = true + imgOrderStatus.layer.cornerRadius = imgOrderStatus.frame.height / 2 + imgOrderStatus.image = element.orderStatusType?.retrieveStatusColor().image(CGSize(width: 14, height: 14)) + lbOrderStatus.configure(textConfigurable: TextStyles.ordersElement(text: element.orderStatus.text)) + lbOrderAmount.configure(textConfigurable: TextStyles.ordersElement(text: element.orderAmount.text)) + } + +} + +extension UILabel { + + func configure(textConfigurable: TextConfigurableProtocol) { + text = textConfigurable.text + font = textConfigurable.font + textColor = textConfigurable.color + textAlignment = textConfigurable.alignment + } + +} + +extension UIColor { + + /// Prints color inside an image + /// - parameter size: The size of the image as CGSize. + /// - Example: UIColor.red.image(CGSize(width: 35, height: 35)). + public func image(_ size: CGSize = CGSize(width: 35, height: 35)) -> UIImage { + if #available(iOS 10.0, *) { + return UIGraphicsImageRenderer(size: size).image { rendererContext in + self.setFill() + rendererContext.fill(CGRect(x: 0, y: 0, width: size.width, height: size.height)) + } + } else { + return UIImage() + } + } +} + +extension Date { + public func string(withFormat format: String = "dd/MM/yyyy HH:mm") -> String { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = format + return dateFormatter.string(from: self) + } +} diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.xib b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.xib new file mode 100644 index 0000000..5fe2b58 --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/OrdersTableViewCell.xib @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + Geogrotesque-Regular + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Styles.swift b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Styles.swift new file mode 100644 index 0000000..f4ab80e --- /dev/null +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Orders/Styles.swift @@ -0,0 +1,23 @@ +// +// Styles.swift +// BimbaYLola +// +// Created by lorenzo villarroel perez on 25/9/18. +// Copyright © 2018 BimbaYLola. All rights reserved. +// + +import UIKit + +struct TextStyles { + + + static func ordersElement(text: String) -> TextConfigurable { + return TextConfigurable(text: text, font: UIFont.systemFont(ofSize: 14), color: .black, alignment: .left) + } + + static func ordersElementDate(text: String) -> TextConfigurable { + return TextConfigurable(text: text, font: UIFont.systemFont(ofSize: 14), color: .black, alignment: .left) + } + + +} From a814d2aa9a21286576e803e2d660b2f1d58b4b60 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Fri, 21 Dec 2018 12:11:31 +0100 Subject: [PATCH 13/21] bumped version 0.3.3 --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index beddb64..5599f1e 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.3.2" + s.version = "0.3.3" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index da2cb9e..5b3f345 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.3.2 + 0.3.3 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 4f0c1a9..2d4e9ab 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.2 + 0.3.3 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/README.md b/README.md index 1079364..5207274 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T This framework is still on development. We cannot guarantee yet that all the features work. -The latest stable version for swift is [0.3.2](https://github.com/ALiOSDev/ALTableView/tree/0.3.2), which includes support for swift 4.2 +The latest stable version for swift is [0.3.3](https://github.com/ALiOSDev/ALTableView/tree/0.3.3), which includes support for swift 4.2 **CocoaPods** From 1d112c4c9ce85bac29a4c99585625ed01c0e1b91 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Fri, 21 Dec 2018 12:30:55 +0100 Subject: [PATCH 14/21] removed print --- .../ALTableViewClasses/ALTableView/ALTableViewDelegate.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift index 0f9978d..f98c1e9 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewDelegate.swift @@ -35,7 +35,6 @@ extension ALTableView: UITableViewDelegate { let cellHeight: CGFloat = cell.frame.size.height self.getSectionElementAt(index: indexPath.section)?.setRowElementHeight(row: indexPath.row, height: cellHeight) - print(indexPath) if self.isLastIndexPath(indexPath: indexPath, tableView: tableView) { //We reached the end of the tableView self.delegate?.tableViewDidReachEnd?() From d86134b931fb507dfa439de6f57f980e83a8b94a Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Fri, 21 Dec 2018 12:32:58 +0100 Subject: [PATCH 15/21] bumped version 0.3.4 --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index 5599f1e..108bd92 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.3.3" + s.version = "0.3.4" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index 5b3f345..cb3ed31 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.3.3 + 0.3.4 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 2d4e9ab..4278f6b 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.3 + 0.3.4 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/README.md b/README.md index 5207274..0552c0c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T This framework is still on development. We cannot guarantee yet that all the features work. -The latest stable version for swift is [0.3.3](https://github.com/ALiOSDev/ALTableView/tree/0.3.3), which includes support for swift 4.2 +The latest stable version for swift is [0.3.4](https://github.com/ALiOSDev/ALTableView/tree/0.3.4), which includes support for swift 4.2 **CocoaPods** From 2bd79f868b313b6befa29f1cc3110db6860ad9e8 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Tue, 7 May 2019 16:10:25 +0200 Subject: [PATCH 16/21] fixed an error with taprecognizer and reuse of header views --- .../Elements/Section/ALSectionElementHeader.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift index e22064c..14b2b81 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift @@ -43,7 +43,10 @@ extension ALSectionElement { extension ALSectionElement { fileprivate func setUpHeaderRecognizer (viewHeader: UIView) -> Void { - + if let headerTapGesture = self.headerTapGesture { + viewHeader.removeGestureRecognizer(headerTapGesture) + self.headerTapGesture = nil + } if self.headerTapGesture == nil { self.headerTapGesture = UITapGestureRecognizer(target: self, action: #selector(self.toggleOpen(sender:))) if let headerTapGesture = self.headerTapGesture { From bf23772fd0a9e938277c32b78e4430fd7555ef93 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Tue, 7 May 2019 16:48:00 +0200 Subject: [PATCH 17/21] added functions to open and close sections --- .../ALTableView/ALTableViewRowManaging.swift | 14 +++ .../Section/ALSectionElementHeader.swift | 4 +- .../MasterViewController.swift | 96 +++++++++---------- 3 files changed, 64 insertions(+), 50 deletions(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift index c06ae12..eea471e 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewRowManaging.swift @@ -204,6 +204,20 @@ extension ALTableView { extension ALTableView: ALSectionHeaderViewDelegate { + public func openSection(section: Int) { + guard let section = getSectionElementAt(index: section), !section.isOpened else { + return + } + section.toggleOpen(sender: self) + } + + public func closeSection(section: Int) { + guard let section = getSectionElementAt(index: section), section.isOpened else { + return + } + section.toggleOpen(sender: self) + } + func sectionOpened(sectionElement: ALSectionElement) { guard let section: Int = sectionElements.index(of: sectionElement) else { diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift index 14b2b81..184b10c 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift @@ -56,14 +56,14 @@ extension ALSectionElement { } } - @objc fileprivate func toggleOpen(sender: Any) { + @objc func toggleOpen(sender: Any) { if self.isExpandable { self.toggleOpenWith(userAction: true) } } - fileprivate func toggleOpenWith(userAction: Bool) { + func toggleOpenWith(userAction: Bool) { guard let delegate = self.delegate else { return diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift b/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift index 3c2adfc..2233ff8 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift +++ b/ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift @@ -59,60 +59,60 @@ class MasterViewController: UITableViewController, ALTableViewProtocol { } } -// func createElements() -> [ALSectionElement] { -// var sectionElements = [ALSectionElement]() -// var rowElements = Array() -// for _ in 0...8 { -// -// let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true, editingAllowed: true) -// let rowElement2 = ALRowElement(className:Master2TableViewCell.classForCoder(), identifier: Master2TableViewCell.reuseIdentifier, dataObject: 12, estimateHeightMode: true) -// rowElements.append(rowElement) -// rowElements.append(rowElement2) -// -// -// -// -// } -// -// let headerElement = ALHeaderFooterElement(identifier: MasterHeaderFooter.reuseIdentifier, dataObject: "Header Test", estimateHeightMode: true) -// -// let section = ALSectionElement(rowElements: rowElements, headerElement: headerElement, footerElement: nil, isExpandable: true) -// -// sectionElements.append(section) -//// sectionElements.append(ALSectionElement(rowElements: [ALRowElement](), headerElement: nil, footerElement: nil, isExpandable: true)) -// -// return sectionElements -// } - - func createElements() -> [ALSectionElement] { - var sectionElements = [ALSectionElement]() - var rowElements = Array() - for i in 0...8 { - let element = OrderElement(orderId: TextStyles.ordersElement(text: "\(i)"), - orderAmount: TextStyles.ordersElement(text: "\(i)\(i)\(i)"), - orderCreationDate: Date(), - orderStatus: TextStyles.ordersElement(text: "status \(i)\(i)\(i)"), - delegate: nil) + func createElements() -> [ALSectionElement] { + var sectionElements = [ALSectionElement]() + var rowElements = Array() + for _ in 0...8 { - let rowElement = ALRowElement(className: OrdersTableViewCell.classForCoder(), - identifier: OrdersTableViewCell.reuseIdentifier, - dataObject: element, - estimateHeightMode: true, - height: 92.0) -// let rowElement = ALRowElement(className: OrdersTableViewCell.classForCoder(), -// identifier: OrdersTableViewCell.reuseIdentifier, -// dataObject: element, -// estimateHeightMode: true) - rowElements.append(rowElement) + let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true, editingAllowed: true) + let rowElement2 = ALRowElement(className:Master2TableViewCell.classForCoder(), identifier: Master2TableViewCell.reuseIdentifier, dataObject: 12, estimateHeightMode: true) + rowElements.append(rowElement) + rowElements.append(rowElement2) - } - let section = ALSectionElement(rowElements: rowElements, headerElement: nil, footerElement: nil, isExpandable: true) - sectionElements.append(section) - return sectionElements } + + let headerElement = ALHeaderFooterElement(identifier: MasterHeaderFooter.reuseIdentifier, dataObject: "Header Test", estimateHeightMode: true) + + let section = ALSectionElement(rowElements: rowElements, headerElement: headerElement, footerElement: nil, isExpandable: true) + + sectionElements.append(section) +// sectionElements.append(ALSectionElement(rowElements: [ALRowElement](), headerElement: nil, footerElement: nil, isExpandable: true)) + + return sectionElements + } + +// func createElements() -> [ALSectionElement] { +// var sectionElements = [ALSectionElement]() +// var rowElements = Array() +// for i in 0...8 { +// let element = OrderElement(orderId: TextStyles.ordersElement(text: "\(i)"), +// orderAmount: TextStyles.ordersElement(text: "\(i)\(i)\(i)"), +// orderCreationDate: Date(), +// orderStatus: TextStyles.ordersElement(text: "status \(i)\(i)\(i)"), +// delegate: nil) +// +// let rowElement = ALRowElement(className: OrdersTableViewCell.classForCoder(), +// identifier: OrdersTableViewCell.reuseIdentifier, +// dataObject: element, +// estimateHeightMode: true, +// height: 92.0) +//// let rowElement = ALRowElement(className: OrdersTableViewCell.classForCoder(), +//// identifier: OrdersTableViewCell.reuseIdentifier, +//// dataObject: element, +//// estimateHeightMode: true) +// rowElements.append(rowElement) +// +// +// } +// let section = ALSectionElement(rowElements: rowElements, headerElement: nil, footerElement: nil, isExpandable: true) +// +// sectionElements.append(section) +// +// return sectionElements +// } func registerCells() { self.alTableView?.registerCell(nibName: MasterTableViewCell.nib, reuseIdentifier: MasterTableViewCell.reuseIdentifier) From 05d101653e9dd37ef1e31bbf1249a4b00044796e Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Tue, 7 May 2019 16:48:08 +0200 Subject: [PATCH 18/21] bumped version --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index 108bd92..ae17467 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.3.4" + s.version = "0.3.5" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index cb3ed31..5b29f89 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.3.4 + 0.3.5 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 4278f6b..8151e67 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.4 + 0.3.5 CFBundleVersion 1 LSRequiresIPhoneOS From f45eabec3b979032cd5139a997368afdcc0c4bba Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 8 May 2019 09:47:01 +0200 Subject: [PATCH 19/21] fixed an error where headerview delegate was not being called --- .../Elements/Section/ALSectionElementHeader.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift index 184b10c..509f098 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift +++ b/ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Section/ALSectionElementHeader.swift @@ -57,7 +57,10 @@ extension ALSectionElement { } @objc func toggleOpen(sender: Any) { - + if let tapGesture = sender as? UITapGestureRecognizer, + let headerView = tapGesture.view as? UITableViewHeaderFooterView { + self.headerElement?.headerFooterElementPressed(view: headerView) + } if self.isExpandable { self.toggleOpenWith(userAction: true) } From fc4de1a5f8ce42e63b10ba789086b3e1ff59f470 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 8 May 2019 09:47:38 +0200 Subject: [PATCH 20/21] bumped version --- ALTableView.podspec | 2 +- ALTableViewSwift/ALTableView/ALTableView/Info.plist | 2 +- ALTableViewSwift/TestALTableView/TestALTableView/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ALTableView.podspec b/ALTableView.podspec index ae17467..6b0bc15 100644 --- a/ALTableView.podspec +++ b/ALTableView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "ALTableView" - s.version = "0.3.5" + s.version = "0.3.6" s.summary = "An easy way to manage UITableView and UITableViewController" # This description is used to generate tags and improve search results. diff --git a/ALTableViewSwift/ALTableView/ALTableView/Info.plist b/ALTableViewSwift/ALTableView/ALTableView/Info.plist index 5b29f89..30f99c5 100644 --- a/ALTableViewSwift/ALTableView/ALTableView/Info.plist +++ b/ALTableViewSwift/ALTableView/ALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.3.5 + 0.3.6 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist index 8151e67..ab8add1 100644 --- a/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist +++ b/ALTableViewSwift/TestALTableView/TestALTableView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.5 + 0.3.6 CFBundleVersion 1 LSRequiresIPhoneOS From 61357359711f904547928138d8a77ab41ac1ff50 Mon Sep 17 00:00:00 2001 From: Abimael Barea Date: Sun, 20 Jul 2025 17:52:14 +0100 Subject: [PATCH 21/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0552c0c..93f9ebf 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ class MasterViewController: UITableViewController { Authors -------- -Abimael Barea [@elabi3](https://github.com/elabi3) - +Abimael Barea [@abimaelbarea](https://github.com/abimaelbarea) - Lorenzo Villarroel [@lorencr7](https://github.com/lorencr7) License