Merge pull request #39 from maxsokolov/develop

Add replace row at index method
This commit is contained in:
Max Sokolov 2016-09-01 14:22:56 +04:00 committed by GitHub
commit 9218051f10
3 changed files with 12 additions and 3 deletions

View File

@ -4,7 +4,7 @@
<a href="https://travis-ci.org/maxsokolov/TableKit"><img src="https://api.travis-ci.org/maxsokolov/TableKit.svg" alt="Build Status" /></a>
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_2.2-compatible-4BC51D.svg?style=flat" alt="Swift 2.2 compatible" /></a>
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-1.1.1-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-1.1.2-blue.svg" alt="CocoaPods compatible" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://raw.githubusercontent.com/maxsokolov/tablekit/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
</p>

View File

@ -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)

View File

@ -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.'