From 40d138eac1ab786d50919081dbf5349edd323cac Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Thu, 1 Sep 2016 13:11:38 +0300 Subject: [PATCH 1/3] add replace row at index method --- Sources/TableSection.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/TableSection.swift b/Sources/TableSection.swift index 41d34d3..fd74b0b 100644 --- a/Sources/TableSection.swift +++ b/Sources/TableSection.swift @@ -61,7 +61,7 @@ public class TableSection { self.headerView = headerView self.footerView = footerView } - + // MARK: - Public - public func clear() { @@ -83,6 +83,15 @@ public class TableSection { public func insert(rows rows: [Row], at index: Int) { self.rows.insertContentsOf(rows, at: index) } + + public func replace(rowAt index: Int, with row: Row) -> Bool { + + if index > 0 && index < rows.count { + rows[index] = row + return true + } + return false + } public func delete(index index: Int) { rows.removeAtIndex(index) From 90aebed304ae5c59c3138d87bac7968b4c58a509 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Thu, 1 Sep 2016 13:12:25 +0300 Subject: [PATCH 2/3] bump readme and podspec --- README.md | 2 +- TableKit.podspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5e963b..2219125 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Build Status Swift 2.2 compatible Carthage compatible - CocoaPods compatible + CocoaPods compatible Platform iOS License: MIT

diff --git a/TableKit.podspec b/TableKit.podspec index 1233c34..06d3c55 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 = '1.1.1' + s.version = '1.1.2' s.homepage = 'https://github.com/maxsokolov/TableKit' s.summary = 'Type-safe declarative table views. Swift 2.2 is required.' From 52e44dcc6e7e62551d284626066f31cfaba06e73 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Thu, 1 Sep 2016 13:13:57 +0300 Subject: [PATCH 3/3] fix --- Sources/TableSection.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/TableSection.swift b/Sources/TableSection.swift index fd74b0b..02ff134 100644 --- a/Sources/TableSection.swift +++ b/Sources/TableSection.swift @@ -86,7 +86,7 @@ public class TableSection { public func replace(rowAt index: Int, with row: Row) -> Bool { - if index > 0 && index < rows.count { + if index >= 0 && index < rows.count { rows[index] = row return true }