From b04986475881a6bed817cee02fbcfa6e1f1587a1 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Thu, 10 Jan 2019 18:35:35 +0300
Subject: [PATCH 01/18] fix crash on iOS 10.3.1
---
Sources/TableDirector.swift | 39 +++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift
index c17ce2c..aa6473b 100644
--- a/Sources/TableDirector.swift
+++ b/Sources/TableDirector.swift
@@ -95,6 +95,14 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
tableView?.reloadData()
}
+ // MARK: - Private
+ private func row(at indexPath: IndexPath) -> Row? {
+ if indexPath.section < sections.count && indexPath.row < sections[indexPath.section].rows.count {
+ return sections[indexPath.section].rows[indexPath.row]
+ }
+ return nil
+ }
+
// MARK: Public
@discardableResult
open func invoke(
@@ -102,15 +110,13 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
cell: UITableViewCell?, indexPath: IndexPath,
userInfo: [AnyHashable: Any]? = nil) -> Any?
{
- if indexPath.section < sections.count && indexPath.row < sections[indexPath.section].rows.count {
- return sections[indexPath.section].rows[indexPath.row].invoke(
- action: action,
- cell: cell,
- path: indexPath,
- userInfo: userInfo
- )
- }
- return nil
+ guard let row = row(at: indexPath) else { return nil }
+ return row.invoke(
+ action: action,
+ cell: cell,
+ path: indexPath,
+ userInfo: userInfo
+ )
}
open override func responds(to selector: Selector) -> Bool {
@@ -125,7 +131,8 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
// MARK: - Internal
func hasAction(_ action: TableRowActionType, atIndexPath indexPath: IndexPath) -> Bool {
- return sections[indexPath.section].rows[indexPath.row].has(action: action)
+ guard let row = row(at: indexPath) else { return false }
+ return row.has(action: action)
}
@objc
@@ -172,6 +179,8 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
}
open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ guard section < sections.count else { return 0 }
+
return sections[section].numberOfRows
}
@@ -196,29 +205,39 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
// MARK: UITableViewDataSource - section setup
open func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
+ guard section < sections.count else { return nil }
+
return sections[section].headerTitle
}
open func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
+ guard section < sections.count else { return nil }
+
return sections[section].footerTitle
}
// MARK: UITableViewDelegate - section setup
open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+ guard section < sections.count else { return nil }
+
return sections[section].headerView
}
open func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+ guard section < sections.count else { return nil }
+
return sections[section].footerView
}
open func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+ guard section < sections.count else { return 0 }
let section = sections[section]
return section.headerHeight ?? section.headerView?.frame.size.height ?? UITableView.automaticDimension
}
open func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+ guard section < sections.count else { return 0 }
let section = sections[section]
return section.footerHeight
From 8b6319d5107c7c4549bbfd1b7ebd4a81f6d7ba4e Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Thu, 10 Jan 2019 18:35:53 +0300
Subject: [PATCH 02/18] bump to 2.8.1
---
README.md | 2 +-
TableKit.podspec | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index c13a629..a4583c0 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-
+
diff --git a/TableKit.podspec b/TableKit.podspec
index 5d90f09..0a92cd7 100644
--- a/TableKit.podspec
+++ b/TableKit.podspec
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
s.name = 'TableKit'
s.module_name = 'TableKit'
- s.version = '2.8.0'
+ s.version = '2.8.1'
s.homepage = 'https://github.com/maxsokolov/TableKit'
s.summary = 'Type-safe declarative table views with Swift.'
From f5ad500ba46f230875ebaa3b522dd57c67a526b9 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Thu, 4 Apr 2019 23:26:15 +0300
Subject: [PATCH 03/18] support swift 5.0, bump to 2.9.0
---
.swift-version | 2 +-
.travis.yml | 2 +-
CHANGELOG.md | 4 ++++
Demo/TableKitDemo.xcodeproj/project.pbxproj | 9 +++++----
README.md | 2 +-
Sources/TableRow.swift | 2 +-
TableKit.podspec | 2 +-
TableKit.xcodeproj/project.pbxproj | 13 +++++++------
8 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/.swift-version b/.swift-version
index 8012ebb..6e63660 100644
--- a/.swift-version
+++ b/.swift-version
@@ -1 +1 @@
-4.2
\ No newline at end of file
+5.0
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 228c26b..dfd5f4c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: objective-c
-osx_image: xcode10
+osx_image: xcode10.1
branches:
only:
- master
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ebb1a04..9bf4ad6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
+## [2.9.0](https://github.com/maxsokolov/TableKit/releases/tag/2.9.0)
+Released on 2019-04-04.
+- Swift 5.0 support.
+
## [2.8.0](https://github.com/maxsokolov/TableKit/releases/tag/2.8.0)
Released on 2018-09-30.
- Swift 4.2 support.
diff --git a/Demo/TableKitDemo.xcodeproj/project.pbxproj b/Demo/TableKitDemo.xcodeproj/project.pbxproj
index 17885b9..eef710e 100644
--- a/Demo/TableKitDemo.xcodeproj/project.pbxproj
+++ b/Demo/TableKitDemo.xcodeproj/project.pbxproj
@@ -248,6 +248,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
+ English,
en,
Base,
);
@@ -377,7 +378,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -425,7 +426,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -443,7 +444,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo;
PRODUCT_NAME = TableKitDemo;
PROVISIONING_PROFILE = "";
- SWIFT_VERSION = 4.2;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -460,7 +461,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo;
PRODUCT_NAME = TableKitDemo;
PROVISIONING_PROFILE = "";
- SWIFT_VERSION = 4.2;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
diff --git a/README.md b/README.md
index a4583c0..aeb1e11 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-
+
diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift
index 411f5aa..b04382d 100644
--- a/Sources/TableRow.swift
+++ b/Sources/TableRow.swift
@@ -113,7 +113,7 @@ open class TableRow: Row where CellType: UITableView
open func removeAction(forActionId actionId: String) {
for (key, value) in actions {
- if let actionIndex = value.index(where: { $0.id == actionId }) {
+ if let actionIndex = value.firstIndex(where: { $0.id == actionId }) {
actions[key]?.remove(at: actionIndex)
}
}
diff --git a/TableKit.podspec b/TableKit.podspec
index 0a92cd7..9c30c24 100644
--- a/TableKit.podspec
+++ b/TableKit.podspec
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
s.name = 'TableKit'
s.module_name = 'TableKit'
- s.version = '2.8.1'
+ s.version = '2.9.0'
s.homepage = 'https://github.com/maxsokolov/TableKit'
s.summary = 'Type-safe declarative table views with Swift.'
diff --git a/TableKit.xcodeproj/project.pbxproj b/TableKit.xcodeproj/project.pbxproj
index 9afc02f..d20f8ba 100644
--- a/TableKit.xcodeproj/project.pbxproj
+++ b/TableKit.xcodeproj/project.pbxproj
@@ -195,6 +195,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
+ English,
en,
);
mainGroup = DA9EA74C1D0B679A0021F650;
@@ -315,7 +316,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -368,7 +369,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
@@ -393,7 +394,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 4.2;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -413,7 +414,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.2;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -425,7 +426,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 4.2;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -437,7 +438,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 4.2;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
From 1d4fdaad0d0ca842738aa41b28c28ae3fdd5ac66 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Thu, 4 Apr 2019 23:27:25 +0300
Subject: [PATCH 04/18] update readme
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index aeb1e11..dabf33b 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-
+
From 603264a6d1fedf1162f80ba1fab712afc2252f95 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Thu, 4 Apr 2019 23:31:40 +0300
Subject: [PATCH 05/18] fix travis ci
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index dfd5f4c..9812d00 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: objective-c
-osx_image: xcode10.1
+osx_image: xcode10.2
branches:
only:
- master
From a4bacd2c16e0edcd53539802cc386f0fe2317eb9 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Thu, 4 Apr 2019 23:40:25 +0300
Subject: [PATCH 06/18] fix travis ci
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 9812d00..4e7d59b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- - IOS_SDK=iphonesimulator12.0
+ - IOS_SDK=iphonesimulator12.2
- SCHEME_IOS="TableKit"
- PROJECT_FRAMEWORK="TableKit.xcodeproj"
From 337175c507abc79fc9c955de170de3efab4952b5 Mon Sep 17 00:00:00 2001
From: Bogdan Kurpakov
Date: Thu, 9 May 2019 11:10:31 +0200
Subject: [PATCH 07/18] added: willDeselect
---
Sources/TableDirector.swift | 8 ++++++++
Sources/TableKit.swift | 1 +
2 files changed, 9 insertions(+)
diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift
index aa6473b..e6f16c7 100644
--- a/Sources/TableDirector.swift
+++ b/Sources/TableDirector.swift
@@ -309,6 +309,14 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
return indexPath
}
+ open func tableView(_ tableView: UITableView, willDeselectRowAt indexPath: IndexPath) -> IndexPath? {
+ if hasAction(.willDeselect, atIndexPath: indexPath) {
+ return invoke(action: .willDeselect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? IndexPath
+ }
+
+ return indexPath
+ }
+
// MARK: - Row editing
open func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return sections[indexPath.section].rows[indexPath.row].isEditingAllowed(forIndexPath: indexPath)
diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift
index 5d554d5..3eb96a4 100644
--- a/Sources/TableKit.swift
+++ b/Sources/TableKit.swift
@@ -69,6 +69,7 @@ public enum TableRowActionType {
case select
case deselect
case willSelect
+ case willDeselect
case willDisplay
case didEndDisplaying
case shouldHighlight
From 959032a03f1b28be567e6b408148d7701b3b9b9a Mon Sep 17 00:00:00 2001
From: Denis
Date: Mon, 27 May 2019 11:01:35 +0300
Subject: [PATCH 08/18] Add accessoryButton action support
---
Sources/TableDirector.swift | 5 +++++
Sources/TableKit.swift | 1 +
2 files changed, 6 insertions(+)
diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift
index e6f16c7..4a77708 100644
--- a/Sources/TableDirector.swift
+++ b/Sources/TableDirector.swift
@@ -355,6 +355,11 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
open func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
invoke(action: .move, cell: tableView.cellForRow(at: sourceIndexPath), indexPath: sourceIndexPath, userInfo: [TableKitUserInfoKeys.CellMoveDestinationIndexPath: destinationIndexPath])
}
+
+ open func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
+ let cell = tableView.cellForRow(at: indexPath)
+ invoke(action: .accessoryButtonTap, cell: cell, indexPath: indexPath)
+ }
}
// MARK: - Sections manipulation
diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift
index 3eb96a4..9202180 100644
--- a/Sources/TableKit.swift
+++ b/Sources/TableKit.swift
@@ -80,6 +80,7 @@ public enum TableRowActionType {
case canMove
case canMoveTo
case move
+ case accessoryButtonTap
case custom(String)
var key: String {
From 402757c41f6802289a18f19127ac645774376f83 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Tue, 25 Jun 2019 14:36:47 +0300
Subject: [PATCH 09/18] drop iOS 9 checks on ci
---
.travis.yml | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 4e7d59b..09bf830 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,11 +12,8 @@ env:
- PROJECT_FRAMEWORK="TableKit.xcodeproj"
matrix:
- - DESTINATION="OS=9.0,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- - DESTINATION="OS=9.1,name=iPhone 6 Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- - DESTINATION="OS=9.2,name=iPhone 6S" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- - DESTINATION="OS=9.3,name=iPhone 6S Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=10.0,name=iPhone 5" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
+ - DESTINATION="OS=11.0,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=12.0,name=iPhone 7 Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
script:
From dc1a924a8045902d0bc118abc4461381e4b73ea7 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Tue, 25 Jun 2019 14:45:02 +0300
Subject: [PATCH 10/18] drop iOS 9 checks on ci
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 09bf830..79275fb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,7 @@ env:
matrix:
- DESTINATION="OS=10.0,name=iPhone 5" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- - DESTINATION="OS=11.0,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
+ - DESTINATION="OS=11.1,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=12.0,name=iPhone 7 Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
script:
From f39e7ac602e5dc079b2b945e5290e6408226bacb Mon Sep 17 00:00:00 2001
From: bellebethcooper
Date: Sat, 7 Sep 2019 15:49:07 +1000
Subject: [PATCH 11/18] Updated Swift tools version and added missing
requirements
---
Package.swift | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/Package.swift b/Package.swift
index 35ee9ed..5ce7c3d 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,5 +1,20 @@
+// swift-tools-version:5.0
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
import PackageDescription
let package = Package(
- name: "TableKit"
-)
\ No newline at end of file
+ name: "TableKit",
+
+ products: [
+ .library(
+ name: "TableKit",
+ targets: ["TableKit"]),
+ ],
+
+ targets: [
+ .target(
+ name: "TableKit",
+ path: "Sources")
+ ]
+)
From 01bf1e01e3e569f190e9dbd94c3b79ccf66b5f03 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 29 Sep 2019 09:50:40 -0400
Subject: [PATCH 12/18] support swift 5.1 and xcode 11
---
.travis.yml | 5 +++--
CHANGELOG.md | 4 ++++
README.md | 4 ++--
Tests/TableKitTests.swift | 5 ++++-
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 79275fb..f1d55d2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: objective-c
-osx_image: xcode10.2
+osx_image: xcode11.0
branches:
only:
- master
@@ -7,7 +7,7 @@ env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- - IOS_SDK=iphonesimulator12.2
+ - IOS_SDK=iphonesimulator13.0
- SCHEME_IOS="TableKit"
- PROJECT_FRAMEWORK="TableKit.xcodeproj"
@@ -15,6 +15,7 @@ env:
- DESTINATION="OS=10.0,name=iPhone 5" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=11.1,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=12.0,name=iPhone 7 Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
+ - DESTINATION="OS=13.0,name=iPhone 11" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
script:
- set -o pipefail
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9bf4ad6..3eca5a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
+## [2.10.0](https://github.com/maxsokolov/TableKit/releases/tag/2.10.0)
+Released on 2019-09-29.
+- Swift 5.1 support.
+
## [2.9.0](https://github.com/maxsokolov/TableKit/releases/tag/2.9.0)
Released on 2019-04-04.
- Swift 5.0 support.
diff --git a/README.md b/README.md
index dabf33b..b565112 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@
-
+
-
+
diff --git a/Tests/TableKitTests.swift b/Tests/TableKitTests.swift
index ded9bd6..d9d5b11 100644
--- a/Tests/TableKitTests.swift
+++ b/Tests/TableKitTests.swift
@@ -74,7 +74,10 @@ class TableKitTests: XCTestCase {
super.setUp()
testController = TestController()
- testController.view.isHidden = false
+ testController.tableView.frame = UIScreen.main.bounds
+ testController.tableView.isHidden = false
+ testController.tableView.setNeedsLayout()
+ testController.tableView.layoutIfNeeded()
}
override func tearDown() {
From c3652eec6fb21bdca240c2f6c3394439d0473179 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 29 Sep 2019 09:51:33 -0400
Subject: [PATCH 13/18] bump podspec
---
TableKit.podspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TableKit.podspec b/TableKit.podspec
index 9c30c24..7b9a0e0 100644
--- a/TableKit.podspec
+++ b/TableKit.podspec
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
s.name = 'TableKit'
s.module_name = 'TableKit'
- s.version = '2.9.0'
+ s.version = '2.10.0'
s.homepage = 'https://github.com/maxsokolov/TableKit'
s.summary = 'Type-safe declarative table views with Swift.'
From 065cd9ace3445c7d1195a8e94190920332ac44b0 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 29 Sep 2019 09:56:11 -0400
Subject: [PATCH 14/18] fix travis-ci
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index f1d55d2..dabee0a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: objective-c
-osx_image: xcode11.0
+osx_image: xcode11
branches:
only:
- master
From a0658f0b2e8e0442c5a0deab131476cbd36e7891 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 29 Sep 2019 10:03:45 -0400
Subject: [PATCH 15/18] fix travis-ci
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index dabee0a..570d984 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ env:
- PROJECT_FRAMEWORK="TableKit.xcodeproj"
matrix:
- - DESTINATION="OS=10.0,name=iPhone 5" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
+ - DESTINATION="OS=10.3.1,name=iPhone 5" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=11.1,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=12.0,name=iPhone 7 Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
- DESTINATION="OS=13.0,name=iPhone 11" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
From efe99eeb46d0f9439a40e24f39661edbba6472b4 Mon Sep 17 00:00:00 2001
From: Dmitry Frishbuter
Date: Sat, 5 Oct 2019 21:57:35 +0600
Subject: [PATCH 16/18] Fix typo in README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index b565112..6b9766c 100644
--- a/README.md
+++ b/README.md
@@ -204,7 +204,7 @@ tableDirector += rows
Done, your table is ready.
## Automatic cell registration
-TableKit can register your cells in a table view automatically. In case if your reusable cell id mathces cell's xib name:
+TableKit can register your cells in a table view automatically. In case if your reusable cell id matches cell's xib name:
```ruby
MyTableViewCell.swift
From eb93fe253c6862d39ba3752d9ce60c0ef35461ee Mon Sep 17 00:00:00 2001
From: mrtokii
Date: Sun, 3 May 2020 16:25:30 +0300
Subject: [PATCH 17/18] Add multiple selection actions & context menu action
---
Sources/TableDirector.swift | 25 +++++++++++++++++++++++++
Sources/TableKit.swift | 4 ++++
2 files changed, 29 insertions(+)
diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift
index 4a77708..2ffc99d 100644
--- a/Sources/TableDirector.swift
+++ b/Sources/TableDirector.swift
@@ -317,6 +317,31 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
return indexPath
}
+ @available(iOS 13.0, *)
+ open func tableView(
+ _ tableView: UITableView,
+ shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> Bool
+ {
+ invoke(action: .shouldBeginMultipleSelection, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? Bool ?? false
+ }
+
+ @available(iOS 13.0, *)
+ open func tableView(
+ _ tableView: UITableView,
+ didBeginMultipleSelectionInteractionAt indexPath: IndexPath)
+ {
+ invoke(action: .didBeginMultipleSelection, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath)
+ }
+
+ @available(iOS 13.0, *)
+ open func tableView(
+ _ tableView: UITableView,
+ contextMenuConfigurationForRowAt indexPath: IndexPath,
+ point: CGPoint) -> UIContextMenuConfiguration?
+ {
+ invoke(action: .showContextMenu, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath, userInfo: [TableKitUserInfoKeys.ContextMenuInvokePoint: point]) as? UIContextMenuConfiguration
+ }
+
// MARK: - Row editing
open func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return sections[indexPath.section].rows[indexPath.row].isEditingAllowed(forIndexPath: indexPath)
diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift
index 9202180..526b378 100644
--- a/Sources/TableKit.swift
+++ b/Sources/TableKit.swift
@@ -27,6 +27,7 @@ struct TableKitNotifications {
public struct TableKitUserInfoKeys {
public static let CellMoveDestinationIndexPath = "TableKitCellMoveDestinationIndexPath"
public static let CellCanMoveProposedIndexPath = "CellCanMoveProposedIndexPath"
+ public static let ContextMenuInvokePoint = "ContextMenuInvokePoint"
}
public protocol RowConfigurable {
@@ -73,6 +74,8 @@ public enum TableRowActionType {
case willDisplay
case didEndDisplaying
case shouldHighlight
+ case shouldBeginMultipleSelection
+ case didBeginMultipleSelection
case height
case canEdit
case configure
@@ -80,6 +83,7 @@ public enum TableRowActionType {
case canMove
case canMoveTo
case move
+ case showContextMenu
case accessoryButtonTap
case custom(String)
From 8bf4840d9d0475a92352f02f368f88b74eced447 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 4 May 2020 08:11:57 -0400
Subject: [PATCH 18/18] bump to 2.11.0
---
README.md | 2 +-
TableKit.podspec | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 6b9766c..626274c 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-
+
diff --git a/TableKit.podspec b/TableKit.podspec
index 7b9a0e0..2db6237 100644
--- a/TableKit.podspec
+++ b/TableKit.podspec
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
s.name = 'TableKit'
s.module_name = 'TableKit'
- s.version = '2.10.0'
+ s.version = '2.11.0'
s.homepage = 'https://github.com/maxsokolov/TableKit'
s.summary = 'Type-safe declarative table views with Swift.'