From 1266a9144649a396e273fd2dd91f9f2e48244b56 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Thu, 16 Jun 2016 23:59:25 +0300 Subject: [PATCH] addAction -> action --- .../Presentation/Controllers/MainController.swift | 4 ++-- Demo/Resources/Storyboards/LaunchScreen.storyboard | 2 +- Demo/Resources/Storyboards/Main.storyboard | 12 ++++++------ README.md | 6 ++---- Sources/HeightStrategy.swift | 1 + Sources/TableRow.swift | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Demo/Classes/Presentation/Controllers/MainController.swift b/Demo/Classes/Presentation/Controllers/MainController.swift index 3569741..a9694cb 100644 --- a/Demo/Classes/Presentation/Controllers/MainController.swift +++ b/Demo/Classes/Presentation/Controllers/MainController.swift @@ -37,13 +37,13 @@ class MainController: UIViewController { let row3 = TableRow(item: "3", actions: [a]) row1 - .addAction(TableRowAction(.shouldHighlight) { (data) -> Bool in + .action(TableRowAction(.shouldHighlight) { (data) -> Bool in print("1") return false }) - .addAction(TableRowAction(.click) { (data) in + .action(TableRowAction(.click) { (data) in print("2") }) diff --git a/Demo/Resources/Storyboards/LaunchScreen.storyboard b/Demo/Resources/Storyboards/LaunchScreen.storyboard index 0a546bb..580ceb8 100644 --- a/Demo/Resources/Storyboards/LaunchScreen.storyboard +++ b/Demo/Resources/Storyboards/LaunchScreen.storyboard @@ -1,5 +1,5 @@ - + diff --git a/Demo/Resources/Storyboards/Main.storyboard b/Demo/Resources/Storyboards/Main.storyboard index 4edf1ae..4d18da9 100644 --- a/Demo/Resources/Storyboards/Main.storyboard +++ b/Demo/Resources/Storyboards/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -26,7 +26,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -117,7 +117,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/README.md b/README.md index 71eae3a..439f178 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,10 @@ let row = TableRow(item: "some", actions: [action]) Or, using nice chaining approach: ```swift let row = TableRow(item: "some") - -row - .addAction(TableRowAction(.click) { (data) in + .action(TableRowAction(.click) { (data) in }) - .addAction(TableRowAction(.shouldHighlight) { (data) -> Bool in + .action(TableRowAction(.shouldHighlight) { (data) -> Bool in return false }) ``` diff --git a/Sources/HeightStrategy.swift b/Sources/HeightStrategy.swift index f6a5ad6..c6e7d25 100644 --- a/Sources/HeightStrategy.swift +++ b/Sources/HeightStrategy.swift @@ -33,6 +33,7 @@ public protocol CellHeightCalculatable { public class PrototypeHeightStrategy: CellHeightCalculatable { public weak var tableView: UITableView? + private var prototypes = [String: UITableViewCell]() private var cachedHeights = [Int: CGFloat]() private var separatorHeight = 1 / UIScreen.mainScreen().scale diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index ff33a2e..3dac46b 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -88,7 +88,7 @@ public class TableRow) -> Self { + public func action(action: TableRowAction) -> Self { actions[action.type.key] = action return self