Compare commits
278 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
fec9537745 | |
|
|
246c0d06c0 | |
|
|
54bf141aff | |
|
|
01134b83b4 | |
|
|
3fefa09c3a | |
|
|
4886e43d20 | |
|
|
41826e18db | |
|
|
caec2dd10e | |
|
|
efc03d7c22 | |
|
|
94c40faa63 | |
|
|
d87a23587e | |
|
|
49b3f868f3 | |
|
|
37482d3b69 | |
|
|
2cc161f0c0 | |
|
|
8bf4840d9d | |
|
|
3b266fb7c7 | |
|
|
eb93fe253c | |
|
|
44c55d2f05 | |
|
|
efe99eeb46 | |
|
|
a0658f0b2e | |
|
|
065cd9ace3 | |
|
|
c3652eec6f | |
|
|
01bf1e01e3 | |
|
|
45aee4522d | |
|
|
f39e7ac602 | |
|
|
dc1a924a80 | |
|
|
402757c41f | |
|
|
d6520346c3 | |
|
|
959032a03f | |
|
|
00de0cd809 | |
|
|
337175c507 | |
|
|
a4bacd2c16 | |
|
|
603264a6d1 | |
|
|
1d4fdaad0d | |
|
|
f5ad500ba4 | |
|
|
1b4a988b35 | |
|
|
f8f2ca6852 | |
|
|
ff18a4d8b8 | |
|
|
d098691621 | |
|
|
8b6319d510 | |
|
|
b049864758 | |
|
|
7f349c6944 | |
|
|
a768352b47 | |
|
|
65cf31717b | |
|
|
9d10bc18bf | |
|
|
497b4e009c | |
|
|
6ef5ad504e | |
|
|
e22ec03990 | |
|
|
5982d5db3a | |
|
|
6eaf2cf3a2 | |
|
|
921e2b42b3 | |
|
|
70e6addcd0 | |
|
|
86f07b8e7c | |
|
|
1c92c14a1a | |
|
|
7416271076 | |
|
|
0812293813 | |
|
|
f16a5a29c9 | |
|
|
b379ac6272 | |
|
|
0c87f3ee88 | |
|
|
ce24369557 | |
|
|
85a45c33f2 | |
|
|
92b723b8ca | |
|
|
12883a33de | |
|
|
1d28233ebe | |
|
|
dd8e5d0625 | |
|
|
21aab6256f | |
|
|
cc02531b27 | |
|
|
b62dea8702 | |
|
|
279fdd4854 | |
|
|
02f77ed699 | |
|
|
74af45f3cd | |
|
|
f05511cfba | |
|
|
de5593f6a9 | |
|
|
a1e1e9d908 | |
|
|
70d83fc5b0 | |
|
|
23b51227fd | |
|
|
d8ae329118 | |
|
|
fd50b732c9 | |
|
|
709f739ab6 | |
|
|
9fff8c861c | |
|
|
da76188afd | |
|
|
e3870d5ce8 | |
|
|
a7488b1d4f | |
|
|
4712406618 | |
|
|
d595a5d2df | |
|
|
8463401b94 | |
|
|
05119aae43 | |
|
|
f3c7ea9e43 | |
|
|
ae24e5c7c0 | |
|
|
0c96110ca2 | |
|
|
ad979f4376 | |
|
|
6f849e4cae | |
|
|
293caeebdb | |
|
|
cc69951856 | |
|
|
898191b0fa | |
|
|
bd8ac5a28b | |
|
|
9ef7a7a8bb | |
|
|
ce2874c58d | |
|
|
c9bd52797d | |
|
|
06becd8624 | |
|
|
c277b6529c | |
|
|
39b4df6ee9 | |
|
|
b49b01ff59 | |
|
|
92b3e3b9a7 | |
|
|
1b97d33cf6 | |
|
|
721ba1972a | |
|
|
ef536b71b3 | |
|
|
d12f3549aa | |
|
|
155a4d1cb7 | |
|
|
6b25d54bd8 | |
|
|
9238ab8472 | |
|
|
78b67e4c42 | |
|
|
3821d4300c | |
|
|
065d8ccae3 | |
|
|
d4fc924676 | |
|
|
2b96888d12 | |
|
|
9bbd9c4b69 | |
|
|
44cbb8b7d8 | |
|
|
48a36e0969 | |
|
|
67003df587 | |
|
|
0e1aa0261f | |
|
|
3ba9f45ded | |
|
|
6abdc8ad8d | |
|
|
7132a0a548 | |
|
|
934e7623f9 | |
|
|
e74fee3653 | |
|
|
d5d785218a | |
|
|
443b8aaa62 | |
|
|
0f8d0db84e | |
|
|
f19b637999 | |
|
|
b307b2d809 | |
|
|
ecc90b1db8 | |
|
|
28f6a60d61 | |
|
|
1eed11abbf | |
|
|
162aee0033 | |
|
|
135bc22804 | |
|
|
f794dea7ee | |
|
|
a5d8f0874a | |
|
|
8991138f18 | |
|
|
becdc205bb | |
|
|
c3d6f0af60 | |
|
|
b449e05edc | |
|
|
db6dc40fac | |
|
|
e18c6ef669 | |
|
|
b74403e2c6 | |
|
|
5f6de4703a | |
|
|
c040613654 | |
|
|
0af6956d62 | |
|
|
3da097f1f1 | |
|
|
3de586c4f6 | |
|
|
7f65f0c4e0 | |
|
|
9ae69b71ca | |
|
|
a240acee2d | |
|
|
9e1372252a | |
|
|
5a7a9b9655 | |
|
|
7eca499a59 | |
|
|
8de932b1db | |
|
|
be410f0cc3 | |
|
|
6601b14b7f | |
|
|
da98b9892f | |
|
|
04e62a8bc0 | |
|
|
9ba8ef4932 | |
|
|
24d3540dd5 | |
|
|
6f441b2f7d | |
|
|
38230a9a57 | |
|
|
676d4fdf88 | |
|
|
262d2b83e2 | |
|
|
a88043b33a | |
|
|
5db9726dab | |
|
|
81fbd2f5e5 | |
|
|
0b46f7c52f | |
|
|
67a41b062f | |
|
|
edcbcf60b7 | |
|
|
6e2b707df7 | |
|
|
a25e4c0eb4 | |
|
|
bfc59a0670 | |
|
|
3751eec584 | |
|
|
0916b5f990 | |
|
|
24a7f0589f | |
|
|
3f88b6d0aa | |
|
|
6c73ef4860 | |
|
|
c09e06f67d | |
|
|
6a1650a68b | |
|
|
eebaaf5268 | |
|
|
29202d4405 | |
|
|
0f93d296ed | |
|
|
1be65d18ad | |
|
|
70d6cb8d73 | |
|
|
aeae61d48b | |
|
|
1df6447d73 | |
|
|
9218051f10 | |
|
|
52e44dcc6e | |
|
|
90aebed304 | |
|
|
40d138eac1 | |
|
|
7a310f6db2 | |
|
|
9a50eba12e | |
|
|
ddced231c3 | |
|
|
155524f13c | |
|
|
39eda5a8f3 | |
|
|
85cf81ecd6 | |
|
|
99fc12e723 | |
|
|
60003d7557 | |
|
|
5e5643c342 | |
|
|
a7530eb3c7 | |
|
|
1ae302f7ab | |
|
|
f132560f39 | |
|
|
a0113c23e0 | |
|
|
520f1f91f0 | |
|
|
d3773efbcc | |
|
|
4dd21a7d2e | |
|
|
a9a2496831 | |
|
|
7a732cb7c3 | |
|
|
d42757fb68 | |
|
|
a9c5d997cb | |
|
|
b8084efc08 | |
|
|
ab6e88ad65 | |
|
|
0c527fd47f | |
|
|
7438856134 | |
|
|
cf37c2b5eb | |
|
|
f90db7de16 | |
|
|
0186da5452 | |
|
|
09d5d75cef | |
|
|
8477cea35b | |
|
|
aaafb0d28d | |
|
|
4b4d2a616d | |
|
|
b7398a2986 | |
|
|
762fd7546b | |
|
|
a5ff6c520b | |
|
|
d3ccd86577 | |
|
|
f23901d4a1 | |
|
|
663111500f | |
|
|
26192a89b8 | |
|
|
2e8b3f3232 | |
|
|
da51e2b7e9 | |
|
|
e23892e33e | |
|
|
40653d7a18 | |
|
|
2d9bb07795 | |
|
|
c5c180594e | |
|
|
0bf04ebae8 | |
|
|
5dde1c8d70 | |
|
|
9fbe7c9383 | |
|
|
080b3f0458 | |
|
|
126720f388 | |
|
|
acebd1c3e8 | |
|
|
ffac9fae14 | |
|
|
c31aa997fa | |
|
|
8de38d8dee | |
|
|
740768fdfd | |
|
|
1539f39e54 | |
|
|
1137b47af1 | |
|
|
b68bd46ca8 | |
|
|
89e3113a35 | |
|
|
f74d35cc8c | |
|
|
7e3d52fb92 | |
|
|
dd6092f87f | |
|
|
221efc00ab | |
|
|
23cceddfe2 | |
|
|
1bc7301c7e | |
|
|
86b93ae78d | |
|
|
1266a91446 | |
|
|
d4efb6a679 | |
|
|
0d7d97db57 | |
|
|
018c35ef53 | |
|
|
03b67c5178 | |
|
|
09e5c4b8a4 | |
|
|
23378e2de4 | |
|
|
dd78ffa41e | |
|
|
1bd049e276 | |
|
|
d01c6c7fba | |
|
|
a2f8bdde30 | |
|
|
98c481be71 | |
|
|
9d0c278a34 | |
|
|
fadb2f4e60 | |
|
|
cc75e84f58 | |
|
|
7cc572c7aa | |
|
|
3e4f7d81ff | |
|
|
1ed3db1cb1 | |
|
|
8b5ad2fcd1 |
|
|
@ -0,0 +1 @@
|
||||||
|
5.7
|
||||||
29
.travis.yml
29
.travis.yml
|
|
@ -1,11 +1,24 @@
|
||||||
language: objective-c
|
language: objective-c
|
||||||
osx_image: xcode7.3
|
osx_image: xcode11
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
before_install:
|
env:
|
||||||
- brew update
|
global:
|
||||||
- brew reinstall --HEAD xctool
|
- LC_CTYPE=en_US.UTF-8
|
||||||
- cd Tablet
|
- LANG=en_US.UTF-8
|
||||||
|
- IOS_SDK=iphonesimulator13.0
|
||||||
|
- SCHEME_IOS="TableKit"
|
||||||
|
- PROJECT_FRAMEWORK="TableKit.xcodeproj"
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
- DESTINATION="OS=10.3.1,name=iPhone 5" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
|
||||||
|
- DESTINATION="OS=11.1,name=iPhone 6" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
|
||||||
|
- DESTINATION="OS=12.0,name=iPhone 7 Plus" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
|
||||||
|
- DESTINATION="OS=13.0,name=iPhone 11" SCHEME="$SCHEME_IOS" SDK="$IOS_SDK"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- xctool clean build test -project TableKit.xcodeproj -scheme TableKit -sdk iphonesimulator
|
- set -o pipefail
|
||||||
|
- xcodebuild -version
|
||||||
|
- xcodebuild -showsdks
|
||||||
|
- xcodebuild -project "$PROJECT_FRAMEWORK" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO test
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [2.10.0](https://github.com/maxsokolov/TableKit/releases/tag/2.10.0)
|
||||||
|
Released on 2019-09-29.
|
||||||
|
- Swift 5.1 support.
|
||||||
|
|
||||||
|
## [2.9.0](https://github.com/maxsokolov/TableKit/releases/tag/2.9.0)
|
||||||
|
Released on 2019-04-04.
|
||||||
|
- Swift 5.0 support.
|
||||||
|
|
||||||
|
## [2.8.0](https://github.com/maxsokolov/TableKit/releases/tag/2.8.0)
|
||||||
|
Released on 2018-09-30.
|
||||||
|
- Swift 4.2 support.
|
||||||
|
|
||||||
|
## [2.5.0](https://github.com/maxsokolov/TableKit/releases/tag/2.5.0)
|
||||||
|
Released on 2017-09-24.
|
||||||
|
- Swift 4.0 support.
|
||||||
|
|
||||||
|
## [2.3.0](https://github.com/maxsokolov/TableKit/releases/tag/2.3.0)
|
||||||
|
Released on 2016-11-16.
|
||||||
|
- `shouldUsePrototypeCellHeightCalculation` moved to `TableDirector(tableView: tableView, shouldUsePrototypeCellHeightCalculation: true)`
|
||||||
|
- Prototype cell height calculation bugfixes
|
||||||
|
|
||||||
|
## [2.1.0](https://github.com/maxsokolov/TableKit/releases/tag/2.1.0)
|
||||||
|
Released on 2016-10-19.
|
||||||
|
- `action` method was deprecated on TableRow. Use `on` instead.
|
||||||
|
- Support multiple actions with same type on row.
|
||||||
|
- You could now build your own cell height calculating strategy. See [TablePrototypeCellHeightCalculator](Sources/TablePrototypeCellHeightCalculator.swift).
|
||||||
|
- Default distance between sections changed to `UITableViewAutomaticDimension`. You can customize it, see [TableSection](Sources/TableSection.swift)
|
||||||
|
|
||||||
|
## [2.0.0](https://github.com/maxsokolov/TableKit/releases/tag/2.0.0)
|
||||||
|
Released on 2016-10-06. Breaking changes in 2.0.0:
|
||||||
|
<br/>The signatures of `TableRow` and `TableRowAction` classes were changed from
|
||||||
|
```swift
|
||||||
|
let action = TableRowAction<String, StringTableViewCell>(.click) { (data) in
|
||||||
|
}
|
||||||
|
|
||||||
|
let row = TableRow<String, StringTableViewCell>(item: "some string", actions: [action])
|
||||||
|
```
|
||||||
|
to
|
||||||
|
```swift
|
||||||
|
let action = TableRowAction<StringTableViewCell>(.click) { (data) in
|
||||||
|
}
|
||||||
|
|
||||||
|
let row = TableRow<StringTableViewCell>(item: "some string", actions: [action])
|
||||||
|
```
|
||||||
|
This is the great improvement that comes from the community. Thanks a lot!
|
||||||
|
|
||||||
|
## [1.3.0](https://github.com/maxsokolov/TableKit/releases/tag/1.3.0)
|
||||||
|
Released on 2016-09-04. Swift 3.0 support.
|
||||||
|
|
||||||
|
## [0.1.0](https://github.com/maxsokolov/TableKit/releases/tag/0.1.0)
|
||||||
|
Released on 2015-11-15. Initial release called Tablet.
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
//
|
|
||||||
// AppDelegate.swift
|
|
||||||
// TabletDemo
|
|
||||||
//
|
|
||||||
// Created by Max Sokolov on 08/11/15.
|
|
||||||
// Copyright © 2015 Tablet. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
import UIKit
|
||||||
|
import TableKit
|
||||||
|
|
||||||
|
class AutolayoutCellsController: UIViewController {
|
||||||
|
|
||||||
|
@IBOutlet weak var tableView: UITableView! {
|
||||||
|
didSet {
|
||||||
|
tableDirector = TableDirector(tableView: tableView, shouldUsePrototypeCellHeightCalculation: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var tableDirector: TableDirector!
|
||||||
|
|
||||||
|
func randomString(length: Int) -> String {
|
||||||
|
|
||||||
|
let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
|
let len = UInt32(letters.length)
|
||||||
|
|
||||||
|
var randomString = ""
|
||||||
|
|
||||||
|
for _ in 0 ..< length {
|
||||||
|
let rand = arc4random_uniform(len)
|
||||||
|
var nextChar = letters.character(at: Int(rand))
|
||||||
|
randomString += NSString(characters: &nextChar, length: 1) as String
|
||||||
|
}
|
||||||
|
|
||||||
|
return randomString
|
||||||
|
}
|
||||||
|
|
||||||
|
func randomInt(min: Int, max:Int) -> Int {
|
||||||
|
return min + Int(arc4random_uniform(UInt32(max - min + 1)))
|
||||||
|
}
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
title = "Autolayout cells"
|
||||||
|
|
||||||
|
let header = AutolayoutSectionHeaderView.loadFromNib()
|
||||||
|
let section = TableSection(headerView: header, footerView: nil)
|
||||||
|
section.headerHeight = getViewHeight(view: header, width: UIScreen.main.bounds.width)
|
||||||
|
|
||||||
|
var rows = 0
|
||||||
|
while rows <= 20 {
|
||||||
|
rows += 1
|
||||||
|
|
||||||
|
let row = TableRow<AutolayoutTableViewCell>(item: randomString(length: randomInt(min: 20, max: 100)))
|
||||||
|
section += row
|
||||||
|
}
|
||||||
|
|
||||||
|
tableDirector += section
|
||||||
|
|
||||||
|
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Clear", style: .done, target: self, action: #selector(clear))
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
func clear() {
|
||||||
|
|
||||||
|
tableDirector.clear()
|
||||||
|
tableDirector.reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getViewHeight(view: UIView, width: CGFloat) -> CGFloat {
|
||||||
|
|
||||||
|
view.frame = CGRect(x: 0, y: 0, width: width, height: view.frame.size.height)
|
||||||
|
view.setNeedsLayout()
|
||||||
|
view.layoutIfNeeded()
|
||||||
|
|
||||||
|
return view.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
//
|
|
||||||
// HeaderFooterController.swift
|
|
||||||
// TabletDemo
|
|
||||||
//
|
|
||||||
// Created by Max Sokolov on 16/04/16.
|
|
||||||
// Copyright © 2016 Tablet. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import TableKit
|
|
||||||
|
|
||||||
class HeaderFooterController: UIViewController {
|
|
||||||
|
|
||||||
@IBOutlet weak var tableView: UITableView! {
|
|
||||||
didSet {
|
|
||||||
tableDirector = TableDirector(tableView: tableView)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var tableDirector: TableDirector!
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
//let rows = TableRowBuilder<String, StoryboardTableViewCell>(items: ["3", "4", "5"])
|
|
||||||
|
|
||||||
//let headerView = UIView(frame: CGRectMake(0, 0, 100, 100))
|
|
||||||
//headerView.backgroundColor = UIColor.lightGrayColor()
|
|
||||||
|
|
||||||
//let section = TableSectionBuilder(headerView: headerView, footerView: nil, rows: [rows])
|
|
||||||
|
|
||||||
//tableDirector += section
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
//
|
|
||||||
// MainController.swift
|
|
||||||
// TabletDemo
|
|
||||||
//
|
|
||||||
// Created by Max Sokolov on 16/04/16.
|
|
||||||
// Copyright © 2016 Tablet. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import TableKit
|
import TableKit
|
||||||
|
|
||||||
|
|
@ -21,79 +13,32 @@ class MainController: UIViewController {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
title = "TableKit"
|
||||||
|
|
||||||
let a = TableRowAction<String, StoryboardImageTableViewCell>(.click) {
|
let clickAction = TableRowAction<ConfigurableTableViewCell>(.click) { [weak self] (options) in
|
||||||
(data) in
|
|
||||||
|
|
||||||
print("3", data.item)
|
switch options.indexPath.row {
|
||||||
|
case 0:
|
||||||
|
self?.performSegue(withIdentifier: "autolayoutcells", sender: nil)
|
||||||
|
case 1:
|
||||||
|
self?.performSegue(withIdentifier: "nibcells", sender: nil)
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let printClickAction = TableRowAction<ConfigurableTableViewCell>(.click) { (options) in
|
||||||
|
|
||||||
let b = TableRowBuilder<String, StoryboardImageTableViewCell>(items: ["1", "2", "3"], actions: [a])
|
print("click", options.indexPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
let rows = [
|
||||||
|
|
||||||
let row1 = TableRow<String, StoryboardImageTableViewCell>(item: "1")
|
TableRow<ConfigurableTableViewCell>(item: "Autolayout cells", actions: [clickAction, printClickAction]),
|
||||||
let row2 = TableRow<String, StoryboardImageTableViewCell>(item: "2")
|
TableRow<ConfigurableTableViewCell>(item: "Nib cells", actions: [clickAction, printClickAction])
|
||||||
let row3 = TableRow<String, StoryboardImageTableViewCell>(item: "3", actions: [a])
|
]
|
||||||
|
|
||||||
|
// automatically creates a section, also could be used like tableDirector.append(rows: rows)
|
||||||
|
tableDirector += rows
|
||||||
row1
|
|
||||||
.addAction(TableRowAction(.shouldHighlight) { (data) -> Bool in
|
|
||||||
|
|
||||||
print("1")
|
|
||||||
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
.addAction(TableRowAction(.click) { (data) in
|
|
||||||
|
|
||||||
print("2")
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
let section = TableSection()
|
|
||||||
section.append(builder: b)
|
|
||||||
|
|
||||||
//let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3])
|
|
||||||
|
|
||||||
tableDirector += [section]
|
|
||||||
|
|
||||||
//tableDirector.append(section: section)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*rowBuilder
|
|
||||||
.addAction(TableRowAction(type: .Click) { (data) in
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
rowBuilder
|
|
||||||
.delete(indexes: [0], animated: .None)
|
|
||||||
.insert(["2"], atIndex: 0, animated: .None)
|
|
||||||
.update(index: 0, item: "", animated: .None)
|
|
||||||
.move([1, 2], toIndexes: [3, 4])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//tableView.moveRowAtIndexPath(<#T##indexPath: NSIndexPath##NSIndexPath#>, toIndexPath: <#T##NSIndexPath#>)
|
|
||||||
//tableView.deleteRowsAtIndexPaths(<#T##indexPaths: [NSIndexPath]##[NSIndexPath]#>, withRowAnimation: <#T##UITableViewRowAnimation#>)
|
|
||||||
//tableView.insertRowsAtIndexPaths(<#T##indexPaths: [NSIndexPath]##[NSIndexPath]#>, withRowAnimation: <#T##UITableViewRowAnimation#>)
|
|
||||||
//tableView.reloadRowsAtIndexPaths(<#T##indexPaths: [NSIndexPath]##[NSIndexPath]#>, withRowAnimation: <#T##UITableViewRowAnimation#>)
|
|
||||||
|
|
||||||
//tableView.moveSection(0, toSection: 0)
|
|
||||||
//tableView.reloadSections([], withRowAnimation: .None)
|
|
||||||
//tableView.deleteSections([], withRowAnimation: .None)
|
|
||||||
//tableView.insertSections([], withRowAnimation: .None)
|
|
||||||
|
|
||||||
//tableDirector.performBatchUpdates {
|
|
||||||
//}*/
|
|
||||||
|
|
||||||
//tableDirector.append(section: section)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import UIKit
|
||||||
|
import TableKit
|
||||||
|
|
||||||
|
class NibCellsController: UITableViewController {
|
||||||
|
|
||||||
|
var tableDirector: TableDirector!
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
title = "Nib cells"
|
||||||
|
|
||||||
|
tableDirector = TableDirector(tableView: tableView)
|
||||||
|
|
||||||
|
let numbers = [1000, 2000, 3000, 4000, 5000]
|
||||||
|
|
||||||
|
let rows = numbers.map {
|
||||||
|
TableRow<NibTableViewCell>(item: $0)
|
||||||
|
.on(.shouldHighlight) { (_) -> Bool in
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tableDirector.append(rows: rows)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
final class AutolayoutSectionHeaderView: UIView {
|
||||||
|
|
||||||
|
@IBOutlet weak var testLabel: UILabel!
|
||||||
|
|
||||||
|
override func awakeFromNib() {
|
||||||
|
super.awakeFromNib()
|
||||||
|
|
||||||
|
testLabel.text = "My super super super super super super super super super super super super super super super super super super super long text!"
|
||||||
|
}
|
||||||
|
|
||||||
|
static func loadFromNib() -> AutolayoutSectionHeaderView {
|
||||||
|
|
||||||
|
let view = Bundle(for: self)
|
||||||
|
.loadNibNamed(
|
||||||
|
String(describing: self),
|
||||||
|
owner: nil,
|
||||||
|
options: nil
|
||||||
|
)?.first
|
||||||
|
|
||||||
|
return view as! AutolayoutSectionHeaderView
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||||
|
<device id="retina4_7" orientation="portrait">
|
||||||
|
<adaptation id="fullscreen"/>
|
||||||
|
</device>
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<objects>
|
||||||
|
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||||
|
<view contentMode="scaleToFill" id="rrg-Sy-26U" customClass="AutolayoutSectionHeaderView" customModule="TableKitDemo" customModuleProvider="target">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="267" height="68"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7al-ia-5Ud">
|
||||||
|
<rect key="frame" x="20" y="24" width="227" height="21"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
</subviews>
|
||||||
|
<color key="backgroundColor" red="1" green="0.67241452084558406" blue="0.62083349393841014" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="bottom" secondItem="7al-ia-5Ud" secondAttribute="bottom" constant="23" id="0Wx-eb-Gf8"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="7al-ia-5Ud" secondAttribute="trailing" constant="20" id="5lG-XV-dd4"/>
|
||||||
|
<constraint firstItem="7al-ia-5Ud" firstAttribute="top" secondItem="rrg-Sy-26U" secondAttribute="top" constant="24" id="VBP-29-bA8"/>
|
||||||
|
<constraint firstItem="7al-ia-5Ud" firstAttribute="leading" secondItem="rrg-Sy-26U" secondAttribute="leading" constant="20" id="cAb-gb-fpr"/>
|
||||||
|
</constraints>
|
||||||
|
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="testLabel" destination="7al-ia-5Ud" id="sd9-v6-m3z"/>
|
||||||
|
</connections>
|
||||||
|
<point key="canvasLocation" x="-188.5" y="-277"/>
|
||||||
|
</view>
|
||||||
|
</objects>
|
||||||
|
</document>
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
import UIKit
|
||||||
|
import TableKit
|
||||||
|
|
||||||
|
private let LoremIpsumTitle = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"
|
||||||
|
|
||||||
|
class AutolayoutTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
|
typealias T = String
|
||||||
|
|
||||||
|
@IBOutlet var titleLabel: UILabel!
|
||||||
|
@IBOutlet var subtitleLabel: UILabel!
|
||||||
|
|
||||||
|
static var estimatedHeight: CGFloat? {
|
||||||
|
return 150
|
||||||
|
}
|
||||||
|
|
||||||
|
func configure(with string: T) {
|
||||||
|
|
||||||
|
titleLabel.text = LoremIpsumTitle
|
||||||
|
subtitleLabel.text = string
|
||||||
|
}
|
||||||
|
|
||||||
|
override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
|
||||||
|
contentView.layoutIfNeeded()
|
||||||
|
|
||||||
|
titleLabel.preferredMaxLayoutWidth = titleLabel.bounds.size.width
|
||||||
|
subtitleLabel.preferredMaxLayoutWidth = subtitleLabel.bounds.size.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import UIKit
|
||||||
|
import TableKit
|
||||||
|
|
||||||
|
class ConfigurableTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
|
func configure(with text: String) {
|
||||||
|
|
||||||
|
accessoryType = .disclosureIndicator
|
||||||
|
textLabel?.text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import UIKit
|
||||||
|
import TableKit
|
||||||
|
|
||||||
|
class NibTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
|
@IBOutlet weak var titleLabel: UILabel!
|
||||||
|
|
||||||
|
static var defaultHeight: CGFloat? {
|
||||||
|
return 100
|
||||||
|
}
|
||||||
|
|
||||||
|
func configure(with number: Int) {
|
||||||
|
titleLabel.text = "\(number)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
|
</dependencies>
|
||||||
|
<objects>
|
||||||
|
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||||
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="NibTableViewCell" id="4JI-V9-Bra" customClass="NibTableViewCell" customModule="TableKitDemo" customModuleProvider="target">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4JI-V9-Bra" id="Bal-V1-EZ2">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<subviews>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBe-iP-Q1p">
|
||||||
|
<rect key="frame" x="8" y="11" width="304" height="21"/>
|
||||||
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||||
|
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
</subviews>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="qBe-iP-Q1p" firstAttribute="top" secondItem="Bal-V1-EZ2" secondAttribute="top" constant="11" id="B84-GR-YoJ"/>
|
||||||
|
<constraint firstAttribute="bottom" secondItem="qBe-iP-Q1p" secondAttribute="bottom" constant="12" id="Cmh-Tj-2Pw"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="qBe-iP-Q1p" secondAttribute="trailing" constant="8" id="ZJP-9s-4ZM"/>
|
||||||
|
<constraint firstItem="qBe-iP-Q1p" firstAttribute="leading" secondItem="Bal-V1-EZ2" secondAttribute="leading" constant="8" id="wAW-KV-dCJ"/>
|
||||||
|
</constraints>
|
||||||
|
</tableViewCellContentView>
|
||||||
|
<connections>
|
||||||
|
<outlet property="titleLabel" destination="qBe-iP-Q1p" id="UO4-lc-Kr0"/>
|
||||||
|
</connections>
|
||||||
|
<point key="canvasLocation" x="524" y="319"/>
|
||||||
|
</tableViewCell>
|
||||||
|
</objects>
|
||||||
|
</document>
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
//
|
|
||||||
// StoryboardImageTableViewCell.swift
|
|
||||||
// TabletDemo
|
|
||||||
//
|
|
||||||
// Created by Max Sokolov on 24/05/16.
|
|
||||||
// Copyright © 2016 Tablet. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import TableKit
|
|
||||||
|
|
||||||
class StoryboardImageTableViewCell: UITableViewCell, ConfigurableCell {
|
|
||||||
|
|
||||||
typealias T = String
|
|
||||||
|
|
||||||
@IBOutlet var titleLabel: UILabel!
|
|
||||||
@IBOutlet var subtitleLabel: UILabel!
|
|
||||||
@IBOutlet var customImageView: UIImageView!
|
|
||||||
|
|
||||||
func configure(string: T) {
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
//
|
|
||||||
// StoryboardTableViewCell.swift
|
|
||||||
// TabletDemo
|
|
||||||
//
|
|
||||||
// Created by Max Sokolov on 16/04/16.
|
|
||||||
// Copyright © 2016 Tablet. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import TableKit
|
|
||||||
|
|
||||||
class StoryboardTableViewCell: UITableViewCell, ConfigurableCell {
|
|
||||||
|
|
||||||
typealias T = String
|
|
||||||
|
|
||||||
func configure(value: T) {
|
|
||||||
textLabel?.text = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="dOU-ON-YYD">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="dOU-ON-YYD">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
|
|
@ -16,17 +16,17 @@
|
||||||
</navigationBar>
|
</navigationBar>
|
||||||
<nil name="viewControllers"/>
|
<nil name="viewControllers"/>
|
||||||
<connections>
|
<connections>
|
||||||
<segue destination="grv-aL-Qbb" kind="relationship" relationship="rootViewController" id="0SZ-hs-iUi"/>
|
<segue destination="hPs-tQ-ZjY" kind="relationship" relationship="rootViewController" id="cVN-5m-Nvf"/>
|
||||||
</connections>
|
</connections>
|
||||||
</navigationController>
|
</navigationController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="1px-T5-UXL" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="1px-T5-UXL" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="334" y="287"/>
|
<point key="canvasLocation" x="334" y="287"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Main Controller-->
|
<!--Autolayout Cells Controller-->
|
||||||
<scene sceneID="bgC-Xq-OSw">
|
<scene sceneID="bgC-Xq-OSw">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="grv-aL-Qbb" customClass="MainController" customModule="TabletDemo" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController id="grv-aL-Qbb" customClass="AutolayoutCellsController" customModule="TableKitDemo" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<layoutGuides>
|
<layoutGuides>
|
||||||
<viewControllerLayoutGuide type="top" id="COn-EH-LKP"/>
|
<viewControllerLayoutGuide type="top" id="COn-EH-LKP"/>
|
||||||
<viewControllerLayoutGuide type="bottom" id="iga-ib-rj1"/>
|
<viewControllerLayoutGuide type="bottom" id="iga-ib-rj1"/>
|
||||||
|
|
@ -39,17 +39,17 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<prototypes>
|
<prototypes>
|
||||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="StoryboardImageTableViewCell" rowHeight="141" id="IBY-tW-SgU" customClass="StoryboardImageTableViewCell" customModule="TabletDemo" customModuleProvider="target">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="AutolayoutTableViewCell" rowHeight="141" id="IBY-tW-SgU" customClass="AutolayoutTableViewCell" customModule="TableKitDemo" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="92" width="600" height="141"/>
|
<rect key="frame" x="0.0" y="92" width="600" height="141"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="IBY-tW-SgU" id="UNZ-nz-200">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="IBY-tW-SgU" id="UNZ-nz-200">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="140"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="141"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="751" verticalHuggingPriority="751" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" placeholderIntrinsicWidth="172" placeholderIntrinsicHeight="21" text="Title" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YnK-4H-0SS">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="751" verticalHuggingPriority="751" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" placeholderIntrinsicWidth="172" placeholderIntrinsicHeight="21" text="Title" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YnK-4H-0SS">
|
||||||
<rect key="frame" x="128" y="20" width="452" height="21"/>
|
<rect key="frame" x="128" y="20" width="452" height="21"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="750" verticalHuggingPriority="750" placeholderIntrinsicWidth="172" placeholderIntrinsicHeight="18" text="Subtitle" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oPO-9F-UcX">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="750" verticalHuggingPriority="750" placeholderIntrinsicWidth="172" placeholderIntrinsicHeight="18" text="Subtitle" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oPO-9F-UcX">
|
||||||
|
|
@ -60,10 +60,16 @@
|
||||||
</label>
|
</label>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="il6-0T-Sfb">
|
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="il6-0T-Sfb">
|
||||||
<rect key="frame" x="20" y="20" width="100" height="100"/>
|
<rect key="frame" x="20" y="20" width="100" height="100"/>
|
||||||
|
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" priority="999" constant="100" id="Ryh-cg-Q69"/>
|
<constraint firstAttribute="width" priority="999" constant="100" id="Ryh-cg-Q69"/>
|
||||||
<constraint firstAttribute="height" priority="999" constant="100" id="cjb-Sw-psw"/>
|
<constraint firstAttribute="height" priority="999" constant="100" id="cjb-Sw-psw"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
<userDefinedRuntimeAttributes>
|
||||||
|
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||||
|
<integer key="value" value="4"/>
|
||||||
|
</userDefinedRuntimeAttribute>
|
||||||
|
</userDefinedRuntimeAttributes>
|
||||||
</imageView>
|
</imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
@ -80,19 +86,10 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="customImageView" destination="il6-0T-Sfb" id="Ufi-6Y-Vuf"/>
|
|
||||||
<outlet property="subtitleLabel" destination="oPO-9F-UcX" id="RIK-1t-nVt"/>
|
<outlet property="subtitleLabel" destination="oPO-9F-UcX" id="RIK-1t-nVt"/>
|
||||||
<outlet property="titleLabel" destination="YnK-4H-0SS" id="ilA-7H-pq7"/>
|
<outlet property="titleLabel" destination="YnK-4H-0SS" id="ilA-7H-pq7"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="StoryboardTableViewCell" id="nE5-Y5-OFf" customClass="StoryboardTableViewCell" customModule="TabletDemo" customModuleProvider="target">
|
|
||||||
<rect key="frame" x="0.0" y="233" width="600" height="44"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="nE5-Y5-OFf" id="3yF-sl-yNq">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
</tableViewCellContentView>
|
|
||||||
</tableViewCell>
|
|
||||||
</prototypes>
|
</prototypes>
|
||||||
</tableView>
|
</tableView>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
|
@ -107,56 +104,65 @@
|
||||||
<navigationItem key="navigationItem" id="HPV-jJ-NPc"/>
|
<navigationItem key="navigationItem" id="HPV-jJ-NPc"/>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="tableView" destination="o67-xJ-fPW" id="A8B-MV-tNa"/>
|
<outlet property="tableView" destination="o67-xJ-fPW" id="A8B-MV-tNa"/>
|
||||||
<segue destination="sSs-TX-Ch0" kind="show" identifier="headerfooter" id="Nbk-od-yC5"/>
|
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="xij-Hw-J33" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="xij-Hw-J33" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1042" y="287"/>
|
<point key="canvasLocation" x="1762" y="-59"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Header Footer Controller-->
|
<!--Main Controller-->
|
||||||
<scene sceneID="Jd0-of-RF9">
|
<scene sceneID="rB2-pg-ya1">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="sSs-TX-Ch0" customClass="HeaderFooterController" customModule="TabletDemo" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController id="hPs-tQ-ZjY" customClass="MainController" customModule="TableKitDemo" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<layoutGuides>
|
<layoutGuides>
|
||||||
<viewControllerLayoutGuide type="top" id="s9s-Gu-3M6"/>
|
<viewControllerLayoutGuide type="top" id="bj8-sc-pHV"/>
|
||||||
<viewControllerLayoutGuide type="bottom" id="Tux-up-dnH"/>
|
<viewControllerLayoutGuide type="bottom" id="exD-V1-XKl"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="CB5-10-J2D">
|
<view key="view" contentMode="scaleToFill" id="w1B-sD-vvx">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="uLr-Ff-utK">
|
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="lVS-GW-taC">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<prototypes>
|
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="StoryboardTableViewCell" id="lqW-2N-6mf" customClass="StoryboardTableViewCell" customModule="TabletDemo" customModuleProvider="target">
|
|
||||||
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lqW-2N-6mf" id="tjN-ow-437">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
</tableViewCellContentView>
|
|
||||||
</tableViewCell>
|
|
||||||
</prototypes>
|
|
||||||
</tableView>
|
</tableView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="Tux-up-dnH" firstAttribute="top" secondItem="uLr-Ff-utK" secondAttribute="bottom" id="0jr-6S-PFB"/>
|
<constraint firstItem="lVS-GW-taC" firstAttribute="leading" secondItem="w1B-sD-vvx" secondAttribute="leading" id="BML-us-tKv"/>
|
||||||
<constraint firstItem="uLr-Ff-utK" firstAttribute="top" secondItem="CB5-10-J2D" secondAttribute="top" id="KYu-01-hlH"/>
|
<constraint firstItem="lVS-GW-taC" firstAttribute="top" secondItem="w1B-sD-vvx" secondAttribute="top" id="KmO-4D-EEl"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="uLr-Ff-utK" secondAttribute="trailing" id="TKR-R1-lBY"/>
|
<constraint firstItem="exD-V1-XKl" firstAttribute="top" secondItem="lVS-GW-taC" secondAttribute="bottom" id="plx-uF-bQd"/>
|
||||||
<constraint firstItem="uLr-Ff-utK" firstAttribute="leading" secondItem="CB5-10-J2D" secondAttribute="leading" id="aG6-R3-QUr"/>
|
<constraint firstAttribute="trailing" secondItem="lVS-GW-taC" secondAttribute="trailing" id="uYe-yd-m86"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<navigationItem key="navigationItem" id="ogA-Id-clb"/>
|
<navigationItem key="navigationItem" id="i9y-B7-dhJ"/>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="tableView" destination="uLr-Ff-utK" id="olP-LV-VmT"/>
|
<outlet property="tableView" destination="lVS-GW-taC" id="C28-ml-ARU"/>
|
||||||
|
<segue destination="grv-aL-Qbb" kind="show" identifier="autolayoutcells" id="YrM-qz-6Kd"/>
|
||||||
|
<segue destination="apk-bL-6NO" kind="show" identifier="nibcells" id="gXD-XZ-oBm"/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Gim-O8-I3d" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="i96-Zo-Wfg" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1763" y="287"/>
|
<point key="canvasLocation" x="1046" y="287"/>
|
||||||
|
</scene>
|
||||||
|
<!--Nib Cells Controller-->
|
||||||
|
<scene sceneID="DHa-3S-OkR">
|
||||||
|
<objects>
|
||||||
|
<tableViewController id="apk-bL-6NO" customClass="NibCellsController" customModule="TableKitDemo" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="wDt-Cb-VB2">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="dataSource" destination="apk-bL-6NO" id="Xhe-U9-wKI"/>
|
||||||
|
<outlet property="delegate" destination="apk-bL-6NO" id="NqC-Vg-68j"/>
|
||||||
|
</connections>
|
||||||
|
</tableView>
|
||||||
|
</tableViewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="oWG-DK-A9C" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="1762" y="671"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,14 @@
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
DA08A0531CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */; };
|
5079ADE31FE1BF1B000CC345 /* AutolayoutSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5079ADE21FE1BF1B000CC345 /* AutolayoutSectionHeaderView.swift */; };
|
||||||
|
5079ADE61FE1BF65000CC345 /* AutolayoutSectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5079ADE51FE1BF65000CC345 /* AutolayoutSectionHeaderView.xib */; };
|
||||||
|
DA08A0531CF4E9B500BBF1F8 /* AutolayoutTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA08A0521CF4E9B500BBF1F8 /* AutolayoutTableViewCell.swift */; };
|
||||||
|
DA55465D1D1569CC00AA83EE /* AutolayoutCellsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA55465C1D1569CC00AA83EE /* AutolayoutCellsController.swift */; };
|
||||||
|
DA5546601D156A4F00AA83EE /* ConfigurableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA55465F1D156A4F00AA83EE /* ConfigurableTableViewCell.swift */; };
|
||||||
|
DA5546641D15762000AA83EE /* NibTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5546631D15762000AA83EE /* NibTableViewCell.swift */; };
|
||||||
|
DA5546661D15765900AA83EE /* NibTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA5546651D15765900AA83EE /* NibTableViewCell.xib */; };
|
||||||
|
DA5546681D15771D00AA83EE /* NibCellsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5546671D15771D00AA83EE /* NibCellsController.swift */; };
|
||||||
DA9EA7D91D0EC65B0021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7D61D0EC5C60021F650 /* 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, ); }; };
|
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 */; };
|
DAC2D5CA1C9D303E009E9C19 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D5C91C9D303E009E9C19 /* AppDelegate.swift */; };
|
||||||
|
|
@ -15,8 +22,6 @@
|
||||||
DAC2D5D01C9D30A7009E9C19 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D5CE1C9D30A7009E9C19 /* LaunchScreen.storyboard */; };
|
DAC2D5D01C9D30A7009E9C19 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D5CE1C9D30A7009E9C19 /* LaunchScreen.storyboard */; };
|
||||||
DAC2D69C1C9E75E3009E9C19 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D69B1C9E75E3009E9C19 /* Assets.xcassets */; };
|
DAC2D69C1C9E75E3009E9C19 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D69B1C9E75E3009E9C19 /* Assets.xcassets */; };
|
||||||
DACB71761CC2D63D00432BD3 /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACB71751CC2D63D00432BD3 /* MainController.swift */; };
|
DACB71761CC2D63D00432BD3 /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACB71751CC2D63D00432BD3 /* MainController.swift */; };
|
||||||
DACB71781CC2D6ED00432BD3 /* StoryboardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACB71771CC2D6ED00432BD3 /* StoryboardTableViewCell.swift */; };
|
|
||||||
DACB717A1CC2D89D00432BD3 /* HeaderFooterController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACB71791CC2D89D00432BD3 /* HeaderFooterController.swift */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
|
@ -58,7 +63,14 @@
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardImageTableViewCell.swift; sourceTree = "<group>"; };
|
5079ADE21FE1BF1B000CC345 /* AutolayoutSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutolayoutSectionHeaderView.swift; sourceTree = "<group>"; };
|
||||||
|
5079ADE51FE1BF65000CC345 /* AutolayoutSectionHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AutolayoutSectionHeaderView.xib; sourceTree = "<group>"; };
|
||||||
|
DA08A0521CF4E9B500BBF1F8 /* AutolayoutTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutolayoutTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
|
DA55465C1D1569CC00AA83EE /* AutolayoutCellsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutolayoutCellsController.swift; sourceTree = "<group>"; };
|
||||||
|
DA55465F1D156A4F00AA83EE /* ConfigurableTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurableTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
|
DA5546631D15762000AA83EE /* NibTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NibTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
|
DA5546651D15765900AA83EE /* NibTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NibTableViewCell.xib; sourceTree = "<group>"; };
|
||||||
|
DA5546671D15771D00AA83EE /* NibCellsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NibCellsController.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TableKit.xcodeproj; path = ../TableKit.xcodeproj; sourceTree = "<group>"; };
|
DA9EA7D01D0EC5C50021F650 /* TableKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TableKit.xcodeproj; path = ../TableKit.xcodeproj; sourceTree = "<group>"; };
|
||||||
DAB7EB271BEF787300D2AD5E /* TableKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
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 = "<group>"; };
|
DAC2D5C91C9D303E009E9C19 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
|
|
@ -67,8 +79,6 @@
|
||||||
DAC2D69B1C9E75E3009E9C19 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
DAC2D69B1C9E75E3009E9C19 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
DAC2D69D1C9E78B5009E9C19 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
DAC2D69D1C9E78B5009E9C19 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
DACB71751CC2D63D00432BD3 /* MainController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
|
DACB71751CC2D63D00432BD3 /* MainController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
|
||||||
DACB71771CC2D6ED00432BD3 /* StoryboardTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardTableViewCell.swift; sourceTree = "<group>"; };
|
|
||||||
DACB71791CC2D89D00432BD3 /* HeaderFooterController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderFooterController.swift; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
|
@ -175,7 +185,8 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
DACB71751CC2D63D00432BD3 /* MainController.swift */,
|
DACB71751CC2D63D00432BD3 /* MainController.swift */,
|
||||||
DACB71791CC2D89D00432BD3 /* HeaderFooterController.swift */,
|
DA55465C1D1569CC00AA83EE /* AutolayoutCellsController.swift */,
|
||||||
|
DA5546671D15771D00AA83EE /* NibCellsController.swift */,
|
||||||
);
|
);
|
||||||
path = Controllers;
|
path = Controllers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -183,8 +194,12 @@
|
||||||
DACB71741CC2D5FD00432BD3 /* Views */ = {
|
DACB71741CC2D5FD00432BD3 /* Views */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
DACB71771CC2D6ED00432BD3 /* StoryboardTableViewCell.swift */,
|
DA55465F1D156A4F00AA83EE /* ConfigurableTableViewCell.swift */,
|
||||||
DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */,
|
DA08A0521CF4E9B500BBF1F8 /* AutolayoutTableViewCell.swift */,
|
||||||
|
DA5546631D15762000AA83EE /* NibTableViewCell.swift */,
|
||||||
|
DA5546651D15765900AA83EE /* NibTableViewCell.xib */,
|
||||||
|
5079ADE21FE1BF1B000CC345 /* AutolayoutSectionHeaderView.swift */,
|
||||||
|
5079ADE51FE1BF65000CC345 /* AutolayoutSectionHeaderView.xib */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -218,12 +233,13 @@
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 0720;
|
LastSwiftUpdateCheck = 0720;
|
||||||
LastUpgradeCheck = 0700;
|
LastUpgradeCheck = 1000;
|
||||||
ORGANIZATIONNAME = Tablet;
|
ORGANIZATIONNAME = Tablet;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
DAB7EB261BEF787300D2AD5E = {
|
DAB7EB261BEF787300D2AD5E = {
|
||||||
CreatedOnToolsVersion = 7.0.1;
|
CreatedOnToolsVersion = 7.0.1;
|
||||||
DevelopmentTeam = Z48R734SJX;
|
DevelopmentTeam = Z48R734SJX;
|
||||||
|
LastSwiftMigration = 1000;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -232,6 +248,7 @@
|
||||||
developmentRegion = English;
|
developmentRegion = English;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
|
English,
|
||||||
en,
|
en,
|
||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
|
|
@ -274,6 +291,8 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
DAC2D5CF1C9D30A7009E9C19 /* Main.storyboard in Resources */,
|
DAC2D5CF1C9D30A7009E9C19 /* Main.storyboard in Resources */,
|
||||||
|
5079ADE61FE1BF65000CC345 /* AutolayoutSectionHeaderView.xib in Resources */,
|
||||||
|
DA5546661D15765900AA83EE /* NibTableViewCell.xib in Resources */,
|
||||||
DAC2D5D01C9D30A7009E9C19 /* LaunchScreen.storyboard in Resources */,
|
DAC2D5D01C9D30A7009E9C19 /* LaunchScreen.storyboard in Resources */,
|
||||||
DAC2D69C1C9E75E3009E9C19 /* Assets.xcassets in Resources */,
|
DAC2D69C1C9E75E3009E9C19 /* Assets.xcassets in Resources */,
|
||||||
);
|
);
|
||||||
|
|
@ -286,11 +305,14 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
DACB71781CC2D6ED00432BD3 /* StoryboardTableViewCell.swift in Sources */,
|
|
||||||
DACB71761CC2D63D00432BD3 /* MainController.swift in Sources */,
|
DACB71761CC2D63D00432BD3 /* MainController.swift in Sources */,
|
||||||
|
DA55465D1D1569CC00AA83EE /* AutolayoutCellsController.swift in Sources */,
|
||||||
|
DA5546681D15771D00AA83EE /* NibCellsController.swift in Sources */,
|
||||||
DAC2D5CA1C9D303E009E9C19 /* AppDelegate.swift in Sources */,
|
DAC2D5CA1C9D303E009E9C19 /* AppDelegate.swift in Sources */,
|
||||||
DACB717A1CC2D89D00432BD3 /* HeaderFooterController.swift in Sources */,
|
5079ADE31FE1BF1B000CC345 /* AutolayoutSectionHeaderView.swift in Sources */,
|
||||||
DA08A0531CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift in Sources */,
|
DA5546641D15762000AA83EE /* NibTableViewCell.swift in Sources */,
|
||||||
|
DA5546601D156A4F00AA83EE /* ConfigurableTableViewCell.swift in Sources */,
|
||||||
|
DA08A0531CF4E9B500BBF1F8 /* AutolayoutTableViewCell.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -313,13 +335,23 @@
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
|
|
@ -346,6 +378,7 @@
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
@ -357,13 +390,23 @@
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
|
|
@ -382,6 +425,8 @@
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
@ -389,32 +434,34 @@
|
||||||
DAB7EB3A1BEF787300D2AD5E /* Debug */ = {
|
DAB7EB3A1BEF787300D2AD5E /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
|
||||||
INFOPLIST_FILE = Resources/Info.plist;
|
INFOPLIST_FILE = Resources/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo;
|
||||||
PRODUCT_NAME = TableKitDemo;
|
PRODUCT_NAME = TableKitDemo;
|
||||||
PROVISIONING_PROFILE = "";
|
PROVISIONING_PROFILE = "";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
DAB7EB3B1BEF787300D2AD5E /* Release */ = {
|
DAB7EB3B1BEF787300D2AD5E /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
|
||||||
INFOPLIST_FILE = Resources/Info.plist;
|
INFOPLIST_FILE = Resources/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo;
|
||||||
PRODUCT_NAME = TableKitDemo;
|
PRODUCT_NAME = TableKitDemo;
|
||||||
PROVISIONING_PROFILE = "";
|
PROVISIONING_PROFILE = "";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
|
// swift-tools-version:5.7
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "TableKit"
|
name: "TableKit",
|
||||||
|
|
||||||
|
products: [
|
||||||
|
.library(
|
||||||
|
name: "TableKit",
|
||||||
|
targets: ["TableKit"]),
|
||||||
|
],
|
||||||
|
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "TableKit",
|
||||||
|
path: "Sources")
|
||||||
|
]
|
||||||
)
|
)
|
||||||
226
README.md
226
README.md
|
|
@ -1,35 +1,44 @@
|
||||||
#TableKit
|
# TableKit
|
||||||
|
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<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://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://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_5.1-compatible-4BC51D.svg?style=flat" alt="Swift 5.1 compatible" /></a>
|
||||||
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
|
<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-0.7.0-blue.svg" alt="CocoaPods compatible" /></a>
|
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-2.11.0-blue.svg" alt="CocoaPods compatible" /></a>
|
||||||
<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>
|
<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>
|
</p>
|
||||||
|
|
||||||
TableKit is a super lightweight yet powerful generic library that allows you to build complex table views in a declarative type-safe manner.
|
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.
|
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
|
# Features
|
||||||
|
|
||||||
- [x] Type-safe cells based on generics
|
- [x] Type-safe generic cells
|
||||||
|
- [x] Functional programming style friendly
|
||||||
- [x] The easiest way to map your models or view models to cells
|
- [x] The easiest way to map your models or view models to cells
|
||||||
|
- [x] Automatic cell registration*
|
||||||
- [x] Correctly handles autolayout cells with multiline labels
|
- [x] Correctly handles autolayout cells with multiline labels
|
||||||
- [x] Chainable cell actions (select/deselect etc.)
|
- [x] Chainable cell actions (select/deselect etc.)
|
||||||
- [x] Support cells created from code, xib, or storyboard
|
- [x] Support cells created from code, xib, or storyboard
|
||||||
- [x] Automatic xib/classes registration
|
- [x] Support different cells height calculation strategies
|
||||||
|
- [x] Support portrait and landscape orientations
|
||||||
- [x] No need to subclass
|
- [x] No need to subclass
|
||||||
- [x] Extensibility
|
- [x] Extensibility
|
||||||
- [x] Tests
|
|
||||||
|
|
||||||
## Usage
|
# Getting Started
|
||||||
|
|
||||||
|
An [example app](Demo) is included demonstrating TableKit's functionality.
|
||||||
|
|
||||||
|
## Basic usage
|
||||||
|
|
||||||
Create your rows:
|
Create your rows:
|
||||||
```swift
|
```swift
|
||||||
let row1 = TableRow<String, StringTableViewCell>(item: "1")
|
import TableKit
|
||||||
let row2 = TableRow<String, IntTableViewCell>(item: 2)
|
|
||||||
let row3 = TableRow<String, FloatTableViewCell>(item: 3.0)
|
let row1 = TableRow<StringTableViewCell>(item: "1")
|
||||||
|
let row2 = TableRow<IntTableViewCell>(item: 2)
|
||||||
|
let row3 = TableRow<UserTableViewCell>(item: User(name: "John Doe", rating: 5))
|
||||||
```
|
```
|
||||||
Put rows into section:
|
Put rows into section:
|
||||||
```swift
|
```swift
|
||||||
|
|
@ -40,18 +49,32 @@ And setup your table:
|
||||||
let tableDirector = TableDirector(tableView: tableView)
|
let tableDirector = TableDirector(tableView: tableView)
|
||||||
tableDirector += section
|
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. Your cells have to conform to `ConfigurableCell` protocol:
|
||||||
```swift
|
```swift
|
||||||
class StringTableViewCell: UITableViewCell, ConfigurableCell {
|
class StringTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
typealias T = String
|
func configure(with string: String) {
|
||||||
|
|
||||||
func configure(string: T) {
|
textLabel?.text = string
|
||||||
titleLabel.text = string
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func estimatedHeight() -> CGFloat {
|
class UserTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
return 44
|
|
||||||
|
static var estimatedHeight: CGFloat? {
|
||||||
|
return 100
|
||||||
|
}
|
||||||
|
|
||||||
|
// is not required to be implemented
|
||||||
|
// by default reuse id is equal to cell's class name
|
||||||
|
static var reuseIdentifier: String {
|
||||||
|
return "my id"
|
||||||
|
}
|
||||||
|
|
||||||
|
func configure(with user: User) {
|
||||||
|
|
||||||
|
textLabel?.text = user.name
|
||||||
|
detailTextLabel?.text = "Rating: \(user.rating)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -61,64 +84,161 @@ You could have as many rows and sections as you need.
|
||||||
|
|
||||||
It nice to have some actions that related to your cells:
|
It nice to have some actions that related to your cells:
|
||||||
```swift
|
```swift
|
||||||
let action = TableRowAction<String, StringTableViewCell>(.click) { (data) in
|
let action = TableRowAction<StringTableViewCell>(.click) { (options) in
|
||||||
|
|
||||||
|
// you could access any useful information that relates to the action
|
||||||
|
|
||||||
|
// options.cell - StringTableViewCell?
|
||||||
|
// options.item - String
|
||||||
|
// options.indexPath - IndexPath
|
||||||
|
// options.userInfo - [AnyHashable: Any]?
|
||||||
}
|
}
|
||||||
|
|
||||||
let row = TableRow<String, StringTableViewCell>(item: "some", actions: [action])
|
let row = TableRow<StringTableViewCell>(item: "some", actions: [action])
|
||||||
```
|
```
|
||||||
Or, using nice chaining approach:
|
Or, using nice chaining approach:
|
||||||
```swift
|
```swift
|
||||||
let row = TableRow<String, StringTableViewCell>(item: "some")
|
let row = TableRow<StringTableViewCell>(item: "some")
|
||||||
|
.on(.click) { (options) in
|
||||||
|
|
||||||
row
|
}
|
||||||
.addAction(TableRowAction(.click) { (data) in
|
.on(.shouldHighlight) { (options) -> Bool in
|
||||||
|
return false
|
||||||
})
|
}
|
||||||
.addAction(TableRowAction(.shouldHighlight) { (data) -> Bool in
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
```
|
```
|
||||||
|
You could find all available actions [here](Sources/TableRowAction.swift).
|
||||||
|
|
||||||
## Batch rows
|
## Custom row actions
|
||||||
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`:
|
|
||||||
|
You are able to define your own actions:
|
||||||
```swift
|
```swift
|
||||||
let builder = TableRowBuilder<String, StringTableViewCell> {
|
struct MyActions {
|
||||||
|
|
||||||
// do some additional setup here
|
static let ButtonClicked = "ButtonClicked"
|
||||||
$0.items = ["1", "2", "3"]
|
|
||||||
$0.actions = [action]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
section.append(builder: builder)
|
class MyTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
|
@IBAction func myButtonClicked(sender: UIButton) {
|
||||||
|
|
||||||
|
TableCellAction(key: MyActions.ButtonClicked, sender: self).invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
Or if you don't need an additional setup for your data, just use standart init:
|
And handle them accordingly:
|
||||||
```swift
|
```swift
|
||||||
let builder = TableRowBuilder<String, StringTableViewCell>(items: ["1", "2", "3"], actions: [actions])
|
let myAction = TableRowAction<MyTableViewCell>(.custom(MyActions.ButtonClicked)) { (options) in
|
||||||
|
|
||||||
section.append(builder: builder)
|
}
|
||||||
|
```
|
||||||
|
## Multiple actions with same type
|
||||||
|
|
||||||
|
It's also possible to use multiple actions with same type:
|
||||||
|
```swift
|
||||||
|
let click1 = TableRowAction<StringTableViewCell>(.click) { (options) in }
|
||||||
|
click1.id = "click1" // optional
|
||||||
|
|
||||||
|
let click2 = TableRowAction<StringTableViewCell>(.click) { (options) in }
|
||||||
|
click2.id = "click2" // optional
|
||||||
|
|
||||||
|
let row = TableRow<StringTableViewCell>(item: "some", actions: [click1, click2])
|
||||||
|
```
|
||||||
|
Could be useful in case if you want to separate your logic somehow. Actions will be invoked in order which they were attached.
|
||||||
|
> If you define multiple actions with same type which also return a value, only last return value will be used for table view.
|
||||||
|
|
||||||
|
You could also remove any action by id:
|
||||||
|
```swift
|
||||||
|
row.removeAction(forActionId: "action_id")
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
# Advanced
|
||||||
|
|
||||||
#### CocoaPods
|
## Cell height calculating strategy
|
||||||
|
By default TableKit relies on <a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithSelf-SizingTableViewCells.html" target="_blank">self-sizing cells</a>. In that case you have to provide an estimated height for your cells:
|
||||||
|
```swift
|
||||||
|
class StringTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
static var estimatedHeight: CGFloat? {
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
It's enough for most cases. But you may be not happy with this. So you could use a prototype cell to calculate cells heights. To enable this feature simply use this property:
|
||||||
|
```swift
|
||||||
|
let tableDirector = TableDirector(tableView: tableView, shouldUsePrototypeCellHeightCalculation: true)
|
||||||
|
```
|
||||||
|
It does all dirty work with prototypes for you [behind the scene](Sources/TablePrototypeCellHeightCalculator.swift), so you don't have to worry about anything except of your cell configuration:
|
||||||
|
```swift
|
||||||
|
class ImageTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
|
func configure(with url: NSURL) {
|
||||||
|
|
||||||
|
loadImageAsync(url: url, imageView: imageView)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
|
||||||
|
contentView.layoutIfNeeded()
|
||||||
|
multilineLabel.preferredMaxLayoutWidth = multilineLabel.bounds.size.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
You have to additionally set `preferredMaxLayoutWidth` for all your multiline labels.
|
||||||
|
|
||||||
|
## Functional programming
|
||||||
|
It's never been so easy to deal with table views.
|
||||||
|
```swift
|
||||||
|
let users = /* some users array */
|
||||||
|
|
||||||
|
let click = TableRowAction<UserTableViewCell>(.click) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let rows = users.filter({ $0.state == .active }).map({ TableRow<UserTableViewCell>(item: $0.name, actions: [click]) })
|
||||||
|
|
||||||
|
tableDirector += rows
|
||||||
|
```
|
||||||
|
Done, your table is ready.
|
||||||
|
## Automatic cell registration
|
||||||
|
|
||||||
|
TableKit can register your cells in a table view automatically. In case if your reusable cell id matches cell's xib name:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
MyTableViewCell.swift
|
||||||
|
MyTableViewCell.xib
|
||||||
|
|
||||||
|
```
|
||||||
|
You can also turn off this behaviour:
|
||||||
|
```swift
|
||||||
|
let tableDirector = TableDirector(tableView: tableView, shouldUseAutomaticCellRegistration: false)
|
||||||
|
```
|
||||||
|
and register your cell manually.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
## CocoaPods
|
||||||
To integrate TableKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
To integrate TableKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
source 'https://github.com/CocoaPods/Specs.git'
|
|
||||||
platform :ios, '8.0'
|
|
||||||
use_frameworks!
|
|
||||||
|
|
||||||
pod 'TableKit'
|
pod 'TableKit'
|
||||||
```
|
```
|
||||||
#### Carthage
|
## Carthage
|
||||||
Add the line `github "maxsokolov/tablekit"` to your `Cartfile`
|
Add the line `github "maxsokolov/tablekit"` to your `Cartfile`.
|
||||||
|
## Manual
|
||||||
|
Clone the repo and drag files from `Sources` folder into your Xcode project.
|
||||||
|
|
||||||
## Requirements
|
# Requirements
|
||||||
|
|
||||||
- iOS 8.0+
|
- iOS 8.0
|
||||||
- Xcode 7.0+
|
- Xcode 9.0
|
||||||
|
|
||||||
## License
|
# Changelog
|
||||||
|
|
||||||
|
Keep an eye on [changes](CHANGELOG.md).
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
TableKit is available under the MIT license. See LICENSE for details.
|
TableKit is available under the MIT license. See LICENSE for details.
|
||||||
|
|
@ -22,25 +22,36 @@ import UIKit
|
||||||
|
|
||||||
public protocol ConfigurableCell {
|
public protocol ConfigurableCell {
|
||||||
|
|
||||||
associatedtype T
|
associatedtype CellData
|
||||||
|
|
||||||
|
static var reuseIdentifier: String { get }
|
||||||
|
|
||||||
|
static var estimatedHeight: CGFloat? { get }
|
||||||
|
|
||||||
|
static var defaultHeight: CGFloat? { get }
|
||||||
|
|
||||||
|
static var layoutType: LayoutType { get }
|
||||||
|
|
||||||
|
func configure(with _: CellData)
|
||||||
|
|
||||||
static func reusableIdentifier() -> String
|
|
||||||
static func estimatedHeight() -> CGFloat
|
|
||||||
static func defaultHeight() -> CGFloat?
|
|
||||||
func configure(_: T)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension ConfigurableCell where Self: UITableViewCell {
|
public extension ConfigurableCell where Self: UITableViewCell {
|
||||||
|
|
||||||
static func reusableIdentifier() -> String {
|
static var reuseIdentifier: String {
|
||||||
return String(self)
|
return String(describing: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func estimatedHeight() -> CGFloat {
|
static var estimatedHeight: CGFloat? {
|
||||||
return UITableViewAutomaticDimension
|
|
||||||
}
|
|
||||||
|
|
||||||
static func defaultHeight() -> CGFloat? {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static var defaultHeight: CGFloat? {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
static var layoutType: LayoutType {
|
||||||
|
return .auto
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
public extension TimeInterval {
|
||||||
|
|
||||||
|
static let defaultExpandableAnimationDuration: TimeInterval = 0.3
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol Expandable {
|
||||||
|
|
||||||
|
associatedtype ViewModelType: ExpandableCellViewModel
|
||||||
|
|
||||||
|
var viewModel: ViewModelType? { get }
|
||||||
|
|
||||||
|
func configure(state: ExpandableState)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Expandable where Self: UITableViewCell & ConfigurableCell {
|
||||||
|
|
||||||
|
public func initState() {
|
||||||
|
guard let viewModel = viewModel else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState(expandableState: viewModel.expandableState)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func changeState(expandableState: ExpandableState) {
|
||||||
|
// layout to get right frames, frame of bottom subview can be used to get expanded height
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
|
|
||||||
|
// apply changes
|
||||||
|
configure(state: expandableState)
|
||||||
|
layoutIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
public func toggleState(animated: Bool = true,
|
||||||
|
animationDuration: TimeInterval = .defaultExpandableAnimationDuration) {
|
||||||
|
|
||||||
|
guard let viewModel = viewModel,
|
||||||
|
let stateIndex = viewModel.availableStates.firstIndex(where: { $0 == viewModel.expandableState }) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let targetState = stateIndex == viewModel.availableStates.count - 1
|
||||||
|
? viewModel.availableStates[0]
|
||||||
|
: viewModel.availableStates[stateIndex + 1]
|
||||||
|
|
||||||
|
transition(to: targetState,
|
||||||
|
animated: animated,
|
||||||
|
animationDuration: animationDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func transition(to state: ExpandableState,
|
||||||
|
animated: Bool = true,
|
||||||
|
animationDuration: TimeInterval = .defaultExpandableAnimationDuration) {
|
||||||
|
|
||||||
|
guard let tableView = tableView,
|
||||||
|
let viewModel = viewModel,
|
||||||
|
viewModel.expandableState != state else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let contentOffset = tableView.contentOffset
|
||||||
|
|
||||||
|
if animated {
|
||||||
|
UIView.animate(withDuration: animationDuration,
|
||||||
|
animations: { [weak self] in
|
||||||
|
self?.applyChanges(expandableState: state)
|
||||||
|
}, completion: { _ in
|
||||||
|
viewModel.expandableState = state
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
applyChanges(expandableState: state)
|
||||||
|
viewModel.expandableState = state
|
||||||
|
}
|
||||||
|
|
||||||
|
tableView.beginUpdates()
|
||||||
|
tableView.endUpdates()
|
||||||
|
|
||||||
|
tableView.setContentOffset(contentOffset, animated: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func applyChanges(expandableState: ExpandableState) {
|
||||||
|
changeState(expandableState: expandableState)
|
||||||
|
|
||||||
|
if let indexPath = indexPath,
|
||||||
|
let tableDirector = (tableView?.delegate as? TableDirector),
|
||||||
|
let cellHeightCalculator = tableDirector.rowHeightCalculator as? ExpandableCellHeightCalculator {
|
||||||
|
cellHeightCalculator.updateCached(height: expandableState.height ?? height(layoutType: Self.layoutType), for: indexPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
public final class ExpandableCellHeightCalculator: RowHeightCalculator {
|
||||||
|
|
||||||
|
private weak var tableView: UITableView?
|
||||||
|
|
||||||
|
private var prototypes = [String: UITableViewCell]()
|
||||||
|
|
||||||
|
private var cachedHeights = [IndexPath: CGFloat]()
|
||||||
|
|
||||||
|
public init(tableView: UITableView?) {
|
||||||
|
self.tableView = tableView
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updateCached(height: CGFloat, for indexPath: IndexPath) {
|
||||||
|
cachedHeights[indexPath] = height
|
||||||
|
}
|
||||||
|
|
||||||
|
public func height(forRow row: Row, at indexPath: IndexPath) -> CGFloat {
|
||||||
|
|
||||||
|
guard let tableView = tableView else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if let height = cachedHeights[indexPath] {
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
var prototypeCell = prototypes[row.reuseIdentifier]
|
||||||
|
if prototypeCell == nil {
|
||||||
|
prototypeCell = tableView.dequeueReusableCell(withIdentifier: row.reuseIdentifier)
|
||||||
|
prototypes[row.reuseIdentifier] = prototypeCell
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let cell = prototypeCell else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
row.configure(cell)
|
||||||
|
cell.layoutIfNeeded()
|
||||||
|
|
||||||
|
let height = cell.height(layoutType: row.layoutType)
|
||||||
|
cachedHeights[indexPath] = height
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
public func estimatedHeight(forRow row: Row, at indexPath: IndexPath) -> CGFloat {
|
||||||
|
return height(forRow: row, at: indexPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func invalidate() {
|
||||||
|
cachedHeights.removeAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
public protocol ExpandableCellViewModel: AnyObject {
|
||||||
|
|
||||||
|
var expandableState: ExpandableState { get set }
|
||||||
|
|
||||||
|
var availableStates: [ExpandableState] { get }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public extension ExpandableCellViewModel {
|
||||||
|
|
||||||
|
var availableStates: [ExpandableState] {
|
||||||
|
return [.collapsed, .expanded]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
public enum ExpandableState {
|
||||||
|
|
||||||
|
case collapsed
|
||||||
|
|
||||||
|
case expanded
|
||||||
|
|
||||||
|
case height(value: CGFloat)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ExpandableState: Equatable { }
|
||||||
|
|
||||||
|
extension ExpandableState {
|
||||||
|
|
||||||
|
public var isCollapsed: Bool {
|
||||||
|
guard case .collapsed = self else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
public var isExpanded: Bool {
|
||||||
|
guard case .expanded = self else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: CGFloat? {
|
||||||
|
guard case let .height(value: height) = self else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
public enum LayoutType {
|
||||||
|
|
||||||
|
case manual
|
||||||
|
|
||||||
|
case auto
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,15 @@ public func +=(left: TableDirector, right: [TableSection]) {
|
||||||
left.append(sections: right)
|
left.append(sections: right)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --
|
||||||
|
public func +=(left: TableDirector, right: Row) {
|
||||||
|
left.append(sections: [TableSection(rows: [right])])
|
||||||
|
}
|
||||||
|
|
||||||
|
public func +=(left: TableDirector, right: [Row]) {
|
||||||
|
left.append(sections: [TableSection(rows: right)])
|
||||||
|
}
|
||||||
|
|
||||||
// --
|
// --
|
||||||
public func +=(left: TableSection, right: Row) {
|
public func +=(left: TableSection, right: Row) {
|
||||||
left.append(row: right)
|
left.append(row: right)
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,11 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
struct TableKitNotifications {
|
|
||||||
static let CellAction = "TableKitNotificationsCellAction"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A custom action that you can trigger from your cell.
|
A custom action that you can trigger from your cell.
|
||||||
You can eacily catch actions using a chaining manner with your row builder.
|
You can easily catch actions using a chaining manner with your row.
|
||||||
*/
|
*/
|
||||||
public class TableCellAction {
|
open class TableCellAction {
|
||||||
|
|
||||||
/// The cell that triggers an action.
|
/// The cell that triggers an action.
|
||||||
public let cell: UITableViewCell
|
public let cell: UITableViewCell
|
||||||
|
|
@ -37,16 +33,16 @@ public class TableCellAction {
|
||||||
public let key: String
|
public let key: String
|
||||||
|
|
||||||
/// The custom user info.
|
/// The custom user info.
|
||||||
public let userInfo: [NSObject: AnyObject]?
|
public let userInfo: [AnyHashable: Any]?
|
||||||
|
|
||||||
public init(key: String, sender: UITableViewCell, userInfo: [NSObject: AnyObject]? = nil) {
|
public init(key: String, sender: UITableViewCell, userInfo: [AnyHashable: Any]? = nil) {
|
||||||
|
|
||||||
self.key = key
|
self.key = key
|
||||||
self.cell = sender
|
self.cell = sender
|
||||||
self.userInfo = userInfo
|
self.userInfo = userInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
public func invoke() {
|
open func invoke() {
|
||||||
NSNotificationCenter.defaultCenter().postNotificationName(TableKitNotifications.CellAction, object: self, userInfo: userInfo)
|
NotificationCenter.default.post(name: Notification.Name(rawValue: TableKitNotifications.CellAction), object: self, userInfo: userInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,29 +20,39 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public protocol HeightStrategy {
|
class TableCellRegisterer {
|
||||||
|
|
||||||
var tableView: UITableView? { get set }
|
private var registeredIds = Set<String>()
|
||||||
|
private weak var tableView: UITableView?
|
||||||
|
|
||||||
func height<Item, Cell: ConfigurableCell where Cell.T == Item, Cell: UITableViewCell>(item: Item, indexPath: NSIndexPath, cell: Cell.Type) -> CGFloat
|
init(tableView: UITableView?) {
|
||||||
}
|
self.tableView = tableView
|
||||||
|
}
|
||||||
|
|
||||||
public class PrototypeHeightStrategy: HeightStrategy {
|
func register(cellType: AnyClass, forCellReuseIdentifier reuseIdentifier: String) {
|
||||||
|
|
||||||
public weak var tableView: UITableView?
|
if registeredIds.contains(reuseIdentifier) {
|
||||||
private var cachedHeights = [Int: CGFloat]()
|
return
|
||||||
|
}
|
||||||
|
|
||||||
public func height<Item, Cell: ConfigurableCell where Cell.T == Item, Cell: UITableViewCell>(item: Item, indexPath: NSIndexPath, cell: Cell.Type) -> CGFloat {
|
// check if cell is already registered, probably cell has been registered by storyboard
|
||||||
|
if tableView?.dequeueReusableCell(withIdentifier: reuseIdentifier) != nil {
|
||||||
|
|
||||||
guard let cell = tableView?.dequeueReusableCellWithIdentifier(Cell.reusableIdentifier()) as? Cell else { return 0 }
|
registeredIds.insert(reuseIdentifier)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
cell.bounds = CGRectMake(0, 0, tableView?.bounds.size.width ?? 0, cell.bounds.height)
|
let bundle = Bundle(for: cellType)
|
||||||
|
|
||||||
cell.configure(item)
|
// we hope that cell's xib file has name that equals to cell's class name
|
||||||
|
// in that case we could register nib
|
||||||
|
if let _ = bundle.path(forResource: reuseIdentifier, ofType: "nib") {
|
||||||
|
tableView?.register(UINib(nibName: reuseIdentifier, bundle: bundle), forCellReuseIdentifier: reuseIdentifier)
|
||||||
|
// otherwise, register cell class
|
||||||
|
} else {
|
||||||
|
tableView?.register(cellType, forCellReuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
cell.setNeedsLayout()
|
registeredIds.insert(reuseIdentifier)
|
||||||
cell.layoutIfNeeded()
|
|
||||||
|
|
||||||
return cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height + 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,171 +23,453 @@ import UIKit
|
||||||
/**
|
/**
|
||||||
Responsible for table view's datasource and delegate.
|
Responsible for table view's datasource and delegate.
|
||||||
*/
|
*/
|
||||||
public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
|
open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
|
||||||
|
|
||||||
|
open private(set) weak var tableView: UITableView?
|
||||||
|
open fileprivate(set) var sections = [TableSection]()
|
||||||
|
|
||||||
public private(set) weak var tableView: UITableView?
|
|
||||||
public private(set) var sections = [TableSection]()
|
|
||||||
private weak var scrollDelegate: UIScrollViewDelegate?
|
private weak var scrollDelegate: UIScrollViewDelegate?
|
||||||
|
private var cellRegisterer: TableCellRegisterer?
|
||||||
|
public private(set) var rowHeightCalculator: RowHeightCalculator?
|
||||||
|
private var sectionsIndexTitlesIndexes: [Int]?
|
||||||
|
|
||||||
public init(tableView: UITableView, scrollDelegate: UIScrollViewDelegate? = nil) {
|
@available(*, deprecated, message: "Produced incorrect behaviour")
|
||||||
|
open var shouldUsePrototypeCellHeightCalculation: Bool = false {
|
||||||
|
didSet {
|
||||||
|
if shouldUsePrototypeCellHeightCalculation {
|
||||||
|
rowHeightCalculator = TablePrototypeCellHeightCalculator(tableView: tableView)
|
||||||
|
} else {
|
||||||
|
rowHeightCalculator = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open var isEmpty: Bool {
|
||||||
|
return sections.isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(
|
||||||
|
tableView: UITableView,
|
||||||
|
scrollDelegate: UIScrollViewDelegate? = nil,
|
||||||
|
shouldUseAutomaticCellRegistration: Bool = true,
|
||||||
|
cellHeightCalculator: RowHeightCalculator?)
|
||||||
|
{
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
|
if shouldUseAutomaticCellRegistration {
|
||||||
|
self.cellRegisterer = TableCellRegisterer(tableView: tableView)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.rowHeightCalculator = cellHeightCalculator
|
||||||
self.scrollDelegate = scrollDelegate
|
self.scrollDelegate = scrollDelegate
|
||||||
self.tableView = tableView
|
self.tableView = tableView
|
||||||
self.tableView?.delegate = self
|
self.tableView?.delegate = self
|
||||||
self.tableView?.dataSource = self
|
self.tableView?.dataSource = self
|
||||||
|
|
||||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(didReceiveAction), name: TableKitNotifications.CellAction, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(didReceiveAction), name: NSNotification.Name(rawValue: TableKitNotifications.CellAction), object: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
public convenience init(
|
||||||
|
tableView: UITableView,
|
||||||
|
scrollDelegate: UIScrollViewDelegate? = nil,
|
||||||
|
shouldUseAutomaticCellRegistration: Bool = true,
|
||||||
|
shouldUsePrototypeCellHeightCalculation: Bool = false)
|
||||||
|
{
|
||||||
|
let heightCalculator: TablePrototypeCellHeightCalculator? = shouldUsePrototypeCellHeightCalculation
|
||||||
|
? TablePrototypeCellHeightCalculator(tableView: tableView)
|
||||||
|
: nil
|
||||||
|
|
||||||
|
self.init(
|
||||||
|
tableView: tableView,
|
||||||
|
scrollDelegate: scrollDelegate,
|
||||||
|
shouldUseAutomaticCellRegistration: shouldUseAutomaticCellRegistration,
|
||||||
|
cellHeightCalculator: heightCalculator
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
NSNotificationCenter.defaultCenter().removeObserver(self)
|
NotificationCenter.default.removeObserver(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func reload() {
|
open func reload() {
|
||||||
tableView?.reloadData()
|
tableView?.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Private
|
||||||
|
private func row(at indexPath: IndexPath) -> Row? {
|
||||||
|
if indexPath.section < sections.count && indexPath.row < sections[indexPath.section].rows.count {
|
||||||
|
return sections[indexPath.section].rows[indexPath.row]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Public
|
// MARK: Public
|
||||||
|
@discardableResult
|
||||||
public func invoke(action action: TableRowActionType, cell: UITableViewCell?, indexPath: NSIndexPath) -> Any? {
|
open func invoke(
|
||||||
return sections[indexPath.section].items[indexPath.row].invoke(action, cell: cell, path: indexPath)
|
action: TableRowActionType,
|
||||||
|
cell: UITableViewCell?, indexPath: IndexPath,
|
||||||
|
userInfo: [AnyHashable: Any]? = nil) -> Any?
|
||||||
|
{
|
||||||
|
guard let row = row(at: indexPath) else { return nil }
|
||||||
|
return row.invoke(
|
||||||
|
action: action,
|
||||||
|
cell: cell,
|
||||||
|
path: indexPath,
|
||||||
|
userInfo: userInfo
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func respondsToSelector(selector: Selector) -> Bool {
|
open override func responds(to selector: Selector) -> Bool {
|
||||||
return super.respondsToSelector(selector) || scrollDelegate?.respondsToSelector(selector) == true
|
return super.responds(to: selector) || scrollDelegate?.responds(to: selector) == true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func forwardingTargetForSelector(selector: Selector) -> AnyObject? {
|
open override func forwardingTarget(for selector: Selector) -> Any? {
|
||||||
return scrollDelegate?.respondsToSelector(selector) == true ? scrollDelegate : super.forwardingTargetForSelector(selector)
|
return scrollDelegate?.responds(to: selector) == true
|
||||||
|
? scrollDelegate
|
||||||
|
: super.forwardingTarget(for: selector)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Internal -
|
// MARK: - Internal
|
||||||
|
func hasAction(_ action: TableRowActionType, atIndexPath indexPath: IndexPath) -> Bool {
|
||||||
func hasAction(action: TableRowActionType, atIndexPath indexPath: NSIndexPath) -> Bool {
|
guard let row = row(at: indexPath) else { return false }
|
||||||
return sections[indexPath.section].items[indexPath.row].hasAction(action)
|
return row.has(action: action)
|
||||||
}
|
}
|
||||||
|
|
||||||
func didReceiveAction(notification: NSNotification) {
|
@objc
|
||||||
|
func didReceiveAction(_ notification: Notification) {
|
||||||
|
|
||||||
guard let action = notification.object as? TableCellAction, indexPath = tableView?.indexPathForCell(action.cell) else { return }
|
guard let action = notification.object as? TableCellAction, let indexPath = tableView?.indexPath(for: action.cell) else { return }
|
||||||
invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath)
|
invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath, userInfo: notification.userInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Height
|
// MARK: - Height
|
||||||
|
open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
let row = sections[indexPath.section].rows[indexPath.row]
|
||||||
return sections[indexPath.section].items[indexPath.row].estimatedHeight
|
|
||||||
|
if rowHeightCalculator != nil {
|
||||||
|
cellRegisterer?.register(cellType: row.cellType, forCellReuseIdentifier: row.reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
return row.defaultHeight
|
||||||
|
?? row.estimatedHeight
|
||||||
|
?? rowHeightCalculator?.estimatedHeight(forRow: row, at: indexPath)
|
||||||
|
?? UITableView.automaticDimension
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||||
return sections[indexPath.section].items[indexPath.row].defaultHeight
|
|
||||||
|
let row = sections[indexPath.section].rows[indexPath.row]
|
||||||
|
|
||||||
|
if rowHeightCalculator != nil {
|
||||||
|
cellRegisterer?.register(cellType: row.cellType, forCellReuseIdentifier: row.reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
let rowHeight = invoke(action: .height, cell: nil, indexPath: indexPath) as? CGFloat
|
||||||
|
|
||||||
|
return rowHeight
|
||||||
|
?? row.defaultHeight
|
||||||
|
?? rowHeightCalculator?.height(forRow: row, at: indexPath)
|
||||||
|
?? UITableView.automaticDimension
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UITableViewDataSource - configuration
|
// MARK: UITableViewDataSource - configuration
|
||||||
|
open func numberOfSections(in tableView: UITableView) -> Int {
|
||||||
public func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
|
||||||
return sections.count
|
return sections.count
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
|
guard section < sections.count else { return 0 }
|
||||||
|
|
||||||
return sections[section].numberOfRows
|
return sections[section].numberOfRows
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
|
|
||||||
let row = sections[indexPath.section].items[indexPath.row]
|
let row = sections[indexPath.section].rows[indexPath.row]
|
||||||
let cell = tableView.dequeueReusableCellWithIdentifier(row.reusableIdentifier, forIndexPath: indexPath)
|
|
||||||
|
cellRegisterer?.register(cellType: row.cellType, forCellReuseIdentifier: row.reuseIdentifier)
|
||||||
|
|
||||||
|
let cell = tableView.dequeueReusableCell(withIdentifier: row.reuseIdentifier, for: indexPath)
|
||||||
|
|
||||||
if cell.frame.size.width != tableView.frame.size.width {
|
if cell.frame.size.width != tableView.frame.size.width {
|
||||||
cell.frame = CGRectMake(0, 0, tableView.frame.size.width, cell.frame.size.height)
|
cell.frame = CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: cell.frame.size.height)
|
||||||
cell.layoutIfNeeded()
|
cell.layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
row.configure(cell)
|
row.configure(cell)
|
||||||
|
invoke(action: .configure, cell: cell, indexPath: indexPath)
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UITableViewDataSource - section setup
|
// MARK: UITableViewDataSource - section setup
|
||||||
|
open func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||||
|
guard section < sections.count else { return nil }
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
|
||||||
return sections[section].headerTitle
|
return sections[section].headerTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? {
|
open func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
|
||||||
|
guard section < sections.count else { return nil }
|
||||||
|
|
||||||
return sections[section].footerTitle
|
return sections[section].footerTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UITableViewDelegate - section setup
|
// MARK: UITableViewDelegate - section setup
|
||||||
|
open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
||||||
|
guard section < sections.count else { return nil }
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
|
||||||
return sections[section].headerView
|
return sections[section].headerView
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
|
open func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
|
||||||
|
guard section < sections.count else { return nil }
|
||||||
|
|
||||||
return sections[section].footerView
|
return sections[section].footerView
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
open func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||||
return sections[section].headerView?.frame.size.height ?? UITableViewAutomaticDimension
|
guard section < sections.count else { return 0 }
|
||||||
|
|
||||||
|
let section = sections[section]
|
||||||
|
return section.headerHeight ?? section.headerView?.frame.size.height ?? UITableView.automaticDimension
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
|
open func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
|
||||||
return sections[section].footerView?.frame.size.height ?? UITableViewAutomaticDimension
|
guard section < sections.count else { return 0 }
|
||||||
|
|
||||||
|
let section = sections[section]
|
||||||
|
return section.footerHeight
|
||||||
|
?? section.footerView?.frame.size.height
|
||||||
|
?? UITableView.automaticDimension
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: UITableViewDataSource - Index
|
||||||
|
public func sectionIndexTitles(for tableView: UITableView) -> [String]? {
|
||||||
|
|
||||||
|
var indexTitles = [String]()
|
||||||
|
var indexTitlesIndexes = [Int]()
|
||||||
|
sections.enumerated().forEach { index, section in
|
||||||
|
|
||||||
|
if let title = section.indexTitle {
|
||||||
|
indexTitles.append(title)
|
||||||
|
indexTitlesIndexes.append(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !indexTitles.isEmpty {
|
||||||
|
|
||||||
|
sectionsIndexTitlesIndexes = indexTitlesIndexes
|
||||||
|
return indexTitles
|
||||||
|
}
|
||||||
|
sectionsIndexTitlesIndexes = nil
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
public func tableView(
|
||||||
|
_ tableView: UITableView,
|
||||||
|
sectionForSectionIndexTitle title: String,
|
||||||
|
at index: Int) -> Int
|
||||||
|
{
|
||||||
|
return sectionsIndexTitlesIndexes?[index] ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UITableViewDelegate - actions
|
// MARK: UITableViewDelegate - actions
|
||||||
|
open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
public func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
let cell = tableView.cellForRow(at: indexPath)
|
||||||
|
|
||||||
let cell = tableView.cellForRowAtIndexPath(indexPath)
|
|
||||||
|
|
||||||
if invoke(action: .click, cell: cell, indexPath: indexPath) != nil {
|
if invoke(action: .click, cell: cell, indexPath: indexPath) != nil {
|
||||||
tableView.deselectRowAtIndexPath(indexPath, animated: true)
|
tableView.deselectRow(at: indexPath, animated: true)
|
||||||
} else {
|
} else {
|
||||||
invoke(action: .select, cell: cell, indexPath: indexPath)
|
invoke(action: .select, cell: cell, indexPath: indexPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
|
open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
|
||||||
invoke(action: .deselect, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath)
|
invoke(action: .deselect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
|
open func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||||
invoke(action: .willDisplay, cell: cell, indexPath: indexPath)
|
invoke(action: .willDisplay, cell: cell, indexPath: indexPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, shouldHighlightRowAtIndexPath indexPath: NSIndexPath) -> Bool {
|
public func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||||
return invoke(action: .shouldHighlight, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? Bool ?? true
|
invoke(action: .didEndDisplaying, cell: cell, indexPath: indexPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
|
open func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool {
|
||||||
|
return invoke(action: .shouldHighlight, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? Bool ?? true
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
|
||||||
if hasAction(.willSelect, atIndexPath: indexPath) {
|
if hasAction(.willSelect, atIndexPath: indexPath) {
|
||||||
return invoke(action: .willSelect, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? NSIndexPath
|
return invoke(action: .willSelect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? IndexPath
|
||||||
}
|
}
|
||||||
|
|
||||||
return indexPath
|
return indexPath
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Sections manipulation -
|
open func tableView(_ tableView: UITableView, willDeselectRowAt indexPath: IndexPath) -> IndexPath? {
|
||||||
|
if hasAction(.willDeselect, atIndexPath: indexPath) {
|
||||||
|
return invoke(action: .willDeselect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? IndexPath
|
||||||
|
}
|
||||||
|
|
||||||
public func append(section section: TableSection) -> Self {
|
return indexPath
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 13.0, *)
|
||||||
|
open func tableView(
|
||||||
|
_ tableView: UITableView,
|
||||||
|
shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> Bool
|
||||||
|
{
|
||||||
|
invoke(action: .shouldBeginMultipleSelection, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? Bool ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 13.0, *)
|
||||||
|
open func tableView(
|
||||||
|
_ tableView: UITableView,
|
||||||
|
didBeginMultipleSelectionInteractionAt indexPath: IndexPath)
|
||||||
|
{
|
||||||
|
invoke(action: .didBeginMultipleSelection, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 13.0, *)
|
||||||
|
open func tableView(
|
||||||
|
_ tableView: UITableView,
|
||||||
|
contextMenuConfigurationForRowAt indexPath: IndexPath,
|
||||||
|
point: CGPoint) -> UIContextMenuConfiguration?
|
||||||
|
{
|
||||||
|
invoke(action: .showContextMenu, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath, userInfo: [TableKitUserInfoKeys.ContextMenuInvokePoint: point]) as? UIContextMenuConfiguration
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Row editing
|
||||||
|
open func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||||
|
return sections[indexPath.section].rows[indexPath.row].isEditingAllowed(forIndexPath: indexPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView,
|
||||||
|
leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||||
|
let currentRow = sections[indexPath.section].rows[indexPath.row]
|
||||||
|
let configuration = UISwipeActionsConfiguration(actions: currentRow.leadingContextualActions)
|
||||||
|
|
||||||
|
configuration.performsFirstActionWithFullSwipe = currentRow.performsFirstActionWithFullSwipe
|
||||||
|
|
||||||
|
return configuration
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView,
|
||||||
|
trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||||
|
let currentRow = sections[indexPath.section].rows[indexPath.row]
|
||||||
|
let configuration = UISwipeActionsConfiguration(actions: currentRow.trailingContextualActions)
|
||||||
|
|
||||||
|
configuration.performsFirstActionWithFullSwipe = currentRow.performsFirstActionWithFullSwipe
|
||||||
|
|
||||||
|
return configuration
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
|
||||||
|
if invoke(action: .canDelete, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? Bool ?? false {
|
||||||
|
return UITableViewCell.EditingStyle.delete
|
||||||
|
}
|
||||||
|
|
||||||
|
return UITableViewCell.EditingStyle.none
|
||||||
|
}
|
||||||
|
|
||||||
|
public func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func tableView(_ tableView: UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath {
|
||||||
|
return invoke(action: .canMoveTo, cell: tableView.cellForRow(at: sourceIndexPath), indexPath: sourceIndexPath, userInfo: [TableKitUserInfoKeys.CellCanMoveProposedIndexPath: proposedDestinationIndexPath]) as? IndexPath ?? proposedDestinationIndexPath
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
||||||
|
if editingStyle == .delete {
|
||||||
|
invoke(action: .clickDelete, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
|
||||||
|
return invoke(action: .canMove, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? Bool ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
|
||||||
|
invoke(action: .move, cell: tableView.cellForRow(at: sourceIndexPath), indexPath: sourceIndexPath, userInfo: [TableKitUserInfoKeys.CellMoveDestinationIndexPath: destinationIndexPath])
|
||||||
|
}
|
||||||
|
|
||||||
|
open func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
|
||||||
|
let cell = tableView.cellForRow(at: indexPath)
|
||||||
|
invoke(action: .accessoryButtonTap, cell: cell, indexPath: indexPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Sections manipulation
|
||||||
|
extension TableDirector {
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func append(section: TableSection) -> Self {
|
||||||
|
|
||||||
append(sections: [section])
|
append(sections: [section])
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
public func append(sections sections: [TableSection]) -> Self {
|
@discardableResult
|
||||||
|
public func append(sections: [TableSection]) -> Self {
|
||||||
|
|
||||||
sections.forEach { $0.tableDirector = self }
|
self.sections.append(contentsOf: sections)
|
||||||
self.sections.appendContentsOf(sections)
|
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func append(rows: [Row]) -> Self {
|
||||||
|
|
||||||
|
append(section: TableSection(rows: rows))
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func insert(section: TableSection, atIndex index: Int) -> Self {
|
||||||
|
|
||||||
|
sections.insert(section, at: index)
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func replaceSection(at index: Int, with section: TableSection) -> Self {
|
||||||
|
|
||||||
|
if index < sections.count {
|
||||||
|
sections[index] = section
|
||||||
|
}
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func delete(sectionAt index: Int) -> Self {
|
||||||
|
|
||||||
|
sections.remove(at: index)
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func remove(sectionAt index: Int) -> Self {
|
||||||
|
return delete(sectionAt: index)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
public func clear() -> Self {
|
public func clear() -> Self {
|
||||||
|
|
||||||
|
rowHeightCalculator?.invalidate()
|
||||||
sections.removeAll()
|
sections.removeAll()
|
||||||
|
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - deprecated methods
|
||||||
|
@available(*, deprecated, message: "Use 'delete(sectionAt:)' method instead")
|
||||||
|
@discardableResult
|
||||||
|
public func delete(index: Int) -> Self {
|
||||||
|
|
||||||
|
sections.remove(at: index)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
struct TableKitNotifications {
|
||||||
|
static let CellAction = "TableKitNotificationsCellAction"
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct TableKitUserInfoKeys {
|
||||||
|
public static let CellMoveDestinationIndexPath = "TableKitCellMoveDestinationIndexPath"
|
||||||
|
public static let CellCanMoveProposedIndexPath = "CellCanMoveProposedIndexPath"
|
||||||
|
public static let ContextMenuInvokePoint = "ContextMenuInvokePoint"
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol RowConfigurable {
|
||||||
|
|
||||||
|
func configure(_ cell: UITableViewCell)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol RowActionable {
|
||||||
|
var leadingContextualActions: [UIContextualAction] { get }
|
||||||
|
var trailingContextualActions: [UIContextualAction] { get }
|
||||||
|
var performsFirstActionWithFullSwipe: Bool { get }
|
||||||
|
|
||||||
|
func isEditingAllowed(forIndexPath indexPath: IndexPath) -> Bool
|
||||||
|
|
||||||
|
func invoke(
|
||||||
|
action: TableRowActionType,
|
||||||
|
cell: UITableViewCell?,
|
||||||
|
path: IndexPath,
|
||||||
|
userInfo: [AnyHashable: Any]?) -> Any?
|
||||||
|
|
||||||
|
func has(action: TableRowActionType) -> Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol RowHashable {
|
||||||
|
|
||||||
|
var hashValue: Int { get }
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol Row: RowConfigurable, RowActionable, RowHashable {
|
||||||
|
|
||||||
|
var reuseIdentifier: String { get }
|
||||||
|
var cellType: AnyClass { get }
|
||||||
|
|
||||||
|
var layoutType: LayoutType { get }
|
||||||
|
var estimatedHeight: CGFloat? { get }
|
||||||
|
var defaultHeight: CGFloat? { get }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TableRowActionType {
|
||||||
|
|
||||||
|
case click
|
||||||
|
case clickDelete
|
||||||
|
case select
|
||||||
|
case deselect
|
||||||
|
case willSelect
|
||||||
|
case willDeselect
|
||||||
|
case willDisplay
|
||||||
|
case didEndDisplaying
|
||||||
|
case shouldHighlight
|
||||||
|
case shouldBeginMultipleSelection
|
||||||
|
case didBeginMultipleSelection
|
||||||
|
case height
|
||||||
|
case canEdit
|
||||||
|
case configure
|
||||||
|
case canDelete
|
||||||
|
case canMove
|
||||||
|
case canMoveTo
|
||||||
|
case move
|
||||||
|
case showContextMenu
|
||||||
|
case accessoryButtonTap
|
||||||
|
case custom(String)
|
||||||
|
|
||||||
|
var key: String {
|
||||||
|
|
||||||
|
switch (self) {
|
||||||
|
case .custom(let key):
|
||||||
|
return key
|
||||||
|
default:
|
||||||
|
return "_\(self)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol RowHeightCalculator {
|
||||||
|
|
||||||
|
func height(forRow row: Row, at indexPath: IndexPath) -> CGFloat
|
||||||
|
func estimatedHeight(forRow row: Row, at indexPath: IndexPath) -> CGFloat
|
||||||
|
|
||||||
|
func invalidate()
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
open class TablePrototypeCellHeightCalculator: RowHeightCalculator {
|
||||||
|
|
||||||
|
private(set) weak var tableView: UITableView?
|
||||||
|
private var prototypes = [String: UITableViewCell]()
|
||||||
|
private var cachedHeights = [Int: CGFloat]()
|
||||||
|
private var separatorHeight = 1 / UIScreen.main.scale
|
||||||
|
|
||||||
|
public init(tableView: UITableView?) {
|
||||||
|
self.tableView = tableView
|
||||||
|
}
|
||||||
|
|
||||||
|
open func height(forRow row: Row, at indexPath: IndexPath) -> CGFloat {
|
||||||
|
|
||||||
|
guard let tableView = tableView else { return 0 }
|
||||||
|
|
||||||
|
let hash = row.hashValue ^ Int(tableView.bounds.size.width).hashValue
|
||||||
|
|
||||||
|
if let height = cachedHeights[hash] {
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
var prototypeCell = prototypes[row.reuseIdentifier]
|
||||||
|
if prototypeCell == nil {
|
||||||
|
|
||||||
|
prototypeCell = tableView.dequeueReusableCell(withIdentifier: row.reuseIdentifier)
|
||||||
|
prototypes[row.reuseIdentifier] = prototypeCell
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let cell = prototypeCell else { return 0 }
|
||||||
|
|
||||||
|
cell.prepareForReuse()
|
||||||
|
row.configure(cell)
|
||||||
|
|
||||||
|
cell.bounds = CGRect(x: 0, y: 0, width: tableView.bounds.size.width, height: cell.bounds.height)
|
||||||
|
cell.setNeedsLayout()
|
||||||
|
cell.layoutIfNeeded()
|
||||||
|
|
||||||
|
let height = cell.contentView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height + (tableView.separatorStyle != .none ? separatorHeight : 0)
|
||||||
|
|
||||||
|
cachedHeights[hash] = height
|
||||||
|
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
open func estimatedHeight(forRow row: Row, at indexPath: IndexPath) -> CGFloat {
|
||||||
|
|
||||||
|
guard let tableView = tableView else { return 0 }
|
||||||
|
|
||||||
|
let hash = row.hashValue ^ Int(tableView.bounds.size.width).hashValue
|
||||||
|
|
||||||
|
if let height = cachedHeights[hash] {
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
if let estimatedHeight = row.estimatedHeight , estimatedHeight > 0 {
|
||||||
|
return estimatedHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
return UITableView.automaticDimension
|
||||||
|
}
|
||||||
|
|
||||||
|
open func invalidate() {
|
||||||
|
cachedHeights.removeAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,68 +20,137 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public protocol RowConfigurable {
|
open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableViewCell {
|
||||||
|
|
||||||
func configure(cell: UITableViewCell)
|
public let item: CellType.CellData
|
||||||
}
|
private lazy var actions = [String: [TableRowAction<CellType>]]()
|
||||||
|
|
||||||
public protocol RowActionable {
|
open var leadingContextualActions: [UIContextualAction] {
|
||||||
|
[]
|
||||||
func invoke(action: TableRowActionType, cell: UITableViewCell?, path: NSIndexPath) -> Any?
|
|
||||||
func hasAction(action: TableRowActionType) -> Bool
|
|
||||||
}
|
|
||||||
|
|
||||||
public protocol Row: RowConfigurable, RowActionable {
|
|
||||||
|
|
||||||
var reusableIdentifier: String { get }
|
|
||||||
var estimatedHeight: CGFloat { get }
|
|
||||||
var defaultHeight: CGFloat { get }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TableRow<ItemType, CellType: ConfigurableCell where CellType.T == ItemType, CellType: UITableViewCell>: Row {
|
|
||||||
|
|
||||||
public let item: ItemType
|
|
||||||
private lazy var actions = [String: TableRowAction<ItemType, CellType>]()
|
|
||||||
|
|
||||||
public var reusableIdentifier: String {
|
|
||||||
return CellType.reusableIdentifier()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public var estimatedHeight: CGFloat {
|
open var trailingContextualActions: [UIContextualAction] {
|
||||||
return CellType.estimatedHeight()
|
[]
|
||||||
}
|
}
|
||||||
|
|
||||||
public var defaultHeight: CGFloat {
|
open var performsFirstActionWithFullSwipe: Bool {
|
||||||
return CellType.defaultHeight() ?? UITableViewAutomaticDimension
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(item: ItemType, actions: [TableRowAction<ItemType, CellType>]? = nil) {
|
open var hashValue: Int {
|
||||||
|
return ObjectIdentifier(self).hashValue
|
||||||
|
}
|
||||||
|
|
||||||
|
open var reuseIdentifier: String {
|
||||||
|
return CellType.reuseIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
|
open var estimatedHeight: CGFloat? {
|
||||||
|
return CellType.estimatedHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
open var defaultHeight: CGFloat? {
|
||||||
|
return CellType.defaultHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
open var layoutType: LayoutType {
|
||||||
|
return CellType.layoutType
|
||||||
|
}
|
||||||
|
|
||||||
|
open var cellType: AnyClass {
|
||||||
|
return CellType.self
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(item: CellType.CellData,
|
||||||
|
actions: [TableRowAction<CellType>]? = nil) {
|
||||||
|
|
||||||
self.item = item
|
self.item = item
|
||||||
actions?.forEach { self.actions[$0.type.key] = $0 }
|
|
||||||
|
actions?.forEach { on($0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - RowConfigurable -
|
// MARK: - RowConfigurable -
|
||||||
|
|
||||||
public func configure(cell: UITableViewCell) {
|
open func configure(_ cell: UITableViewCell) {
|
||||||
(cell as? CellType)?.configure(item)
|
|
||||||
|
(cell as? CellType)?.configure(with: item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - RowActionable -
|
// MARK: - RowActionable -
|
||||||
|
|
||||||
public func invoke(action: TableRowActionType, cell: UITableViewCell?, path: NSIndexPath) -> Any? {
|
open func invoke(action: TableRowActionType, cell: UITableViewCell?, path: IndexPath, userInfo: [AnyHashable: Any]? = nil) -> Any? {
|
||||||
return actions[action.key]?.invoke(item: item, cell: cell, path: path)
|
|
||||||
|
return actions[action.key]?.compactMap({ $0.invokeActionOn(cell: cell, item: item, path: path, userInfo: userInfo) }).last
|
||||||
}
|
}
|
||||||
|
|
||||||
public func hasAction(action: TableRowActionType) -> Bool {
|
open func has(action: TableRowActionType) -> Bool {
|
||||||
|
|
||||||
return actions[action.key] != nil
|
return actions[action.key] != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func isEditingAllowed(forIndexPath indexPath: IndexPath) -> Bool {
|
||||||
|
|
||||||
|
if actions[TableRowActionType.canEdit.key] != nil {
|
||||||
|
return invoke(action: .canEdit, cell: nil, path: indexPath) as? Bool ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
return !leadingContextualActions.isEmpty
|
||||||
|
|| !trailingContextualActions.isEmpty
|
||||||
|
|| actions[TableRowActionType.clickDelete.key] != nil
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - actions -
|
// MARK: - actions -
|
||||||
|
|
||||||
public func addAction(action: TableRowAction<ItemType, CellType>) -> Self {
|
@discardableResult
|
||||||
|
open func on(_ action: TableRowAction<CellType>) -> Self {
|
||||||
|
|
||||||
|
if actions[action.type.key] == nil {
|
||||||
|
actions[action.type.key] = [TableRowAction<CellType>]()
|
||||||
|
}
|
||||||
|
actions[action.type.key]?.append(action)
|
||||||
|
|
||||||
actions[action.type.key] = action
|
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
open func on<T>(_ type: TableRowActionType, handler: @escaping (_ options: TableRowActionOptions<CellType>) -> T) -> Self {
|
||||||
|
|
||||||
|
return on(TableRowAction<CellType>(type, handler: handler))
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
open func on(_ key: String, handler: @escaping (_ options: TableRowActionOptions<CellType>) -> ()) -> Self {
|
||||||
|
|
||||||
|
return on(TableRowAction<CellType>(.custom(key), handler: handler))
|
||||||
|
}
|
||||||
|
|
||||||
|
open func removeAllActions() {
|
||||||
|
|
||||||
|
actions.removeAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
open func removeAction(forActionId actionId: String) {
|
||||||
|
|
||||||
|
for (key, value) in actions {
|
||||||
|
if let actionIndex = value.firstIndex(where: { $0.id == actionId }) {
|
||||||
|
actions[key]?.remove(at: actionIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - deprecated actions -
|
||||||
|
|
||||||
|
@available(*, deprecated, message: "Use 'on' method instead")
|
||||||
|
@discardableResult
|
||||||
|
open func action(_ action: TableRowAction<CellType>) -> Self {
|
||||||
|
|
||||||
|
return on(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message: "Use 'on' method instead")
|
||||||
|
@discardableResult
|
||||||
|
open func action<T>(_ type: TableRowActionType, handler: @escaping (_ options: TableRowActionOptions<CellType>) -> T) -> Self {
|
||||||
|
|
||||||
|
return on(TableRowAction<CellType>(type, handler: handler))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,63 +20,64 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public enum TableRowActionType {
|
open class TableRowActionOptions<CellType: ConfigurableCell> where CellType: UITableViewCell {
|
||||||
|
|
||||||
case click
|
public let item: CellType.CellData
|
||||||
case select
|
|
||||||
case deselect
|
|
||||||
case willSelect
|
|
||||||
case configure
|
|
||||||
case willDisplay
|
|
||||||
case shouldHighlight
|
|
||||||
case height
|
|
||||||
case custom(String)
|
|
||||||
|
|
||||||
var key: String {
|
|
||||||
|
|
||||||
switch (self) {
|
|
||||||
case .custom(let key):
|
|
||||||
return key
|
|
||||||
default:
|
|
||||||
return "_\(self)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TableRowActionData<ItemType, CellType: ConfigurableCell where CellType.T == ItemType, CellType: UITableViewCell> {
|
|
||||||
|
|
||||||
public let item: ItemType
|
|
||||||
public let cell: CellType?
|
public let cell: CellType?
|
||||||
public let path: NSIndexPath
|
public let indexPath: IndexPath
|
||||||
public let userInfo: [NSObject: AnyObject]?
|
public let userInfo: [AnyHashable: Any]?
|
||||||
|
|
||||||
init(item: ItemType, cell: CellType?, path: NSIndexPath, userInfo: [NSObject: AnyObject]?) {
|
init(item: CellType.CellData, cell: CellType?, path: IndexPath, userInfo: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
self.item = item
|
self.item = item
|
||||||
self.cell = cell
|
self.cell = cell
|
||||||
self.path = path
|
self.indexPath = path
|
||||||
self.userInfo = userInfo
|
self.userInfo = userInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TableRowAction<ItemType, CellType: ConfigurableCell where CellType.T == ItemType, CellType: UITableViewCell> {
|
private enum TableRowActionHandler<CellType: ConfigurableCell> where CellType: UITableViewCell {
|
||||||
|
|
||||||
public let type: TableRowActionType
|
case voidAction((TableRowActionOptions<CellType>) -> Void)
|
||||||
private let handler: ((data: TableRowActionData<ItemType, CellType>) -> Any?)
|
case action((TableRowActionOptions<CellType>) -> Any?)
|
||||||
|
|
||||||
public init(_ type: TableRowActionType, handler: (data: TableRowActionData<ItemType, CellType>) -> Void) {
|
func invoke(withOptions options: TableRowActionOptions<CellType>) -> Any? {
|
||||||
|
|
||||||
self.type = type
|
switch self {
|
||||||
self.handler = handler
|
case .voidAction(let handler):
|
||||||
}
|
return handler(options)
|
||||||
|
case .action(let handler):
|
||||||
public init<T>(_ type: TableRowActionType, handler: (data: TableRowActionData<ItemType, CellType>) -> T) {
|
return handler(options)
|
||||||
|
}
|
||||||
self.type = type
|
}
|
||||||
self.handler = handler
|
}
|
||||||
}
|
|
||||||
|
open class TableRowAction<CellType: ConfigurableCell> where CellType: UITableViewCell {
|
||||||
func invoke(item item: ItemType, cell: UITableViewCell?, path: NSIndexPath) -> Any? {
|
|
||||||
return handler(data: TableRowActionData(item: item, cell: cell as? CellType, path: path, userInfo: nil))
|
open var id: String?
|
||||||
|
public let type: TableRowActionType
|
||||||
|
private let handler: TableRowActionHandler<CellType>
|
||||||
|
|
||||||
|
public init(_ type: TableRowActionType, handler: @escaping (_ options: TableRowActionOptions<CellType>) -> Void) {
|
||||||
|
|
||||||
|
self.type = type
|
||||||
|
self.handler = .voidAction(handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(_ key: String, handler: @escaping (_ options: TableRowActionOptions<CellType>) -> Void) {
|
||||||
|
|
||||||
|
self.type = .custom(key)
|
||||||
|
self.handler = .voidAction(handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
public init<T>(_ type: TableRowActionType, handler: @escaping (_ options: TableRowActionOptions<CellType>) -> T) {
|
||||||
|
|
||||||
|
self.type = type
|
||||||
|
self.handler = .action(handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func invokeActionOn(cell: UITableViewCell?, item: CellType.CellData, path: IndexPath, userInfo: [AnyHashable: Any]?) -> Any? {
|
||||||
|
|
||||||
|
return handler.invoke(withOptions: TableRowActionOptions(item: item, cell: cell as? CellType, path: path, userInfo: userInfo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,58 +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 protocol RowBuilder {
|
|
||||||
|
|
||||||
func rowItems() -> [Row]?
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TableRowBuilder<ItemType, CellType: ConfigurableCell where CellType.T == ItemType, CellType: UITableViewCell>: RowBuilder {
|
|
||||||
|
|
||||||
public var items: [ItemType]?
|
|
||||||
public var actions: [TableRowAction<ItemType, CellType>]?
|
|
||||||
|
|
||||||
public init(handler: (TableRowBuilder) -> ()) {
|
|
||||||
handler(self)
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(items: [ItemType], actions: [TableRowAction<ItemType, CellType>]? = nil) {
|
|
||||||
|
|
||||||
self.items = items
|
|
||||||
self.actions = actions
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - RowBuilder -
|
|
||||||
|
|
||||||
public func rowItems() -> [Row]? {
|
|
||||||
return items?.map { TableRow<ItemType, CellType>(item: $0, actions: actions) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public extension TableSection {
|
|
||||||
|
|
||||||
public func append(builder builder: RowBuilder) {
|
|
||||||
|
|
||||||
if let rows = builder.rowItems() {
|
|
||||||
append(rows: rows)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -20,26 +20,32 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class TableSection {
|
open class TableSection {
|
||||||
|
|
||||||
weak var tableDirector: TableDirector?
|
open private(set) var rows = [Row]()
|
||||||
|
|
||||||
public private(set) var items = [Row]()
|
open var headerTitle: String?
|
||||||
|
open var footerTitle: String?
|
||||||
|
open var indexTitle: String?
|
||||||
|
|
||||||
public var headerTitle: String?
|
open var headerView: UIView?
|
||||||
public var footerTitle: String?
|
open var footerView: UIView?
|
||||||
|
|
||||||
public private(set) var headerView: UIView?
|
open var headerHeight: CGFloat? = nil
|
||||||
public private(set) var footerView: UIView?
|
open var footerHeight: CGFloat? = nil
|
||||||
|
|
||||||
public var numberOfRows: Int {
|
open var numberOfRows: Int {
|
||||||
return items.count
|
return rows.count
|
||||||
|
}
|
||||||
|
|
||||||
|
open var isEmpty: Bool {
|
||||||
|
return rows.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(rows: [Row]? = nil) {
|
public init(rows: [Row]? = nil) {
|
||||||
|
|
||||||
if let initialRows = rows {
|
if let initialRows = rows {
|
||||||
items.appendContentsOf(initialRows)
|
self.rows.append(contentsOf: initialRows)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,15 +65,46 @@ public class TableSection {
|
||||||
|
|
||||||
// MARK: - Public -
|
// MARK: - Public -
|
||||||
|
|
||||||
public func clear() {
|
open func clear() {
|
||||||
items.removeAll()
|
rows.removeAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func append(row row: Row) {
|
open func append(row: Row) {
|
||||||
append(rows: [row])
|
append(rows: [row])
|
||||||
}
|
}
|
||||||
|
|
||||||
public func append(rows rows: [Row]) {
|
open func append(rows: [Row]) {
|
||||||
items.appendContentsOf(rows)
|
self.rows.append(contentsOf: rows)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func insert(row: Row, at index: Int) {
|
||||||
|
rows.insert(row, at: index)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func insert(rows: [Row], at index: Int) {
|
||||||
|
self.rows.insert(contentsOf: rows, at: index)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func replace(rowAt index: Int, with row: Row) {
|
||||||
|
rows[index] = row
|
||||||
|
}
|
||||||
|
|
||||||
|
open func swap(from: Int, to: Int) {
|
||||||
|
rows.swapAt(from, to)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func delete(rowAt index: Int) {
|
||||||
|
rows.remove(at: index)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func remove(rowAt index: Int) {
|
||||||
|
rows.remove(at: index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - deprecated methods -
|
||||||
|
|
||||||
|
@available(*, deprecated, message: "Use 'delete(rowAt:)' method instead")
|
||||||
|
open func delete(index: Int) {
|
||||||
|
rows.remove(at: index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
extension UITableViewCell {
|
||||||
|
|
||||||
|
var tableView: UITableView? {
|
||||||
|
var view = superview
|
||||||
|
|
||||||
|
while view != nil && !(view is UITableView) {
|
||||||
|
view = view?.superview
|
||||||
|
}
|
||||||
|
|
||||||
|
return view as? UITableView
|
||||||
|
}
|
||||||
|
|
||||||
|
var indexPath: IndexPath? {
|
||||||
|
guard let indexPath = tableView?.indexPath(for: self) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return indexPath
|
||||||
|
}
|
||||||
|
|
||||||
|
public func height(layoutType: LayoutType) -> CGFloat {
|
||||||
|
switch layoutType {
|
||||||
|
case .auto:
|
||||||
|
return contentView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
|
||||||
|
case .manual:
|
||||||
|
return contentView.subviews.map { $0.frame.maxY }.max() ?? 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,16 +2,16 @@ Pod::Spec.new do |s|
|
||||||
s.name = 'TableKit'
|
s.name = 'TableKit'
|
||||||
s.module_name = 'TableKit'
|
s.module_name = 'TableKit'
|
||||||
|
|
||||||
s.version = '0.7.0'
|
s.version = '2.12'
|
||||||
|
|
||||||
s.homepage = 'https://github.com/maxsokolov/TableKit'
|
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/TableKit'
|
||||||
s.summary = 'Type-safe declarative table views. Swift 2.2 is required.'
|
s.summary = 'Type-safe declarative table views with Swift.'
|
||||||
|
|
||||||
s.author = { 'Max Sokolov' => 'i@maxsokolov.net' }
|
s.author = { 'Max Sokolov' => 'i@maxsokolov.net' }
|
||||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||||
s.platforms = { :ios => '8.0' }
|
s.platforms = { :ios => '12.0' }
|
||||||
s.ios.deployment_target = '8.0'
|
s.ios.deployment_target = '12.0'
|
||||||
|
|
||||||
s.source_files = 'Sources/*.swift'
|
s.source_files = 'Sources/*.swift'
|
||||||
s.source = { :git => 'https://github.com/maxsokolov/TableKit.git', :tag => s.version }
|
s.source = { :git => 'https://git.svc.touchin.ru/TouchInstinct/TableKit.git', :tag => s.version }
|
||||||
end
|
end
|
||||||
|
|
@ -7,14 +7,21 @@
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
2CBFA2F521F692F100147B56 /* ExpandableState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CBFA2F421F692F100147B56 /* ExpandableState.swift */; };
|
||||||
|
3201E78421BE9DE1001DF9E7 /* ExpandableCellHeightCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3201E78321BE9DE1001DF9E7 /* ExpandableCellHeightCalculator.swift */; };
|
||||||
|
3201E78621BE9E25001DF9E7 /* UITableViewCell+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3201E78521BE9E25001DF9E7 /* UITableViewCell+Extensions.swift */; };
|
||||||
|
3201E78821BE9EB2001DF9E7 /* Expandable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3201E78721BE9EB2001DF9E7 /* Expandable.swift */; };
|
||||||
|
3201E78A21BE9ED4001DF9E7 /* ExpandableCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3201E78921BE9ED4001DF9E7 /* ExpandableCellViewModel.swift */; };
|
||||||
|
32BDFE9F21C167F400D0BBB4 /* LayoutType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BDFE9E21C167F400D0BBB4 /* LayoutType.swift */; };
|
||||||
|
50CF6E6B1D6704FE004746FF /* TableCellRegisterer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50CF6E6A1D6704FE004746FF /* TableCellRegisterer.swift */; };
|
||||||
|
50E858581DB153F500A9AA55 /* TableKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E858571DB153F500A9AA55 /* TableKit.swift */; };
|
||||||
DA9EA7AF1D0EC2C90021F650 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */; };
|
DA9EA7AF1D0EC2C90021F650 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */; };
|
||||||
DA9EA7B01D0EC2C90021F650 /* HeightStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A71D0EC2C90021F650 /* HeightStrategy.swift */; };
|
DA9EA7B01D0EC2C90021F650 /* TablePrototypeCellHeightCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A71D0EC2C90021F650 /* TablePrototypeCellHeightCalculator.swift */; };
|
||||||
DA9EA7B11D0EC2C90021F650 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A81D0EC2C90021F650 /* Operators.swift */; };
|
DA9EA7B11D0EC2C90021F650 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A81D0EC2C90021F650 /* Operators.swift */; };
|
||||||
DA9EA7B21D0EC2C90021F650 /* TableCellAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */; };
|
DA9EA7B21D0EC2C90021F650 /* TableCellAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */; };
|
||||||
DA9EA7B31D0EC2C90021F650 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */; };
|
DA9EA7B31D0EC2C90021F650 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */; };
|
||||||
DA9EA7B41D0EC2C90021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */; };
|
DA9EA7B41D0EC2C90021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */; };
|
||||||
DA9EA7B51D0EC2C90021F650 /* TableRowAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AC1D0EC2C90021F650 /* TableRowAction.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 */; };
|
DA9EA7B71D0EC2C90021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */; };
|
||||||
DA9EA7C91D0EC45F0021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7561D0B679A0021F650 /* TableKit.framework */; };
|
DA9EA7C91D0EC45F0021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7561D0B679A0021F650 /* TableKit.framework */; };
|
||||||
DA9EA7CF1D0EC4930021F650 /* TableKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7BE1D0EC41D0021F650 /* TableKitTests.swift */; };
|
DA9EA7CF1D0EC4930021F650 /* TableKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7BE1D0EC41D0021F650 /* TableKitTests.swift */; };
|
||||||
|
|
@ -31,15 +38,22 @@
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
2CBFA2F421F692F100147B56 /* ExpandableState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandableState.swift; sourceTree = "<group>"; };
|
||||||
|
3201E78321BE9DE1001DF9E7 /* ExpandableCellHeightCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandableCellHeightCalculator.swift; sourceTree = "<group>"; };
|
||||||
|
3201E78521BE9E25001DF9E7 /* UITableViewCell+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+Extensions.swift"; sourceTree = "<group>"; };
|
||||||
|
3201E78721BE9EB2001DF9E7 /* Expandable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Expandable.swift; sourceTree = "<group>"; };
|
||||||
|
3201E78921BE9ED4001DF9E7 /* ExpandableCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandableCellViewModel.swift; sourceTree = "<group>"; };
|
||||||
|
32BDFE9E21C167F400D0BBB4 /* LayoutType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutType.swift; sourceTree = "<group>"; };
|
||||||
|
50CF6E6A1D6704FE004746FF /* TableCellRegisterer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellRegisterer.swift; sourceTree = "<group>"; };
|
||||||
|
50E858571DB153F500A9AA55 /* TableKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableKit.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7561D0B679A0021F650 /* TableKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TableKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
DA9EA7561D0B679A0021F650 /* TableKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TableKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = "<group>"; };
|
DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7A71D0EC2C90021F650 /* HeightStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightStrategy.swift; sourceTree = "<group>"; };
|
DA9EA7A71D0EC2C90021F650 /* TablePrototypeCellHeightCalculator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TablePrototypeCellHeightCalculator.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7A81D0EC2C90021F650 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
|
DA9EA7A81D0EC2C90021F650 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellAction.swift; sourceTree = "<group>"; };
|
DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellAction.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = "<group>"; };
|
DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = "<group>"; };
|
DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = "<group>"; };
|
DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7AD1D0EC2C90021F650 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = "<group>"; };
|
|
||||||
DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = "<group>"; };
|
DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = "<group>"; };
|
||||||
DA9EA7B91D0EC34E0021F650 /* TableKit.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TableKit.plist; sourceTree = "<group>"; };
|
DA9EA7B91D0EC34E0021F650 /* TableKit.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TableKit.plist; sourceTree = "<group>"; };
|
||||||
DA9EA7BA1D0EC34E0021F650 /* TableKitTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TableKitTests.plist; sourceTree = "<group>"; };
|
DA9EA7BA1D0EC34E0021F650 /* TableKitTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TableKitTests.plist; sourceTree = "<group>"; };
|
||||||
|
|
@ -88,15 +102,22 @@
|
||||||
DA9EA7A51D0EC2B90021F650 /* Sources */ = {
|
DA9EA7A51D0EC2B90021F650 /* Sources */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */,
|
||||||
|
3201E78321BE9DE1001DF9E7 /* ExpandableCellHeightCalculator.swift */,
|
||||||
|
DA9EA7A81D0EC2C90021F650 /* Operators.swift */,
|
||||||
|
DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */,
|
||||||
|
50CF6E6A1D6704FE004746FF /* TableCellRegisterer.swift */,
|
||||||
DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */,
|
DA9EA7AA1D0EC2C90021F650 /* TableDirector.swift */,
|
||||||
|
50E858571DB153F500A9AA55 /* TableKit.swift */,
|
||||||
|
DA9EA7A71D0EC2C90021F650 /* TablePrototypeCellHeightCalculator.swift */,
|
||||||
DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */,
|
DA9EA7AB1D0EC2C90021F650 /* TableRow.swift */,
|
||||||
DA9EA7AD1D0EC2C90021F650 /* TableRowBuilder.swift */,
|
|
||||||
DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */,
|
DA9EA7AC1D0EC2C90021F650 /* TableRowAction.swift */,
|
||||||
DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */,
|
DA9EA7AE1D0EC2C90021F650 /* TableSection.swift */,
|
||||||
DA9EA7A91D0EC2C90021F650 /* TableCellAction.swift */,
|
3201E78521BE9E25001DF9E7 /* UITableViewCell+Extensions.swift */,
|
||||||
DA9EA7A61D0EC2C90021F650 /* ConfigurableCell.swift */,
|
3201E78721BE9EB2001DF9E7 /* Expandable.swift */,
|
||||||
DA9EA7A81D0EC2C90021F650 /* Operators.swift */,
|
3201E78921BE9ED4001DF9E7 /* ExpandableCellViewModel.swift */,
|
||||||
DA9EA7A71D0EC2C90021F650 /* HeightStrategy.swift */,
|
32BDFE9E21C167F400D0BBB4 /* LayoutType.swift */,
|
||||||
|
2CBFA2F421F692F100147B56 /* ExpandableState.swift */,
|
||||||
);
|
);
|
||||||
path = Sources;
|
path = Sources;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -174,14 +195,16 @@
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 0730;
|
LastSwiftUpdateCheck = 0730;
|
||||||
LastUpgradeCheck = 0730;
|
LastUpgradeCheck = 1000;
|
||||||
ORGANIZATIONNAME = "Max Sokolov";
|
ORGANIZATIONNAME = "Max Sokolov";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
DA9EA7551D0B679A0021F650 = {
|
DA9EA7551D0B679A0021F650 = {
|
||||||
CreatedOnToolsVersion = 7.3;
|
CreatedOnToolsVersion = 7.3;
|
||||||
|
LastSwiftMigration = 1000;
|
||||||
};
|
};
|
||||||
DA9EA7C31D0EC45F0021F650 = {
|
DA9EA7C31D0EC45F0021F650 = {
|
||||||
CreatedOnToolsVersion = 7.3;
|
CreatedOnToolsVersion = 7.3;
|
||||||
|
LastSwiftMigration = 1000;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -190,6 +213,7 @@
|
||||||
developmentRegion = English;
|
developmentRegion = English;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
|
English,
|
||||||
en,
|
en,
|
||||||
);
|
);
|
||||||
mainGroup = DA9EA74C1D0B679A0021F650;
|
mainGroup = DA9EA74C1D0B679A0021F650;
|
||||||
|
|
@ -225,15 +249,22 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
3201E78A21BE9ED4001DF9E7 /* ExpandableCellViewModel.swift in Sources */,
|
||||||
|
50CF6E6B1D6704FE004746FF /* TableCellRegisterer.swift in Sources */,
|
||||||
DA9EA7AF1D0EC2C90021F650 /* ConfigurableCell.swift in Sources */,
|
DA9EA7AF1D0EC2C90021F650 /* ConfigurableCell.swift in Sources */,
|
||||||
DA9EA7B31D0EC2C90021F650 /* TableDirector.swift in Sources */,
|
DA9EA7B31D0EC2C90021F650 /* TableDirector.swift in Sources */,
|
||||||
|
3201E78821BE9EB2001DF9E7 /* Expandable.swift in Sources */,
|
||||||
|
2CBFA2F521F692F100147B56 /* ExpandableState.swift in Sources */,
|
||||||
DA9EA7B71D0EC2C90021F650 /* TableSection.swift in Sources */,
|
DA9EA7B71D0EC2C90021F650 /* TableSection.swift in Sources */,
|
||||||
DA9EA7B01D0EC2C90021F650 /* HeightStrategy.swift in Sources */,
|
DA9EA7B01D0EC2C90021F650 /* TablePrototypeCellHeightCalculator.swift in Sources */,
|
||||||
|
3201E78421BE9DE1001DF9E7 /* ExpandableCellHeightCalculator.swift in Sources */,
|
||||||
DA9EA7B51D0EC2C90021F650 /* TableRowAction.swift in Sources */,
|
DA9EA7B51D0EC2C90021F650 /* TableRowAction.swift in Sources */,
|
||||||
DA9EA7B21D0EC2C90021F650 /* TableCellAction.swift in Sources */,
|
DA9EA7B21D0EC2C90021F650 /* TableCellAction.swift in Sources */,
|
||||||
|
32BDFE9F21C167F400D0BBB4 /* LayoutType.swift in Sources */,
|
||||||
|
3201E78621BE9E25001DF9E7 /* UITableViewCell+Extensions.swift in Sources */,
|
||||||
DA9EA7B11D0EC2C90021F650 /* Operators.swift in Sources */,
|
DA9EA7B11D0EC2C90021F650 /* Operators.swift in Sources */,
|
||||||
DA9EA7B41D0EC2C90021F650 /* TableRow.swift in Sources */,
|
DA9EA7B41D0EC2C90021F650 /* TableRow.swift in Sources */,
|
||||||
DA9EA7B61D0EC2C90021F650 /* TableRowBuilder.swift in Sources */,
|
50E858581DB153F500A9AA55 /* TableKit.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -265,13 +296,23 @@
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
|
|
@ -299,6 +340,7 @@
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
|
|
@ -314,13 +356,23 @@
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
|
|
@ -340,6 +392,8 @@
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
|
@ -351,6 +405,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
|
@ -363,6 +418,7 @@
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
@ -370,6 +426,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
|
@ -381,6 +438,7 @@
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit;
|
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
@ -392,6 +450,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
@ -403,6 +462,7 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKitTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
@ -434,6 +494,7 @@
|
||||||
DA9EA7CE1D0EC45F0021F650 /* Release */,
|
DA9EA7CE1D0EC45F0021F650 /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0730"
|
LastUpgradeVersion = "1000"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
@ -28,7 +28,26 @@
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
|
<TestableReference
|
||||||
|
skipped = "NO">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "DA9EA7C31D0EC45F0021F650"
|
||||||
|
BuildableName = "TableKitTests.xctest"
|
||||||
|
BlueprintName = "TableKitTests"
|
||||||
|
ReferencedContainer = "container:TableKit.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "DA9EA7551D0B679A0021F650"
|
||||||
|
BuildableName = "TableKit.framework"
|
||||||
|
BlueprintName = "TableKit"
|
||||||
|
ReferencedContainer = "container:TableKit.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
<AdditionalOptions>
|
||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
|
|
|
||||||
|
|
@ -42,31 +42,31 @@ struct TestTableViewCellOptions {
|
||||||
static let CellAction: String = "CellAction"
|
static let CellAction: String = "CellAction"
|
||||||
static let CellActionUserInfoKey: String = "CellActionUserInfoKey"
|
static let CellActionUserInfoKey: String = "CellActionUserInfoKey"
|
||||||
static let CellActionUserInfoValue: String = "CellActionUserInfoValue"
|
static let CellActionUserInfoValue: String = "CellActionUserInfoValue"
|
||||||
static let EstimatedHeight: Float = 255
|
static let EstimatedHeight: CGFloat = 255
|
||||||
}
|
}
|
||||||
|
|
||||||
/*class TestTableViewCell: UITableViewCell, ConfigurableCell {
|
class TestTableViewCell: UITableViewCell, ConfigurableCell {
|
||||||
|
|
||||||
typealias T = TestData
|
typealias T = TestData
|
||||||
|
|
||||||
static func reusableIdentifier() -> String {
|
static var estimatedHeight: CGFloat? {
|
||||||
return TestTableViewCellOptions.ReusableIdentifier
|
|
||||||
}
|
|
||||||
|
|
||||||
static func estimatedHeight() -> Float {
|
|
||||||
return TestTableViewCellOptions.EstimatedHeight
|
return TestTableViewCellOptions.EstimatedHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(item: T) {
|
static var reuseIdentifier: String {
|
||||||
|
return TestTableViewCellOptions.ReusableIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
|
func configure(with item: T) {
|
||||||
textLabel?.text = item.title
|
textLabel?.text = item.title
|
||||||
}
|
}
|
||||||
|
|
||||||
func raiseAction() {
|
func raiseAction() {
|
||||||
Action(key: TestTableViewCellOptions.CellAction, sender: self, userInfo: [TestTableViewCellOptions.CellActionUserInfoKey: TestTableViewCellOptions.CellActionUserInfoValue]).invoke()
|
TableCellAction(key: TestTableViewCellOptions.CellAction, sender: self, userInfo: nil).invoke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TabletTests: XCTestCase {
|
class TableKitTests: XCTestCase {
|
||||||
|
|
||||||
var testController: TestController!
|
var testController: TestController!
|
||||||
|
|
||||||
|
|
@ -74,6 +74,10 @@ class TabletTests: XCTestCase {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
|
|
||||||
testController = TestController()
|
testController = TestController()
|
||||||
|
testController.tableView.frame = UIScreen.main.bounds
|
||||||
|
testController.tableView.isHidden = false
|
||||||
|
testController.tableView.setNeedsLayout()
|
||||||
|
testController.tableView.layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tearDown() {
|
override func tearDown() {
|
||||||
|
|
@ -89,82 +93,76 @@ class TabletTests: XCTestCase {
|
||||||
XCTAssertNotNil(testController.tableDirector.tableView, "TableDirector should have table view")
|
XCTAssertNotNil(testController.tableDirector.tableView, "TableDirector should have table view")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSimpleRowBuilderCreatesRowsAndSection() {
|
func testRowInSection() {
|
||||||
|
|
||||||
let source = ["1", "2", "3"]
|
let data = TestData(title: "title")
|
||||||
|
|
||||||
let rows = TableBaseRowBuilder<String, UITableViewCell>(items: source)
|
let row = TableRow<TestTableViewCell>(item: data)
|
||||||
.action(.configure) { data -> Void in
|
|
||||||
|
|
||||||
XCTAssertNotNil(data.cell, "Action should have a cell")
|
testController.tableDirector += row
|
||||||
data.cell?.textLabel?.text = "\(data.item)"
|
testController.tableView.reloadData()
|
||||||
}
|
|
||||||
|
XCTAssertTrue(testController.tableView.dataSource?.numberOfSections?(in: testController.tableView) == 1, "Table view should have a section")
|
||||||
|
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == 1, "Table view should have certain number of rows in a section")
|
||||||
|
|
||||||
|
let cell = testController.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? TestTableViewCell
|
||||||
|
XCTAssertNotNil(cell)
|
||||||
|
XCTAssertTrue(cell?.textLabel?.text == data.title)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testManyRowsInSection() {
|
||||||
|
|
||||||
|
let data = [TestData(title: "1"), TestData(title: "2"), TestData(title: "3")]
|
||||||
|
|
||||||
|
let rows: [Row] = data.map({ TableRow<TestTableViewCell>(item: $0) })
|
||||||
|
|
||||||
testController.view.hidden = false
|
|
||||||
testController.tableDirector += rows
|
testController.tableDirector += rows
|
||||||
testController.tableView.reloadData()
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.numberOfSectionsInTableView?(testController.tableView) == 1, "Table view should have a section")
|
XCTAssertTrue(testController.tableView.dataSource?.numberOfSections?(in: testController.tableView) == 1, "Table view should have a section")
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == source.count, "Table view should have certain number of rows in a section")
|
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == data.count, "Table view should have certain number of rows in a section")
|
||||||
|
|
||||||
for (index, element) in source.enumerate() {
|
for (index, element) in data.enumerated() {
|
||||||
|
|
||||||
let cell = testController.tableView.cellForRowAtIndexPath(NSIndexPath(forRow: index, inSection: 0))
|
|
||||||
|
|
||||||
|
let cell = testController.tableView.cellForRow(at: IndexPath(row: index, section: 0)) as? TestTableViewCell
|
||||||
XCTAssertNotNil(cell)
|
XCTAssertNotNil(cell)
|
||||||
XCTAssertTrue(cell?.textLabel?.text == element)
|
XCTAssertTrue(cell?.textLabel?.text == element.title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testConfigurableRowBuilderCreatesRowsAndSection() {
|
func testTableSectionCreatesSectionWithHeaderAndFooterTitles() {
|
||||||
|
|
||||||
let testData = TestData(title: "title")
|
let row = TableRow<TestTableViewCell>(item: TestData(title: "title"))
|
||||||
|
|
||||||
testController.view.hidden = false
|
|
||||||
testController.tableDirector += TableRowBuilder<TestData, TestTableViewCell>(item: testData)
|
|
||||||
testController.tableView.reloadData()
|
|
||||||
|
|
||||||
let cell = testController.tableView.cellForRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 0)) as? TestTableViewCell
|
|
||||||
|
|
||||||
XCTAssertNotNil(cell, "Cell should exists and should be TestTableViewCell")
|
|
||||||
XCTAssertTrue(cell?.textLabel?.text == testData.title, "Cell's textLabel.text should equal to testData's title")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testSectionBuilderCreatesSectionWithHeaderAndFooterTitles() {
|
|
||||||
|
|
||||||
let row = TableRowBuilder<TestData, TestTableViewCell>(items: [TestData(title: "title")])
|
|
||||||
|
|
||||||
let sectionHeaderTitle = "Header Title"
|
let sectionHeaderTitle = "Header Title"
|
||||||
let sectionFooterTitle = "Footer Title"
|
let sectionFooterTitle = "Footer Title"
|
||||||
|
|
||||||
let section = TableSectionBuilder(headerTitle: sectionHeaderTitle, footerTitle: sectionFooterTitle, rows: [row])
|
let section = TableSection(headerTitle: sectionHeaderTitle, footerTitle: sectionFooterTitle, rows: [row])
|
||||||
|
|
||||||
testController.view.hidden = false
|
|
||||||
testController.tableDirector += section
|
testController.tableDirector += section
|
||||||
testController.tableView.reloadData()
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.numberOfSectionsInTableView?(testController.tableView) == 1, "Table view should have a section")
|
XCTAssertTrue(testController.tableView.dataSource?.numberOfSections?(in: testController.tableView) == 1, "Table view should have a section")
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == 1, "Table view should have certain number of rows in a section")
|
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == 1, "Table view should have certain number of rows in a section")
|
||||||
|
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.tableView?(testController.tableView, titleForHeaderInSection: 0) == sectionHeaderTitle)
|
XCTAssertTrue(testController.tableView.dataSource?.tableView?(testController.tableView, titleForHeaderInSection: 0) == sectionHeaderTitle)
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.tableView?(testController.tableView, titleForFooterInSection: 0) == sectionFooterTitle)
|
XCTAssertTrue(testController.tableView.dataSource?.tableView?(testController.tableView, titleForFooterInSection: 0) == sectionFooterTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSectionBuilderCreatesSectionWithHeaderAndFooterViews() {
|
func testTableSectionCreatesSectionWithHeaderAndFooterViews() {
|
||||||
|
|
||||||
let row = TableRowBuilder<TestData, TestTableViewCell>(items: [TestData(title: "title")])
|
let row = TableRow<TestTableViewCell>(item: TestData(title: "title"))
|
||||||
|
|
||||||
let sectionHeaderView = UIView()
|
let sectionHeaderView = UIView()
|
||||||
let sectionFooterView = UIView()
|
let sectionFooterView = UIView()
|
||||||
|
|
||||||
let section = TableSectionBuilder(headerView: sectionHeaderView, footerView: sectionFooterView, rows: nil)
|
let section = TableSection(headerView: sectionHeaderView, footerView: sectionFooterView, rows: nil)
|
||||||
section += row
|
section += row
|
||||||
|
|
||||||
testController.view.hidden = false
|
|
||||||
testController.tableDirector += section
|
testController.tableDirector += section
|
||||||
testController.tableView.reloadData()
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.numberOfSectionsInTableView?(testController.tableView) == 1, "Table view should have a section")
|
XCTAssertTrue(testController.tableView.dataSource?.numberOfSections?(in: testController.tableView) == 1, "Table view should have a section")
|
||||||
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == 1, "Table view should have certain number of rows in a section")
|
XCTAssertTrue(testController.tableView.dataSource?.tableView(testController.tableView, numberOfRowsInSection: 0) == 1, "Table view should have certain number of rows in a section")
|
||||||
|
|
||||||
XCTAssertTrue(testController.tableView.delegate?.tableView?(testController.tableView, viewForHeaderInSection: 0) == sectionHeaderView)
|
XCTAssertTrue(testController.tableView.delegate?.tableView?(testController.tableView, viewForHeaderInSection: 0) == sectionHeaderView)
|
||||||
|
|
@ -173,28 +171,75 @@ class TabletTests: XCTestCase {
|
||||||
|
|
||||||
func testRowBuilderCustomActionInvokedAndSentUserInfo() {
|
func testRowBuilderCustomActionInvokedAndSentUserInfo() {
|
||||||
|
|
||||||
let expectation = expectationWithDescription("cell action")
|
let expectation = self.expectation(description: "cell action")
|
||||||
|
|
||||||
let row = TableRowBuilder<TestData, TestTableViewCell>(items: [TestData(title: "title")])
|
let row = TableRow<TestTableViewCell>(item: TestData(title: "title"))
|
||||||
.action(TestTableViewCellOptions.CellAction) { data -> Void in
|
.on(TableRowAction(.custom(TestTableViewCellOptions.CellAction)) { (data) in
|
||||||
|
|
||||||
XCTAssertNotNil(data.cell, "Action data should have a cell")
|
XCTAssertNotNil(data.cell, "Action data should have a cell")
|
||||||
XCTAssertNotNil(data.userInfo, "Action data should have a user info dictionary")
|
|
||||||
XCTAssertTrue(data.userInfo?[TestTableViewCellOptions.CellActionUserInfoKey] as? String == TestTableViewCellOptions.CellActionUserInfoValue, "UserInfo should have correct value for key")
|
|
||||||
|
|
||||||
expectation.fulfill()
|
expectation.fulfill()
|
||||||
}
|
})
|
||||||
|
|
||||||
testController.view.hidden = false
|
testController.view.isHidden = false
|
||||||
testController.tableDirector += row
|
testController.tableDirector += row
|
||||||
testController.tableView.reloadData()
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
let cell = testController.tableView.cellForRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 0)) as? TestTableViewCell
|
let cell = testController.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? TestTableViewCell
|
||||||
|
|
||||||
XCTAssertNotNil(cell, "Cell should exists and should be TestTableViewCell")
|
XCTAssertNotNil(cell, "Cell should exists and should be TestTableViewCell")
|
||||||
|
|
||||||
cell?.raiseAction()
|
cell?.raiseAction()
|
||||||
|
|
||||||
waitForExpectationsWithTimeout(1.0, handler: nil)
|
waitForExpectations(timeout: 1.0, handler: nil)
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
func testReplaceSectionOnExistingIndex() {
|
||||||
|
|
||||||
|
let row1 = TableRow<TestTableViewCell>(item: TestData(title: "title1"))
|
||||||
|
let row2 = TableRow<TestTableViewCell>(item: TestData(title: "title2"))
|
||||||
|
|
||||||
|
let section1 = TableSection(headerView: nil, footerView: nil, rows: nil)
|
||||||
|
section1 += row1
|
||||||
|
|
||||||
|
let section2 = TableSection(headerView: nil, footerView: nil, rows: nil)
|
||||||
|
section2 += row2
|
||||||
|
|
||||||
|
testController.tableDirector += section1
|
||||||
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
|
let cell = testController.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? TestTableViewCell
|
||||||
|
XCTAssertTrue(cell?.textLabel?.text == "title1")
|
||||||
|
|
||||||
|
testController.tableDirector.replaceSection(at: 0, with: section2)
|
||||||
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
|
let cell1 = testController.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? TestTableViewCell
|
||||||
|
XCTAssertTrue(cell1?.textLabel?.text == "title2")
|
||||||
|
}
|
||||||
|
|
||||||
|
func testReplaceSectionOnWrongIndex() {
|
||||||
|
|
||||||
|
let row1 = TableRow<TestTableViewCell>(item: TestData(title: "title1"))
|
||||||
|
let row2 = TableRow<TestTableViewCell>(item: TestData(title: "title2"))
|
||||||
|
|
||||||
|
let section1 = TableSection(headerView: nil, footerView: nil, rows: nil)
|
||||||
|
section1 += row1
|
||||||
|
|
||||||
|
let section2 = TableSection(headerView: nil, footerView: nil, rows: nil)
|
||||||
|
section2 += row2
|
||||||
|
|
||||||
|
testController.tableDirector += section1
|
||||||
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
|
let cell = testController.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? TestTableViewCell
|
||||||
|
XCTAssertTrue(cell?.textLabel?.text == "title1")
|
||||||
|
|
||||||
|
testController.tableDirector.replaceSection(at: 33, with: section2)
|
||||||
|
testController.tableView.reloadData()
|
||||||
|
|
||||||
|
let cell1 = testController.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? TestTableViewCell
|
||||||
|
XCTAssertTrue(cell1?.textLabel?.text == "title1")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue