From 699d2aa00d0b89cc16dfc860a5a5a6f2ee04d651 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 14:58:38 +0300
Subject: [PATCH 01/14] fix row actions
---
TableKit/TableDirector.swift | 2 +-
TableKit/TableRow.swift | 6 ++--
TableKit/TableRowAction.swift | 32 ++++++++++++++-----
TableKit/TableSection.swift | 3 +-
TableKit/Tablet.swift | 18 -----------
.../Controllers/MainController.swift | 8 +++--
6 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/TableKit/TableDirector.swift b/TableKit/TableDirector.swift
index e77a671..b4f3ccb 100644
--- a/TableKit/TableDirector.swift
+++ b/TableKit/TableDirector.swift
@@ -26,8 +26,8 @@ import UIKit
public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
public private(set) weak var tableView: UITableView?
- private weak var scrollDelegate: UIScrollViewDelegate?
public private(set) var sections = [TableSection]()
+ private weak var scrollDelegate: UIScrollViewDelegate?
public init(tableView: UITableView, scrollDelegate: UIScrollViewDelegate? = nil) {
super.init()
diff --git a/TableKit/TableRow.swift b/TableKit/TableRow.swift
index 620342a..770c686 100644
--- a/TableKit/TableRow.swift
+++ b/TableKit/TableRow.swift
@@ -41,7 +41,7 @@ public protocol Row: RowConfigurable, RowActionable {
public class TableRow: Row {
public let item: ItemType
- private var actions = [String: RowAction]()
+ private lazy var actions = [String: TableRowAction]()
public var reusableIdentifier: String {
return CellType.reusableIdentifier()
@@ -56,7 +56,9 @@ public class TableRow]? = nil) {
+
self.item = item
+ actions?.forEach { self.actions[$0.type.key] = $0 }
}
// MARK: - RowConfigurable -
@@ -68,7 +70,7 @@ public class TableRow Any? {
- return actions[action.key]?.invoke()
+ return actions[action.key]?.invoke(item: item, cell: cell, path: path)
}
public func hasAction(action: TableRowActionType) -> Bool {
diff --git a/TableKit/TableRowAction.swift b/TableKit/TableRowAction.swift
index 9c73c79..e55b881 100644
--- a/TableKit/TableRowAction.swift
+++ b/TableKit/TableRowAction.swift
@@ -31,7 +31,7 @@ public enum TableRowActionType {
case shouldHighlight
case height
case custom(String)
-
+
var key: String {
switch (self) {
@@ -43,26 +43,42 @@ public enum TableRowActionType {
}
}
-protocol RowAction {
+public class TableRowActionData {
- func invoke() -> Any?
+ public let item: ItemType
+ public let cell: CellType?
+ public let path: NSIndexPath
+ public let userInfo: [NSObject: AnyObject]?
+
+ init(item: ItemType, cell: CellType?, path: NSIndexPath, userInfo: [NSObject: AnyObject]?) {
+
+ self.item = item
+ self.cell = cell
+ self.path = path
+ self.userInfo = userInfo
+ }
}
-public class TableRowAction: RowAction {
+public class TableRowAction {
public let type: TableRowActionType
+ private let handler: ((data: TableRowActionData) -> Any?)
+
+ public init(_ type: TableRowActionType, handler: (data: TableRowActionData) -> Void) {
- public init(_ type: TableRowActionType, handler: (row: TableRow) -> Void) {
self.type = type
+ self.handler = handler
}
- public init(_ type: TableRowActionType, handler: (row: TableRow) -> T) {
+ public init(_ type: TableRowActionType, handler: (data: TableRowActionData) -> T) {
+
self.type = type
+ self.handler = handler
}
// MARK: - RowAction -
- func invoke() -> Any? {
- return nil
+ func invoke(item item: ItemType, cell: UITableViewCell?, path: NSIndexPath) -> Any? {
+ return handler(data: TableRowActionData(item: item, cell: cell as? CellType, path: path, userInfo: nil))
}
}
\ No newline at end of file
diff --git a/TableKit/TableSection.swift b/TableKit/TableSection.swift
index 9046fbc..9ec231f 100644
--- a/TableKit/TableSection.swift
+++ b/TableKit/TableSection.swift
@@ -74,7 +74,6 @@ public class TableSection {
public func append(rows rows: [Row]) {
- //if let director = tableDirector { rows.forEach { $0.willUpdateDirector(director) } }
- //builders.appendContentsOf(rows)
+
}
}
\ No newline at end of file
diff --git a/TableKit/Tablet.swift b/TableKit/Tablet.swift
index fb22bde..6e96c77 100644
--- a/TableKit/Tablet.swift
+++ b/TableKit/Tablet.swift
@@ -25,24 +25,6 @@ struct TabletNotifications {
}
-public class ActionData {
-
- public let cell: CellType?
- public let item: DataType
- public let itemIndex: Int
- public let indexPath: NSIndexPath
- public let userInfo: [NSObject: AnyObject]?
-
- init(cell: CellType?, indexPath: NSIndexPath, item: DataType, itemIndex: Int, userInfo: [NSObject: AnyObject]?) {
-
- self.cell = cell
- self.indexPath = indexPath
- self.item = item
- self.itemIndex = itemIndex
- self.userInfo = userInfo
- }
-}
-
/**
A custom action that you can trigger from your cell.
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
index 9a2f174..b6bad3e 100644
--- a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
+++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
@@ -45,15 +45,17 @@ class MainController: UIViewController {
row1
- .action(TableRowAction(.click) { (row) in
+ .action(TableRowAction(.shouldHighlight) { (data) -> Bool in
print("1")
+
+ return false
})
- .action(TableRowAction(.click) { (row) -> String in
+ .action(TableRowAction(.click) { (data) in
print("2")
- return ""
+
})
From 653948ec08447b41f095c3f2c34ad87a9a9020ce Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 15:27:50 +0300
Subject: [PATCH 02/14] fix operators
---
TableKit/ConfigurableCell.swift | 10 +++---
TableKit/Operators.swift | 31 +++++--------------
TableKit/TableRowAction.swift | 4 +--
TableKit/TableSection.swift | 5 ++-
.../Controllers/MainController.swift | 2 +-
5 files changed, 16 insertions(+), 36 deletions(-)
diff --git a/TableKit/ConfigurableCell.swift b/TableKit/ConfigurableCell.swift
index d3363b4..4127139 100644
--- a/TableKit/ConfigurableCell.swift
+++ b/TableKit/ConfigurableCell.swift
@@ -21,9 +21,9 @@
import UIKit
public protocol ConfigurableCell {
-
+
associatedtype T
-
+
static func reusableIdentifier() -> String
static func estimatedHeight() -> CGFloat
static func defaultHeight() -> CGFloat?
@@ -31,15 +31,15 @@ public protocol ConfigurableCell {
}
public extension ConfigurableCell where Self: UITableViewCell {
-
+
static func reusableIdentifier() -> String {
return String(self)
}
-
+
static func estimatedHeight() -> CGFloat {
return UITableViewAutomaticDimension
}
-
+
static func defaultHeight() -> CGFloat? {
return nil
}
diff --git a/TableKit/Operators.swift b/TableKit/Operators.swift
index 9dfb675..14a4326 100644
--- a/TableKit/Operators.swift
+++ b/TableKit/Operators.swift
@@ -18,37 +18,20 @@
// 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.
-// -
-/*public func +=(left: TableDirector, right: RowBuilder) {
- left.append(section: TableSectionBuilder(rows: [right]))
-}
-
-public func +=(left: TableDirector, right: [RowBuilder]) {
- left.append(section: TableSectionBuilder(rows: right))
-}
-
-public func +=(left: TableDirector, right: TableSectionBuilder) {
+// --
+public func +=(left: TableDirector, right: TableSection) {
left.append(section: right)
}
-public func +=(left: TableDirector, right: [TableSectionBuilder]) {
+public func +=(left: TableDirector, right: [TableSection]) {
left.append(sections: right)
}
-// -
-public func +=(left: TableRowBuilder, right: DataType) {
- left.append(items: [right])
-}
-
-public func +=(left: TableRowBuilder, right: [DataType]) {
- left.append(items: right)
-}
-
-// -
-public func +=(left: TableSectionBuilder, right: RowBuilder) {
+// --
+public func +=(left: TableSection, right: Row) {
left.append(row: right)
}
-public func +=(left: TableSectionBuilder, right: [RowBuilder]) {
+public func +=(left: TableSection, right: [Row]) {
left.append(rows: right)
-}*/
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/TableKit/TableRowAction.swift b/TableKit/TableRowAction.swift
index e55b881..d4d10b7 100644
--- a/TableKit/TableRowAction.swift
+++ b/TableKit/TableRowAction.swift
@@ -75,9 +75,7 @@ public class TableRowAction Any? {
return handler(data: TableRowActionData(item: item, cell: cell as? CellType, path: path, userInfo: nil))
}
diff --git a/TableKit/TableSection.swift b/TableKit/TableSection.swift
index 9ec231f..63b6deb 100644
--- a/TableKit/TableSection.swift
+++ b/TableKit/TableSection.swift
@@ -71,9 +71,8 @@ public class TableSection {
public func append(row row: Row) {
append(rows: [row])
}
-
+
public func append(rows rows: [Row]) {
-
-
+ items.appendContentsOf(rows)
}
}
\ No newline at end of file
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
index b6bad3e..098588c 100644
--- a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
+++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
@@ -62,7 +62,7 @@ class MainController: UIViewController {
let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3])
-
+ tableDirector += [section]
tableDirector.append(section: section)
From 272d238a2a9858a9d51aade9b3ad5a2d6c5d2227 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 17:01:44 +0300
Subject: [PATCH 03/14] fix willSelect
---
TableKit/TableDirector.swift | 17 ++++++++++++-----
.../Controllers/MainController.swift | 2 +-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/TableKit/TableDirector.swift b/TableKit/TableDirector.swift
index b4f3ccb..7ddb85b 100644
--- a/TableKit/TableDirector.swift
+++ b/TableKit/TableDirector.swift
@@ -64,6 +64,10 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
// MARK: - Internal -
+ func hasAction(action: TableRowActionType, atIndexPath indexPath: NSIndexPath) -> Bool {
+ return sections[indexPath.section].items[indexPath.row].hasAction(action)
+ }
+
func didReceiveAction(notification: NSNotification) {
if let action = notification.object as? Action, indexPath = tableView?.indexPathForCell(action.cell) {
@@ -160,11 +164,14 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
public func tableView(tableView: UITableView, shouldHighlightRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return invoke(action: .shouldHighlight, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? Bool ?? true
}
-
- /*func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
-
- return invokeAction(.willSelect, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? NSIndexPath
- }*/
+
+ public func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
+
+ if hasAction(.willSelect, atIndexPath: indexPath) {
+ return invoke(action: .willSelect, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? NSIndexPath
+ }
+ return indexPath
+ }
// MARK: - Sections manipulation -
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
index 098588c..91f679e 100644
--- a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
+++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
@@ -64,7 +64,7 @@ class MainController: UIViewController {
tableDirector += [section]
- tableDirector.append(section: section)
+ //tableDirector.append(section: section)
From 1e4f76e04f45d83e5c9c49d17d3c5b582158660a Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 19:01:24 +0300
Subject: [PATCH 04/14] remove row builder
---
TableKit/TableDirector.swift | 15 +-
TableKit/TableKit.xcodeproj/project.pbxproj | 12 +-
TableKit/TableRowBuilder.swift | 168 ------------------
TableKit/Tablet.swift | 2 +-
.../Controllers/MainController.swift | 3 +-
5 files changed, 16 insertions(+), 184 deletions(-)
delete mode 100644 TableKit/TableRowBuilder.swift
diff --git a/TableKit/TableDirector.swift b/TableKit/TableDirector.swift
index 7ddb85b..a935721 100644
--- a/TableKit/TableDirector.swift
+++ b/TableKit/TableDirector.swift
@@ -70,11 +70,11 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
func didReceiveAction(notification: NSNotification) {
- if let action = notification.object as? Action, indexPath = tableView?.indexPathForCell(action.cell) {
+ //if let action = notification.object as? Action, indexPath = tableView?.indexPathForCell(action.cell) {
//let builder = builderAtIndexPath(indexPath)
//builder.0.invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath, itemIndex: builder.1, userInfo: notification.userInfo)
- }
+ //}
}
// MARK: - Height
@@ -175,17 +175,22 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
// MARK: - Sections manipulation -
- public func append(section section: TableSection) {
+ public func append(section section: TableSection) -> Self {
+
append(sections: [section])
+ return self
}
- public func append(sections sections: [TableSection]) {
+ public func append(sections sections: [TableSection]) -> Self {
sections.forEach { $0.tableDirector = self }
self.sections.appendContentsOf(sections)
+ return self
}
- public func clear() {
+ public func clear() -> Self {
+
sections.removeAll()
+ return self
}
}
\ No newline at end of file
diff --git a/TableKit/TableKit.xcodeproj/project.pbxproj b/TableKit/TableKit.xcodeproj/project.pbxproj
index bf9dc87..e812f36 100644
--- a/TableKit/TableKit.xcodeproj/project.pbxproj
+++ b/TableKit/TableKit.xcodeproj/project.pbxproj
@@ -13,7 +13,6 @@
DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76B1D0B68460021F650 /* TableDirector.swift */; };
DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76C1D0B68460021F650 /* TableRow.swift */; };
DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76D1D0B68460021F650 /* TableRowAction.swift */; };
- DA9EA7771D0B68460021F650 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76E1D0B68460021F650 /* TableRowBuilder.swift */; };
DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76F1D0B68460021F650 /* TableSection.swift */; };
DA9EA7791D0B68460021F650 /* Tablet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7701D0B68460021F650 /* Tablet.swift */; };
DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA77E1D0B689C0021F650 /* TableKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -27,7 +26,6 @@
DA9EA76B1D0B68460021F650 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = ""; };
DA9EA76C1D0B68460021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = ""; };
DA9EA76D1D0B68460021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = ""; };
- DA9EA76E1D0B68460021F650 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = ""; };
DA9EA76F1D0B68460021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = ""; };
DA9EA7701D0B68460021F650 /* Tablet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tablet.swift; sourceTree = ""; };
DA9EA77D1D0B689C0021F650 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
@@ -65,14 +63,13 @@
DA9EA7671D0B68340021F650 /* Classes */ = {
isa = PBXGroup;
children = (
+ DA9EA76B1D0B68460021F650 /* TableDirector.swift */,
+ DA9EA76F1D0B68460021F650 /* TableSection.swift */,
+ DA9EA76C1D0B68460021F650 /* TableRow.swift */,
+ DA9EA76D1D0B68460021F650 /* TableRowAction.swift */,
DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */,
DA9EA7691D0B68460021F650 /* HeightStrategy.swift */,
DA9EA76A1D0B68460021F650 /* Operators.swift */,
- DA9EA76B1D0B68460021F650 /* TableDirector.swift */,
- DA9EA76C1D0B68460021F650 /* TableRow.swift */,
- DA9EA76D1D0B68460021F650 /* TableRowAction.swift */,
- DA9EA76E1D0B68460021F650 /* TableRowBuilder.swift */,
- DA9EA76F1D0B68460021F650 /* TableSection.swift */,
DA9EA7701D0B68460021F650 /* Tablet.swift */,
);
name = Classes;
@@ -171,7 +168,6 @@
DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */,
DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */,
DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */,
- DA9EA7771D0B68460021F650 /* TableRowBuilder.swift in Sources */,
DA9EA7791D0B68460021F650 /* Tablet.swift in Sources */,
DA9EA7731D0B68460021F650 /* Operators.swift in Sources */,
);
diff --git a/TableKit/TableRowBuilder.swift b/TableKit/TableRowBuilder.swift
deleted file mode 100644
index be7777a..0000000
--- a/TableKit/TableRowBuilder.swift
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// Copyright (c) 2015 Max Sokolov https://twitter.com/max_sokolov
-//
-// 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.
-
-import UIKit
-
-public typealias ReturnValue = AnyObject?
-
-/**
- Responsible for building cells of given type and passing items to them.
- */
-/*public class TableRowBuilder : RowBuilder {
-
- public private(set) weak var tableDirector: TableDirector?
- private var heightStrategy: HeightStrategy?
-
- private var actions = [String: ActionHandler]()
- private var items = [DataType]()
-
- public func reusableIdentifier(_: Int) -> String {
- return CellType.reusableIdentifier()
- }
-
- public var numberOfRows: Int {
- return items.count
- }
-
- // MARK: - Initializers -
-
- public init(item: DataType) {
- items.append(item)
- }
-
- public init(items: [DataType]? = nil) {
-
- if let items = items {
- self.items.appendContentsOf(items)
- }
- }
-
- // MARK: - RowHeightCalculatable -
-
- public func rowHeight(index: Int, indexPath: NSIndexPath) -> CGFloat {
- return CellType.defaultHeight() ?? heightStrategy?.height(item(index: index), indexPath: indexPath, cell: CellType.self) ?? UITableViewAutomaticDimension
- }
-
- public func estimatedRowHeight(index: Int, indexPath: NSIndexPath) -> CGFloat {
- return CellType.estimatedHeight()
- }
-
- // MARK: - RowConfigurable -
-
- public func configure(cell: UITableViewCell, path: NSIndexPath, index: Int) {
-
- (cell as? CellType)?.configure(items[index])
- }
-
- // MARK: - Chaining actions -
-
- public func addAction(action: TableRowAction) {
-
- }
-
- public func action(key: String, handler: (data: ActionData) -> Void) -> Self {
-
- actions[key] = .Handler(handler)
- return self
- }
-
- public func action(type: ActionType, handler: (data: ActionData) -> Void) -> Self {
-
- actions[type.key] = .Handler(handler)
- return self
- }
-
- public func valueAction(type: ActionType, handler: (data: ActionData) -> ReturnValue) -> Self {
-
- actions[type.key] = .ValueHandler(handler)
- return self
- }
-
- public func invoke(action action: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int, userInfo: [NSObject: AnyObject]?) -> AnyObject? {
-
- if case .configure = action {
- (cell as? CellType)?.configure(item(index: itemIndex))
- }
-
- if let action = actions[action.key] {
- return action.invoke(ActionData(cell: cell as? CellType, indexPath: indexPath, item: items[itemIndex], itemIndex: itemIndex, userInfo: userInfo))
- }
- return nil
- }
-
- private func registerCell(inTableView tableView: UITableView) {
-
- if tableView.dequeueReusableCellWithIdentifier(reusableIdentifier(0)) != nil {
- return
- }
-
- let resource = String(CellType)
- let bundle = NSBundle(forClass: CellType.self)
-
- if let _ = bundle.pathForResource(resource, ofType: "nib") { // existing cell
- tableView.registerNib(UINib(nibName: resource, bundle: bundle), forCellReuseIdentifier: reusableIdentifier(0))
- } else {
- tableView.registerClass(CellType.self, forCellReuseIdentifier: reusableIdentifier(0))
- }
- }
-
- public func willUpdateDirector(director: TableDirector?) {
- tableDirector = director
-
- heightStrategy = PrototypeHeightStrategy()
- heightStrategy?.tableView = director?.tableView
- }
-
- // MARK: - Items manipulation -
-
- public func delete(indexes indexes: [Int], animated: UITableViewRowAnimation) -> Self {
-
- return self
- }
-
- public func insert(items: [DataType], atIndex index: Int, animated: UITableViewRowAnimation) -> Self {
-
- self.items.insertContentsOf(items, at: index)
-
- return self
- }
-
- public func move(indexes: [Int], toIndexes: [Int]) -> Self {
-
- return self
- }
-
- public func update(index index: Int, item: DataType, animated: UITableViewRowAnimation) -> Self {
-
- return self
- }
-
- public func item(index index: Int) -> DataType {
- return items[index]
- }
-
- public func append(items items: [DataType]) {
- self.items.appendContentsOf(items)
- }
-
- public func clear() {
- items.removeAll()
- }
-}*/
\ No newline at end of file
diff --git a/TableKit/Tablet.swift b/TableKit/Tablet.swift
index 6e96c77..2d52800 100644
--- a/TableKit/Tablet.swift
+++ b/TableKit/Tablet.swift
@@ -30,7 +30,7 @@ struct TabletNotifications {
A custom action that you can trigger from your cell.
You can eacily catch actions using a chaining manner with your row builder.
*/
-public class Action {
+public class TableCellAction {
/// The cell that triggers an action.
public let cell: UITableViewCell
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
index 91f679e..228e894 100644
--- a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
+++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
@@ -58,8 +58,7 @@ class MainController: UIViewController {
})
-
-
+
let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3])
tableDirector += [section]
From 310cec9c128c87953ef1da8ab54682270f5d70e6 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 21:38:53 +0300
Subject: [PATCH 05/14] fix cell action
---
TableKit/{Tablet.swift => TableCellAction.swift} | 8 +++-----
TableKit/TableDirector.swift | 11 ++++-------
TableKit/TableKit.xcodeproj/project.pbxproj | 8 ++++----
.../Views/StoryboardImageTableViewCell.swift | 9 ++++++---
4 files changed, 17 insertions(+), 19 deletions(-)
rename TableKit/{Tablet.swift => TableCellAction.swift} (91%)
diff --git a/TableKit/Tablet.swift b/TableKit/TableCellAction.swift
similarity index 91%
rename from TableKit/Tablet.swift
rename to TableKit/TableCellAction.swift
index 2d52800..8c81bef 100644
--- a/TableKit/Tablet.swift
+++ b/TableKit/TableCellAction.swift
@@ -20,12 +20,10 @@
import UIKit
-struct TabletNotifications {
- static let CellAction = "TabletNotificationsCellAction"
+struct TableKitNotifications {
+ static let CellAction = "TableKitNotificationsCellAction"
}
-
-
/**
A custom action that you can trigger from your cell.
You can eacily catch actions using a chaining manner with your row builder.
@@ -49,6 +47,6 @@ public class TableCellAction {
}
public func invoke() {
- NSNotificationCenter.defaultCenter().postNotificationName(TabletNotifications.CellAction, object: self, userInfo: userInfo)
+ NSNotificationCenter.defaultCenter().postNotificationName(TableKitNotifications.CellAction, object: self, userInfo: userInfo)
}
}
\ No newline at end of file
diff --git a/TableKit/TableDirector.swift b/TableKit/TableDirector.swift
index a935721..03545f6 100644
--- a/TableKit/TableDirector.swift
+++ b/TableKit/TableDirector.swift
@@ -37,7 +37,7 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
self.tableView?.delegate = self
self.tableView?.dataSource = self
- NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(didReceiveAction), name: TabletNotifications.CellAction, object: nil)
+ NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(didReceiveAction), name: TableKitNotifications.CellAction, object: nil)
}
deinit {
@@ -69,12 +69,9 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
}
func didReceiveAction(notification: NSNotification) {
-
- //if let action = notification.object as? Action, indexPath = tableView?.indexPathForCell(action.cell) {
-
- //let builder = builderAtIndexPath(indexPath)
- //builder.0.invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath, itemIndex: builder.1, userInfo: notification.userInfo)
- //}
+
+ guard let action = notification.object as? TableCellAction, indexPath = tableView?.indexPathForCell(action.cell) else { return }
+ invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath)
}
// MARK: - Height
diff --git a/TableKit/TableKit.xcodeproj/project.pbxproj b/TableKit/TableKit.xcodeproj/project.pbxproj
index e812f36..449e067 100644
--- a/TableKit/TableKit.xcodeproj/project.pbxproj
+++ b/TableKit/TableKit.xcodeproj/project.pbxproj
@@ -14,7 +14,7 @@
DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76C1D0B68460021F650 /* TableRow.swift */; };
DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76D1D0B68460021F650 /* TableRowAction.swift */; };
DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76F1D0B68460021F650 /* TableSection.swift */; };
- DA9EA7791D0B68460021F650 /* Tablet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7701D0B68460021F650 /* Tablet.swift */; };
+ DA9EA7791D0B68460021F650 /* TableCellAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7701D0B68460021F650 /* TableCellAction.swift */; };
DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA77E1D0B689C0021F650 /* TableKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
@@ -27,7 +27,7 @@
DA9EA76C1D0B68460021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = ""; };
DA9EA76D1D0B68460021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = ""; };
DA9EA76F1D0B68460021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = ""; };
- DA9EA7701D0B68460021F650 /* Tablet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tablet.swift; sourceTree = ""; };
+ DA9EA7701D0B68460021F650 /* TableCellAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellAction.swift; sourceTree = ""; };
DA9EA77D1D0B689C0021F650 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
DA9EA77E1D0B689C0021F650 /* TableKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableKit.h; sourceTree = ""; };
/* End PBXFileReference section */
@@ -67,10 +67,10 @@
DA9EA76F1D0B68460021F650 /* TableSection.swift */,
DA9EA76C1D0B68460021F650 /* TableRow.swift */,
DA9EA76D1D0B68460021F650 /* TableRowAction.swift */,
+ DA9EA7701D0B68460021F650 /* TableCellAction.swift */,
DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */,
DA9EA7691D0B68460021F650 /* HeightStrategy.swift */,
DA9EA76A1D0B68460021F650 /* Operators.swift */,
- DA9EA7701D0B68460021F650 /* Tablet.swift */,
);
name = Classes;
sourceTree = "";
@@ -168,7 +168,7 @@
DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */,
DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */,
DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */,
- DA9EA7791D0B68460021F650 /* Tablet.swift in Sources */,
+ DA9EA7791D0B68460021F650 /* TableCellAction.swift in Sources */,
DA9EA7731D0B68460021F650 /* Operators.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift b/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift
index c809967..4cd5631 100644
--- a/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift
+++ b/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift
@@ -22,12 +22,15 @@ class StoryboardImageTableViewCell: UITableViewCell, ConfigurableCell {
titleLabel.text = string
subtitleLabel.text = "Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.1"
}
+
+ static func estimatedHeight() -> CGFloat {
+ return 500
+ }
override func layoutSubviews() {
super.layoutSubviews()
- contentView.layoutIfNeeded()
-
- subtitleLabel.preferredMaxLayoutWidth = subtitleLabel.bounds.size.width
+ //contentView.layoutIfNeeded()
+ //subtitleLabel.preferredMaxLayoutWidth = subtitleLabel.bounds.size.width
}
}
\ No newline at end of file
From 533c6e6eb8ab68f02464ccb511967aedf810ef68 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 23:42:39 +0300
Subject: [PATCH 06/14] add row builder
---
TableKit/TableKit.xcodeproj/project.pbxproj | 4 ++
TableKit/TableRow.swift | 2 +-
TableKit/TableRowBuilder.swift | 52 +++++++++++++++++++
TableKit/TableSection.swift | 4 +-
.../Controllers/MainController.swift | 27 +++++-----
5 files changed, 73 insertions(+), 16 deletions(-)
create mode 100644 TableKit/TableRowBuilder.swift
diff --git a/TableKit/TableKit.xcodeproj/project.pbxproj b/TableKit/TableKit.xcodeproj/project.pbxproj
index 449e067..085b763 100644
--- a/TableKit/TableKit.xcodeproj/project.pbxproj
+++ b/TableKit/TableKit.xcodeproj/project.pbxproj
@@ -16,6 +16,7 @@
DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76F1D0B68460021F650 /* TableSection.swift */; };
DA9EA7791D0B68460021F650 /* TableCellAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7701D0B68460021F650 /* TableCellAction.swift */; };
DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA77E1D0B689C0021F650 /* TableKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DA9EA7861D0DFAD60021F650 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7851D0DFAD60021F650 /* TableRowBuilder.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -30,6 +31,7 @@
DA9EA7701D0B68460021F650 /* TableCellAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellAction.swift; sourceTree = ""; };
DA9EA77D1D0B689C0021F650 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
DA9EA77E1D0B689C0021F650 /* TableKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableKit.h; sourceTree = ""; };
+ DA9EA7851D0DFAD60021F650 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -66,6 +68,7 @@
DA9EA76B1D0B68460021F650 /* TableDirector.swift */,
DA9EA76F1D0B68460021F650 /* TableSection.swift */,
DA9EA76C1D0B68460021F650 /* TableRow.swift */,
+ DA9EA7851D0DFAD60021F650 /* TableRowBuilder.swift */,
DA9EA76D1D0B68460021F650 /* TableRowAction.swift */,
DA9EA7701D0B68460021F650 /* TableCellAction.swift */,
DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */,
@@ -168,6 +171,7 @@
DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */,
DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */,
DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */,
+ DA9EA7861D0DFAD60021F650 /* TableRowBuilder.swift in Sources */,
DA9EA7791D0B68460021F650 /* TableCellAction.swift in Sources */,
DA9EA7731D0B68460021F650 /* Operators.swift in Sources */,
);
diff --git a/TableKit/TableRow.swift b/TableKit/TableRow.swift
index 770c686..2b06615 100644
--- a/TableKit/TableRow.swift
+++ b/TableKit/TableRow.swift
@@ -79,7 +79,7 @@ public class TableRow) -> Self {
+ public func addAction(action: TableRowAction) -> Self {
actions[action.type.key] = action
return self
diff --git a/TableKit/TableRowBuilder.swift b/TableKit/TableRowBuilder.swift
new file mode 100644
index 0000000..6351159
--- /dev/null
+++ b/TableKit/TableRowBuilder.swift
@@ -0,0 +1,52 @@
+//
+// Copyright (c) 2015 Max Sokolov https://twitter.com/max_sokolov
+//
+// 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.
+
+public protocol RowBuilder {
+
+ func rowItems() -> [Row]?
+}
+
+public class TableRowBuilder: RowBuilder {
+
+ public typealias BuilderHandler = (TableRowBuilder) -> ()
+
+ public var items: [ItemType]?
+ public var actions: [TableRowAction]?
+
+ public init(handler: BuilderHandler) {
+ handler(self)
+ }
+
+ // MARK: - RowBuilder -
+
+ public func rowItems() -> [Row]? {
+ return items?.map { TableRow(item: $0, actions: actions) }
+ }
+}
+
+public extension TableSection {
+
+ public func append(builder builder: RowBuilder) {
+
+ if let rows = builder.rowItems() {
+ append(rows: rows)
+ }
+ }
+}
\ No newline at end of file
diff --git a/TableKit/TableSection.swift b/TableKit/TableSection.swift
index 63b6deb..51453df 100644
--- a/TableKit/TableSection.swift
+++ b/TableKit/TableSection.swift
@@ -48,14 +48,14 @@ public class TableSection {
}
}
- public convenience init(headerTitle: String?, footerTitle: String?, rows: [Row]?) {
+ public convenience init(headerTitle: String?, footerTitle: String?, rows: [Row]? = nil) {
self.init(rows: rows)
self.headerTitle = headerTitle
self.footerTitle = footerTitle
}
- public convenience init(headerView: UIView?, footerView: UIView?, rows: [Row]?) {
+ public convenience init(headerView: UIView?, footerView: UIView?, rows: [Row]? = nil) {
self.init(rows: rows)
self.headerView = headerView
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
index 228e894..d3e33eb 100644
--- a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
+++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
@@ -21,22 +21,20 @@ class MainController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
- /*let rowBuilder = TableRowBuilder(items: ["1", "1", "1", "1"])
- .action(.click) { [unowned self] data in
-
- self.performSegueWithIdentifier("headerfooter", sender: nil)
- }*/
-
-
-
let a = TableRowAction(.click) {
- (row) in
+ (data) in
- print("3")
+ print("3", data.item)
}
+ let b = TableRowBuilder {
+
+ $0.items = ["1", "2", "3"]
+ $0.actions = [a]
+ }
+
let row1 = TableRow(item: "1")
let row2 = TableRow(item: "2")
@@ -45,13 +43,13 @@ class MainController: UIViewController {
row1
- .action(TableRowAction(.shouldHighlight) { (data) -> Bool in
+ .addAction(TableRowAction(.shouldHighlight) { (data) -> Bool in
print("1")
return false
})
- .action(TableRowAction(.click) { (data) in
+ .addAction(TableRowAction(.click) { (data) in
print("2")
@@ -59,7 +57,10 @@ class MainController: UIViewController {
})
- let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3])
+ let section = TableSection()
+ section.append(builder: b)
+
+ //let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3])
tableDirector += [section]
From 42eec9243e559b6dff119cd2b042094b274e38e5 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Sun, 12 Jun 2016 23:49:06 +0300
Subject: [PATCH 07/14] add init to builder
---
TableKit/TableRowBuilder.swift | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/TableKit/TableRowBuilder.swift b/TableKit/TableRowBuilder.swift
index 6351159..dc0aefe 100644
--- a/TableKit/TableRowBuilder.swift
+++ b/TableKit/TableRowBuilder.swift
@@ -24,16 +24,20 @@ public protocol RowBuilder {
}
public class TableRowBuilder: RowBuilder {
-
- public typealias BuilderHandler = (TableRowBuilder) -> ()
-
+
public var items: [ItemType]?
public var actions: [TableRowAction]?
- public init(handler: BuilderHandler) {
+ public init(handler: (TableRowBuilder) -> ()) {
handler(self)
}
+ public init(items: [ItemType], actions: [TableRowAction]? = nil) {
+
+ self.items = items
+ self.actions = actions
+ }
+
// MARK: - RowBuilder -
public func rowItems() -> [Row]? {
From 8509c8d64e3095ca6b708ceb6ff12115eb58a511 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 01:07:46 +0300
Subject: [PATCH 08/14] bump readme
---
README.md | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index a4b452c..ec0f076 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,11 @@
-
+
-TableKit is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of `switch` or `if` statements when you deal with bunch of different cells in different sections.
+TableKit is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swifty way. TableKit's goal is to provide the easiest way to create complex table views. With TableKit you don't have to write a messy code of `switch` or `if` statements when you deal with bunch of different cells in different sections.
## Features
@@ -22,8 +22,40 @@ TableKit is a super lightweight yet powerful generic library that handles a comp
- [x] Extensibility
- [x] Tests
-Docs will be updated soon.
+## Usage
+
+Create your rows:
+```swift
+let row1 = TableRow(item: "1")
+let row2 = TableRow(item: 2)
+let row3 = TableRow(item: 3.0)
+```
+Put rows into section:
+```swift
+let s = TableSection(rows: [row1, row2, row3])
+```
+And configure your table:
+```swift
+let tableDirector = TableDirector(tableView: tableView)
+tableDirector += section
+```
+Done. Your table is ready. You may want to look at your cell. It has to conform to ConfigurableCell protocol:
+```swift
+class StringTableViewCell: UITableViewCell, ConfigurableCell {
+
+ typealias T = String
+
+ func configure(string: T) {
+ titleLabel.text = string
+ }
+
+ static func estimatedHeight() -> CGFloat {
+ return 44
+ }
+}
+```
+
## License
-Tablet is available under the MIT license. See LICENSE for details.
\ No newline at end of file
+TableKit is available under the MIT license. See LICENSE for details.
\ No newline at end of file
From 721596131b7fa4a79a26ddde1627fc44ca96f915 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 01:39:26 +0300
Subject: [PATCH 09/14] update readme
---
README.md | 51 +++++++++++++++++--
.../Controllers/MainController.swift | 6 +--
2 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index ec0f076..156c43b 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,8 @@
-TableKit is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swifty way. TableKit's goal is to provide the easiest way to create complex table views. With TableKit you don't have to write a messy code of `switch` or `if` statements when you deal with bunch of different cells in different sections.
+TableKit is a super lightweight yet powerful generic library that allows you to build complex table views in a declarative type-safe manner.
+It hides a complexity of `UITableViewDataSource` and `UITableViewDelegate` methods behind the scene, so your code will be look clean, easy to read and nice to maintain.
## Features
@@ -32,14 +33,14 @@ let row3 = TableRow(item: 3.0)
```
Put rows into section:
```swift
-let s = TableSection(rows: [row1, row2, row3])
+let section = TableSection(rows: [row1, row2, row3])
```
-And configure your table:
+And setup your table:
```swift
let tableDirector = TableDirector(tableView: tableView)
tableDirector += section
```
-Done. Your table is ready. You may want to look at your cell. It has to conform to ConfigurableCell protocol:
+Done. Your table is ready. You may want to look at your cell. It has to conform to `ConfigurableCell` protocol:
```swift
class StringTableViewCell: UITableViewCell, ConfigurableCell {
@@ -54,7 +55,49 @@ class StringTableViewCell: UITableViewCell, ConfigurableCell {
}
}
```
+You could have as many rows and sections as you need.
+## Row actions
+
+It nice to have some actions that related to your cells:
+```swift
+let action = TableRowAction(.click) { (data) in
+
+}
+
+let row = TableRow(item: "some", actions: [action])
+```
+Or, using nice chaining approach:
+```swift
+let row = TableRow(item: "some")
+
+row
+ .addAction(TableRowAction(.click) { (data) in
+
+ })
+ .addAction(TableRowAction(.shouldHighlight) { (data) -> Bool in
+ return false
+ })
+```
+
+## Batch rows
+You could have a situation when you need a lot of cells with the same type. In that case it's better to use `TableRowBuilder`:
+```swift
+let builder = TableRowBuilder {
+
+ // do some additional setup here
+ $0.items = ["1", "2", "3"]
+ $0.actions = [action]
+}
+
+section.append(builder: builder)
+```
+Or if you don't need to do some additional setup for your data, just use standart init:
+```swift
+let builder = TableRowBuilder(items: ["1", "2", "3"], actions: [actions])
+
+section.append(builder: builder)
+```
## License
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
index d3e33eb..d2b4cab 100644
--- a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
+++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift
@@ -29,11 +29,7 @@ class MainController: UIViewController {
}
- let b = TableRowBuilder {
-
- $0.items = ["1", "2", "3"]
- $0.actions = [a]
- }
+ let b = TableRowBuilder(items: ["1", "2", "3"], actions: [a])
let row1 = TableRow(item: "1")
From 9bf4e72f86ba1d15dcdc6630e54bb59f8ee49ba4 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 01:55:41 +0300
Subject: [PATCH 10/14] update readme
---
README.md | 20 +++++++++++++++++++-
TableKit/TableSection.swift | 5 -----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 156c43b..dd141b0 100644
--- a/README.md
+++ b/README.md
@@ -92,13 +92,31 @@ let builder = TableRowBuilder {
section.append(builder: builder)
```
-Or if you don't need to do some additional setup for your data, just use standart init:
+Or if you don't need an additional setup for your data, just use standart init:
```swift
let builder = TableRowBuilder(items: ["1", "2", "3"], actions: [actions])
section.append(builder: builder)
```
+## Installation
+
+### CocoaPods
+To integrate TableKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
+
+```ruby
+source 'https://github.com/CocoaPods/Specs.git'
+platform :ios, '8.0'
+use_frameworks!
+
+pod 'TableKit'
+```
+
+## Requirements
+
+- iOS 8.0+
+- Xcode 7.0+
+
## License
TableKit is available under the MIT license. See LICENSE for details.
\ No newline at end of file
diff --git a/TableKit/TableSection.swift b/TableKit/TableSection.swift
index 51453df..71fe404 100644
--- a/TableKit/TableSection.swift
+++ b/TableKit/TableSection.swift
@@ -20,10 +20,6 @@
import UIKit
-/**
- Responsible for building a certain table view section.
- Can host several row builders.
-*/
public class TableSection {
weak var tableDirector: TableDirector?
@@ -36,7 +32,6 @@ public class TableSection {
public private(set) var headerView: UIView?
public private(set) var footerView: UIView?
- /// A total number of rows in section of each row builder.
public var numberOfRows: Int {
return items.count
}
From c352099fa2095cfbeb1338cd7e237228a4ee6b10 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 13:09:05 +0300
Subject: [PATCH 11/14] mark as shared
---
.../xcshareddata/xcschemes/TableKit.xcscheme | 80 +++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100644 TableKit/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme
diff --git a/TableKit/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme b/TableKit/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme
new file mode 100644
index 0000000..9f7535f
--- /dev/null
+++ b/TableKit/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 1e018523bb6f56658bcadb4bd4a4bc0c9a7d2218 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 13:12:12 +0300
Subject: [PATCH 12/14] update readme
---
README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index dd141b0..d3a3c15 100644
--- a/README.md
+++ b/README.md
@@ -101,7 +101,7 @@ section.append(builder: builder)
## Installation
-### CocoaPods
+#### CocoaPods
To integrate TableKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
@@ -111,6 +111,8 @@ use_frameworks!
pod 'TableKit'
```
+#### Carthage
+Add the line `github "johnsundell/unbox"` to your `Cartfile`
## Requirements
From 6f3daa337b71e500189ca9499d3a9b0b78f5abdc Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 13:51:02 +0300
Subject: [PATCH 13/14] support Swift Package Manager
---
TableKit/Info.plist => Configs/TableKit.plist | 0
.../Info.plist => Configs/TableKitTests.plist | 0
.../Classes/Application/AppDelegate.swift | 0
.../Controllers/HeaderFooterController.swift | 0
.../Controllers/MainController.swift | 0
.../Views/StoryboardImageTableViewCell.swift | 0
.../Views/StoryboardTableViewCell.swift | 0
.../AppIcon.appiconset/Contents.json | 0
{TableKitDemo => Demo}/Resources/Info.plist | 0
.../Storyboards/LaunchScreen.storyboard | 0
.../Resources/Storyboards/Main.storyboard | 0
.../TableKitDemo.xcodeproj/project.pbxproj | 91 +++++++-
.../contents.xcworkspacedata | 0
Package.swift | 5 +
{TableKit => Sources}/ConfigurableCell.swift | 0
{TableKit => Sources}/HeightStrategy.swift | 0
{TableKit => Sources}/Operators.swift | 0
{TableKit => Sources}/TableCellAction.swift | 0
{TableKit => Sources}/TableDirector.swift | 0
{TableKit => Sources}/TableRow.swift | 0
{TableKit => Sources}/TableRowAction.swift | 0
{TableKit => Sources}/TableRowBuilder.swift | 2 +
{TableKit => Sources}/TableSection.swift | 0
TableKit.podspec | 4 +-
.../project.pbxproj | 210 +++++++++++++-----
.../contents.xcworkspacedata | 7 +
.../xcshareddata/xcschemes/TableKit.xcscheme | 0
TableKit.xcworkspace/contents.xcworkspacedata | 10 -
TableKit/TableKit.h | 19 --
...{TabletTests.swift => TableKitTests.swift} | 6 +-
30 files changed, 264 insertions(+), 90 deletions(-)
rename TableKit/Info.plist => Configs/TableKit.plist (100%)
rename Tests/Info.plist => Configs/TableKitTests.plist (100%)
rename {TableKitDemo => Demo}/Classes/Application/AppDelegate.swift (100%)
rename {TableKitDemo => Demo}/Classes/Presentation/Controllers/HeaderFooterController.swift (100%)
rename {TableKitDemo => Demo}/Classes/Presentation/Controllers/MainController.swift (100%)
rename {TableKitDemo => Demo}/Classes/Presentation/Views/StoryboardImageTableViewCell.swift (100%)
rename {TableKitDemo => Demo}/Classes/Presentation/Views/StoryboardTableViewCell.swift (100%)
rename {TableKitDemo => Demo}/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json (100%)
rename {TableKitDemo => Demo}/Resources/Info.plist (100%)
rename {TableKitDemo => Demo}/Resources/Storyboards/LaunchScreen.storyboard (100%)
rename {TableKitDemo => Demo}/Resources/Storyboards/Main.storyboard (100%)
rename {TableKitDemo => Demo}/TableKitDemo.xcodeproj/project.pbxproj (79%)
rename {TableKitDemo => Demo}/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%)
create mode 100644 Package.swift
rename {TableKit => Sources}/ConfigurableCell.swift (100%)
rename {TableKit => Sources}/HeightStrategy.swift (100%)
rename {TableKit => Sources}/Operators.swift (100%)
rename {TableKit => Sources}/TableCellAction.swift (100%)
rename {TableKit => Sources}/TableDirector.swift (100%)
rename {TableKit => Sources}/TableRow.swift (100%)
rename {TableKit => Sources}/TableRowAction.swift (100%)
rename {TableKit => Sources}/TableRowBuilder.swift (99%)
rename {TableKit => Sources}/TableSection.swift (100%)
rename {TableKit/TableKit.xcodeproj => TableKit.xcodeproj}/project.pbxproj (56%)
create mode 100644 TableKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename {TableKit/TableKit.xcodeproj => TableKit.xcodeproj}/xcshareddata/xcschemes/TableKit.xcscheme (100%)
delete mode 100644 TableKit.xcworkspace/contents.xcworkspacedata
delete mode 100644 TableKit/TableKit.h
rename Tests/{TabletTests.swift => TableKitTests.swift} (99%)
diff --git a/TableKit/Info.plist b/Configs/TableKit.plist
similarity index 100%
rename from TableKit/Info.plist
rename to Configs/TableKit.plist
diff --git a/Tests/Info.plist b/Configs/TableKitTests.plist
similarity index 100%
rename from Tests/Info.plist
rename to Configs/TableKitTests.plist
diff --git a/TableKitDemo/Classes/Application/AppDelegate.swift b/Demo/Classes/Application/AppDelegate.swift
similarity index 100%
rename from TableKitDemo/Classes/Application/AppDelegate.swift
rename to Demo/Classes/Application/AppDelegate.swift
diff --git a/TableKitDemo/Classes/Presentation/Controllers/HeaderFooterController.swift b/Demo/Classes/Presentation/Controllers/HeaderFooterController.swift
similarity index 100%
rename from TableKitDemo/Classes/Presentation/Controllers/HeaderFooterController.swift
rename to Demo/Classes/Presentation/Controllers/HeaderFooterController.swift
diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/Demo/Classes/Presentation/Controllers/MainController.swift
similarity index 100%
rename from TableKitDemo/Classes/Presentation/Controllers/MainController.swift
rename to Demo/Classes/Presentation/Controllers/MainController.swift
diff --git a/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift b/Demo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift
similarity index 100%
rename from TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift
rename to Demo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift
diff --git a/TableKitDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift b/Demo/Classes/Presentation/Views/StoryboardTableViewCell.swift
similarity index 100%
rename from TableKitDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift
rename to Demo/Classes/Presentation/Views/StoryboardTableViewCell.swift
diff --git a/TableKitDemo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json b/Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json
similarity index 100%
rename from TableKitDemo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json
rename to Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/TableKitDemo/Resources/Info.plist b/Demo/Resources/Info.plist
similarity index 100%
rename from TableKitDemo/Resources/Info.plist
rename to Demo/Resources/Info.plist
diff --git a/TableKitDemo/Resources/Storyboards/LaunchScreen.storyboard b/Demo/Resources/Storyboards/LaunchScreen.storyboard
similarity index 100%
rename from TableKitDemo/Resources/Storyboards/LaunchScreen.storyboard
rename to Demo/Resources/Storyboards/LaunchScreen.storyboard
diff --git a/TableKitDemo/Resources/Storyboards/Main.storyboard b/Demo/Resources/Storyboards/Main.storyboard
similarity index 100%
rename from TableKitDemo/Resources/Storyboards/Main.storyboard
rename to Demo/Resources/Storyboards/Main.storyboard
diff --git a/TableKitDemo/TableKitDemo.xcodeproj/project.pbxproj b/Demo/TableKitDemo.xcodeproj/project.pbxproj
similarity index 79%
rename from TableKitDemo/TableKitDemo.xcodeproj/project.pbxproj
rename to Demo/TableKitDemo.xcodeproj/project.pbxproj
index 9175ff7..67cde0e 100644
--- a/TableKitDemo/TableKitDemo.xcodeproj/project.pbxproj
+++ b/Demo/TableKitDemo.xcodeproj/project.pbxproj
@@ -8,7 +8,8 @@
/* Begin PBXBuildFile section */
DA08A0531CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */; };
- DA9EA7821D0B6B070021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7811D0B6B070021F650 /* TableKit.framework */; };
+ DA9EA7D91D0EC65B0021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7D61D0EC5C60021F650 /* TableKit.framework */; };
+ DA9EA7DA1D0EC65B0021F650 /* TableKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7D61D0EC5C60021F650 /* TableKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DAC2D5CA1C9D303E009E9C19 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D5C91C9D303E009E9C19 /* AppDelegate.swift */; };
DAC2D5CF1C9D30A7009E9C19 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D5CD1C9D30A7009E9C19 /* Main.storyboard */; };
DAC2D5D01C9D30A7009E9C19 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D5CE1C9D30A7009E9C19 /* LaunchScreen.storyboard */; };
@@ -18,9 +19,47 @@
DACB717A1CC2D89D00432BD3 /* HeaderFooterController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACB71791CC2D89D00432BD3 /* HeaderFooterController.swift */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ DA9EA7D51D0EC5C60021F650 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = DA9EA7561D0B679A0021F650;
+ remoteInfo = TableKit;
+ };
+ DA9EA7D71D0EC5C60021F650 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = DA9EA7C41D0EC45F0021F650;
+ remoteInfo = TableKitTests;
+ };
+ DA9EA7DB1D0EC65B0021F650 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = DA9EA7551D0B679A0021F650;
+ remoteInfo = TableKit;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ DA9EA7DD1D0EC65B0021F650 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ DA9EA7DA1D0EC65B0021F650 /* TableKit.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardImageTableViewCell.swift; sourceTree = ""; };
- DA9EA7811D0B6B070021F650 /* TableKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TableKit.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/TableKit-blgxvmkyvpocltgadmpliruugomo/Build/Products/Debug-iphonesimulator/TableKit.framework"; sourceTree = ""; };
+ DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TableKit.xcodeproj; path = ../TableKit.xcodeproj; sourceTree = ""; };
DAB7EB271BEF787300D2AD5E /* TableKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
DAC2D5C91C9D303E009E9C19 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
DAC2D5CD1C9D30A7009E9C19 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; };
@@ -37,7 +76,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- DA9EA7821D0B6B070021F650 /* TableKit.framework in Frameworks */,
+ DA9EA7D91D0EC65B0021F650 /* TableKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -47,14 +86,23 @@
DA539C871CF50B1800368ACB /* Frameworks */ = {
isa = PBXGroup;
children = (
- DA9EA7811D0B6B070021F650 /* TableKit.framework */,
);
name = Frameworks;
sourceTree = "";
};
+ DA9EA7D11D0EC5C50021F650 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ DA9EA7D61D0EC5C60021F650 /* TableKit.framework */,
+ DA9EA7D81D0EC5C60021F650 /* TableKitTests.xctest */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
DAB7EB1E1BEF787300D2AD5E = {
isa = PBXGroup;
children = (
+ DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */,
DAC2D5C61C9D2FE5009E9C19 /* Classes */,
DAC2D5CB1C9D3058009E9C19 /* Resources */,
DA539C871CF50B1800368ACB /* Frameworks */,
@@ -151,10 +199,12 @@
DAB7EB231BEF787300D2AD5E /* Sources */,
DAB7EB241BEF787300D2AD5E /* Frameworks */,
DAB7EB251BEF787300D2AD5E /* Resources */,
+ DA9EA7DD1D0EC65B0021F650 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
+ DA9EA7DC1D0EC65B0021F650 /* PBXTargetDependency */,
);
name = TableKitDemo;
productName = TabletDemo;
@@ -188,6 +238,12 @@
mainGroup = DAB7EB1E1BEF787300D2AD5E;
productRefGroup = DAB7EB281BEF787300D2AD5E /* Products */;
projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = DA9EA7D11D0EC5C50021F650 /* Products */;
+ ProjectRef = DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */;
+ },
+ );
projectRoot = "";
targets = (
DAB7EB261BEF787300D2AD5E /* TableKitDemo */,
@@ -195,6 +251,23 @@
};
/* End PBXProject section */
+/* Begin PBXReferenceProxy section */
+ DA9EA7D61D0EC5C60021F650 /* TableKit.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = TableKit.framework;
+ remoteRef = DA9EA7D51D0EC5C60021F650 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ DA9EA7D81D0EC5C60021F650 /* TableKitTests.xctest */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.cfbundle;
+ path = TableKitTests.xctest;
+ remoteRef = DA9EA7D71D0EC5C60021F650 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
/* Begin PBXResourcesBuildPhase section */
DAB7EB251BEF787300D2AD5E /* Resources */ = {
isa = PBXResourcesBuildPhase;
@@ -223,6 +296,14 @@
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ DA9EA7DC1D0EC65B0021F650 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = TableKit;
+ targetProxy = DA9EA7DB1D0EC65B0021F650 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
DAB7EB371BEF787300D2AD5E /* Debug */ = {
isa = XCBuildConfiguration;
@@ -311,6 +392,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -326,6 +408,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
diff --git a/TableKitDemo/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Demo/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from TableKitDemo/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename to Demo/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..35ee9ed
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,5 @@
+import PackageDescription
+
+let package = Package(
+ name: "TableKit"
+)
\ No newline at end of file
diff --git a/TableKit/ConfigurableCell.swift b/Sources/ConfigurableCell.swift
similarity index 100%
rename from TableKit/ConfigurableCell.swift
rename to Sources/ConfigurableCell.swift
diff --git a/TableKit/HeightStrategy.swift b/Sources/HeightStrategy.swift
similarity index 100%
rename from TableKit/HeightStrategy.swift
rename to Sources/HeightStrategy.swift
diff --git a/TableKit/Operators.swift b/Sources/Operators.swift
similarity index 100%
rename from TableKit/Operators.swift
rename to Sources/Operators.swift
diff --git a/TableKit/TableCellAction.swift b/Sources/TableCellAction.swift
similarity index 100%
rename from TableKit/TableCellAction.swift
rename to Sources/TableCellAction.swift
diff --git a/TableKit/TableDirector.swift b/Sources/TableDirector.swift
similarity index 100%
rename from TableKit/TableDirector.swift
rename to Sources/TableDirector.swift
diff --git a/TableKit/TableRow.swift b/Sources/TableRow.swift
similarity index 100%
rename from TableKit/TableRow.swift
rename to Sources/TableRow.swift
diff --git a/TableKit/TableRowAction.swift b/Sources/TableRowAction.swift
similarity index 100%
rename from TableKit/TableRowAction.swift
rename to Sources/TableRowAction.swift
diff --git a/TableKit/TableRowBuilder.swift b/Sources/TableRowBuilder.swift
similarity index 99%
rename from TableKit/TableRowBuilder.swift
rename to Sources/TableRowBuilder.swift
index dc0aefe..4b37799 100644
--- a/TableKit/TableRowBuilder.swift
+++ b/Sources/TableRowBuilder.swift
@@ -18,6 +18,8 @@
// 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.
+import UIKit
+
public protocol RowBuilder {
func rowItems() -> [Row]?
diff --git a/TableKit/TableSection.swift b/Sources/TableSection.swift
similarity index 100%
rename from TableKit/TableSection.swift
rename to Sources/TableSection.swift
diff --git a/TableKit.podspec b/TableKit.podspec
index cdabc6c..ffb675c 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 = '0.6.0'
+ s.version = '0.7.0'
s.homepage = 'https://github.com/maxsokolov/TableKit'
s.summary = 'Type-safe declarative table views. Swift 2.2 is required.'
@@ -12,6 +12,6 @@ Pod::Spec.new do |s|
s.platforms = { :ios => '8.0' }
s.ios.deployment_target = '8.0'
- s.source_files = 'TableKit/*.swift'
+ s.source_files = 'Sources/*.swift'
s.source = { :git => 'https://github.com/maxsokolov/TableKit.git', :tag => s.version }
end
\ No newline at end of file
diff --git a/TableKit/TableKit.xcodeproj/project.pbxproj b/TableKit.xcodeproj/project.pbxproj
similarity index 56%
rename from TableKit/TableKit.xcodeproj/project.pbxproj
rename to TableKit.xcodeproj/project.pbxproj
index 085b763..a72f71f 100644
--- a/TableKit/TableKit.xcodeproj/project.pbxproj
+++ b/TableKit.xcodeproj/project.pbxproj
@@ -7,31 +7,44 @@
objects = {
/* Begin PBXBuildFile section */
- DA9EA7711D0B68460021F650 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */; };
- DA9EA7721D0B68460021F650 /* HeightStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7691D0B68460021F650 /* HeightStrategy.swift */; };
- DA9EA7731D0B68460021F650 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76A1D0B68460021F650 /* Operators.swift */; };
- DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76B1D0B68460021F650 /* TableDirector.swift */; };
- DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76C1D0B68460021F650 /* TableRow.swift */; };
- DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76D1D0B68460021F650 /* TableRowAction.swift */; };
- DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76F1D0B68460021F650 /* TableSection.swift */; };
- DA9EA7791D0B68460021F650 /* TableCellAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7701D0B68460021F650 /* TableCellAction.swift */; };
- DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA77E1D0B689C0021F650 /* TableKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
- DA9EA7861D0DFAD60021F650 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7851D0DFAD60021F650 /* TableRowBuilder.swift */; };
+ DA9EA7AF1D0EC2C90021F650 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */; };
+ DA9EA7B01D0EC2C90021F650 /* HeightStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A71D0EC2C90021F650 /* HeightStrategy.swift */; };
+ DA9EA7B11D0EC2C90021F650 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A81D0EC2C90021F650 /* Operators.swift */; };
+ DA9EA7B21D0EC2C90021F650 /* TableCellAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */; };
+ DA9EA7B31D0EC2C90021F650 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */; };
+ DA9EA7B41D0EC2C90021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */; };
+ DA9EA7B51D0EC2C90021F650 /* TableRowAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */; };
+ DA9EA7B61D0EC2C90021F650 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AD1D0EC2C90021F650 /* TableRowBuilder.swift */; };
+ DA9EA7B71D0EC2C90021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */; };
+ DA9EA7C91D0EC45F0021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7561D0B679A0021F650 /* TableKit.framework */; };
+ DA9EA7CF1D0EC4930021F650 /* TableKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7BE1D0EC41D0021F650 /* TableKitTests.swift */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ DA9EA7CA1D0EC45F0021F650 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA9EA74D1D0B679A0021F650 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = DA9EA7551D0B679A0021F650;
+ remoteInfo = TableKit;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXFileReference section */
DA9EA7561D0B679A0021F650 /* TableKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TableKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = ""; };
- DA9EA7691D0B68460021F650 /* HeightStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightStrategy.swift; sourceTree = ""; };
- DA9EA76A1D0B68460021F650 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = ""; };
- DA9EA76B1D0B68460021F650 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = ""; };
- DA9EA76C1D0B68460021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = ""; };
- DA9EA76D1D0B68460021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = ""; };
- DA9EA76F1D0B68460021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = ""; };
- DA9EA7701D0B68460021F650 /* TableCellAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellAction.swift; sourceTree = ""; };
- DA9EA77D1D0B689C0021F650 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- DA9EA77E1D0B689C0021F650 /* TableKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableKit.h; sourceTree = ""; };
- DA9EA7851D0DFAD60021F650 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = ""; };
+ DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = ""; };
+ DA9EA7A71D0EC2C90021F650 /* HeightStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightStrategy.swift; sourceTree = ""; };
+ DA9EA7A81D0EC2C90021F650 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = ""; };
+ DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellAction.swift; sourceTree = ""; };
+ DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = ""; };
+ DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = ""; };
+ DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = ""; };
+ DA9EA7AD1D0EC2C90021F650 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = ""; };
+ DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = ""; };
+ DA9EA7B91D0EC34E0021F650 /* TableKit.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TableKit.plist; sourceTree = ""; };
+ DA9EA7BA1D0EC34E0021F650 /* TableKitTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TableKitTests.plist; sourceTree = ""; };
+ DA9EA7BE1D0EC41D0021F650 /* TableKitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableKitTests.swift; sourceTree = ""; };
+ DA9EA7C41D0EC45F0021F650 /* TableKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TableKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -42,15 +55,24 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ DA9EA7C11D0EC45F0021F650 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ DA9EA7C91D0EC45F0021F650 /* TableKit.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
DA9EA74C1D0B679A0021F650 = {
isa = PBXGroup;
children = (
- DA9EA7671D0B68340021F650 /* Classes */,
+ DA9EA7B81D0EC31B0021F650 /* Configs */,
DA9EA7571D0B679A0021F650 /* Products */,
- DA9EA77C1D0B68860021F650 /* Supporting Files */,
+ DA9EA7A51D0EC2B90021F650 /* Sources */,
+ DA9EA7BD1D0EC3D70021F650 /* Tests */,
);
sourceTree = "";
};
@@ -58,33 +80,42 @@
isa = PBXGroup;
children = (
DA9EA7561D0B679A0021F650 /* TableKit.framework */,
+ DA9EA7C41D0EC45F0021F650 /* TableKitTests.xctest */,
);
name = Products;
sourceTree = "";
};
- DA9EA7671D0B68340021F650 /* Classes */ = {
+ DA9EA7A51D0EC2B90021F650 /* Sources */ = {
isa = PBXGroup;
children = (
- DA9EA76B1D0B68460021F650 /* TableDirector.swift */,
- DA9EA76F1D0B68460021F650 /* TableSection.swift */,
- DA9EA76C1D0B68460021F650 /* TableRow.swift */,
- DA9EA7851D0DFAD60021F650 /* TableRowBuilder.swift */,
- DA9EA76D1D0B68460021F650 /* TableRowAction.swift */,
- DA9EA7701D0B68460021F650 /* TableCellAction.swift */,
- DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */,
- DA9EA7691D0B68460021F650 /* HeightStrategy.swift */,
- DA9EA76A1D0B68460021F650 /* Operators.swift */,
+ DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */,
+ DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */,
+ DA9EA7AD1D0EC2C90021F650 /* TableRowBuilder.swift */,
+ DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */,
+ DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */,
+ DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */,
+ DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */,
+ DA9EA7A81D0EC2C90021F650 /* Operators.swift */,
+ DA9EA7A71D0EC2C90021F650 /* HeightStrategy.swift */,
);
- name = Classes;
+ path = Sources;
sourceTree = "";
};
- DA9EA77C1D0B68860021F650 /* Supporting Files */ = {
+ DA9EA7B81D0EC31B0021F650 /* Configs */ = {
isa = PBXGroup;
children = (
- DA9EA77D1D0B689C0021F650 /* Info.plist */,
- DA9EA77E1D0B689C0021F650 /* TableKit.h */,
+ DA9EA7B91D0EC34E0021F650 /* TableKit.plist */,
+ DA9EA7BA1D0EC34E0021F650 /* TableKitTests.plist */,
);
- name = "Supporting Files";
+ path = Configs;
+ sourceTree = "";
+ };
+ DA9EA7BD1D0EC3D70021F650 /* Tests */ = {
+ isa = PBXGroup;
+ children = (
+ DA9EA7BE1D0EC41D0021F650 /* TableKitTests.swift */,
+ );
+ path = Tests;
sourceTree = "";
};
/* End PBXGroup section */
@@ -94,7 +125,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -119,18 +149,40 @@
productReference = DA9EA7561D0B679A0021F650 /* TableKit.framework */;
productType = "com.apple.product-type.framework";
};
+ DA9EA7C31D0EC45F0021F650 /* TableKitTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = DA9EA7CC1D0EC45F0021F650 /* Build configuration list for PBXNativeTarget "TableKitTests" */;
+ buildPhases = (
+ DA9EA7C01D0EC45F0021F650 /* Sources */,
+ DA9EA7C11D0EC45F0021F650 /* Frameworks */,
+ DA9EA7C21D0EC45F0021F650 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ DA9EA7CB1D0EC45F0021F650 /* PBXTargetDependency */,
+ );
+ name = TableKitTests;
+ productName = TableKitTests;
+ productReference = DA9EA7C41D0EC45F0021F650 /* TableKitTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
DA9EA74D1D0B679A0021F650 /* Project object */ = {
isa = PBXProject;
attributes = {
+ LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Max Sokolov";
TargetAttributes = {
DA9EA7551D0B679A0021F650 = {
CreatedOnToolsVersion = 7.3;
};
+ DA9EA7C31D0EC45F0021F650 = {
+ CreatedOnToolsVersion = 7.3;
+ };
};
};
buildConfigurationList = DA9EA7501D0B679A0021F650 /* Build configuration list for PBXProject "TableKit" */;
@@ -146,6 +198,7 @@
projectRoot = "";
targets = (
DA9EA7551D0B679A0021F650 /* TableKit */,
+ DA9EA7C31D0EC45F0021F650 /* TableKitTests */,
);
};
/* End PBXProject section */
@@ -158,6 +211,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ DA9EA7C21D0EC45F0021F650 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -165,20 +225,36 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- DA9EA7711D0B68460021F650 /* ConfigurableCell.swift in Sources */,
- DA9EA7721D0B68460021F650 /* HeightStrategy.swift in Sources */,
- DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */,
- DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */,
- DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */,
- DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */,
- DA9EA7861D0DFAD60021F650 /* TableRowBuilder.swift in Sources */,
- DA9EA7791D0B68460021F650 /* TableCellAction.swift in Sources */,
- DA9EA7731D0B68460021F650 /* Operators.swift in Sources */,
+ DA9EA7AF1D0EC2C90021F650 /* ConfigurableCell.swift in Sources */,
+ DA9EA7B31D0EC2C90021F650 /* TableDirector.swift in Sources */,
+ DA9EA7B71D0EC2C90021F650 /* TableSection.swift in Sources */,
+ DA9EA7B01D0EC2C90021F650 /* HeightStrategy.swift in Sources */,
+ DA9EA7B51D0EC2C90021F650 /* TableRowAction.swift in Sources */,
+ DA9EA7B21D0EC2C90021F650 /* TableCellAction.swift in Sources */,
+ DA9EA7B11D0EC2C90021F650 /* Operators.swift in Sources */,
+ DA9EA7B41D0EC2C90021F650 /* TableRow.swift in Sources */,
+ DA9EA7B61D0EC2C90021F650 /* TableRowBuilder.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ DA9EA7C01D0EC45F0021F650 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ DA9EA7CF1D0EC4930021F650 /* TableKitTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ DA9EA7CB1D0EC45F0021F650 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = DA9EA7551D0B679A0021F650 /* TableKit */;
+ targetProxy = DA9EA7CA1D0EC45F0021F650 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
DA9EA75C1D0B679A0021F650 /* Debug */ = {
isa = XCBuildConfiguration;
@@ -218,7 +294,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -261,7 +337,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -279,7 +355,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
+ INFOPLIST_FILE = "$(SRCROOT)/Configs/TableKit.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -298,7 +374,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
+ INFOPLIST_FILE = "$(SRCROOT)/Configs/TableKit.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -308,6 +384,28 @@
};
name = Release;
};
+ DA9EA7CD1D0EC45F0021F650 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INFOPLIST_FILE = Configs/TableKitTests.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ DA9EA7CE1D0EC45F0021F650 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INFOPLIST_FILE = Configs/TableKitTests.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -329,6 +427,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ DA9EA7CC1D0EC45F0021F650 /* Build configuration list for PBXNativeTarget "TableKitTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ DA9EA7CD1D0EC45F0021F650 /* Debug */,
+ DA9EA7CE1D0EC45F0021F650 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
/* End XCConfigurationList section */
};
rootObject = DA9EA74D1D0B679A0021F650 /* Project object */;
diff --git a/TableKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TableKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/TableKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/TableKit/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme b/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme
similarity index 100%
rename from TableKit/TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme
rename to TableKit.xcodeproj/xcshareddata/xcschemes/TableKit.xcscheme
diff --git a/TableKit.xcworkspace/contents.xcworkspacedata b/TableKit.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 134624f..0000000
--- a/TableKit.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
diff --git a/TableKit/TableKit.h b/TableKit/TableKit.h
deleted file mode 100644
index c63484c..0000000
--- a/TableKit/TableKit.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// TableKit.h
-// TableKit
-//
-// Created by Max Sokolov on 11/06/16.
-// Copyright © 2016 Max Sokolov. All rights reserved.
-//
-
-#import
-
-//! Project version number for TableKit.
-FOUNDATION_EXPORT double TableKitVersionNumber;
-
-//! Project version string for TableKit.
-FOUNDATION_EXPORT const unsigned char TableKitVersionString[];
-
-// In this header, you should import all the public headers of your framework using statements like #import
-
-
diff --git a/Tests/TabletTests.swift b/Tests/TableKitTests.swift
similarity index 99%
rename from Tests/TabletTests.swift
rename to Tests/TableKitTests.swift
index 839fa6f..868e288 100644
--- a/Tests/TabletTests.swift
+++ b/Tests/TableKitTests.swift
@@ -19,7 +19,7 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import XCTest
-import Tablet
+import TableKit
class TestController: UITableViewController {
@@ -45,7 +45,7 @@ struct TestTableViewCellOptions {
static let EstimatedHeight: Float = 255
}
-class TestTableViewCell: UITableViewCell, ConfigurableCell {
+/*class TestTableViewCell: UITableViewCell, ConfigurableCell {
typealias T = TestData
@@ -197,4 +197,4 @@ class TabletTests: XCTestCase {
waitForExpectationsWithTimeout(1.0, handler: nil)
}
-}
\ No newline at end of file
+}*/
\ No newline at end of file
From c8fca159ee11884dc9a1f816aaa52420971f3c92 Mon Sep 17 00:00:00 2001
From: Max Sokolov
Date: Mon, 13 Jun 2016 13:53:12 +0300
Subject: [PATCH 14/14] update readme
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d3a3c15..a691198 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ use_frameworks!
pod 'TableKit'
```
#### Carthage
-Add the line `github "johnsundell/unbox"` to your `Cartfile`
+Add the line `github "maxsokolov/tablekit"` to your `Cartfile`
## Requirements