diff --git a/.travis.yml b/.travis.yml index 99f321d..f57eb70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ before_install: - brew reinstall --HEAD xctool - cd Tablet script: - - xctool clean build test -project Tablet.xcodeproj -scheme Tablet -sdk iphonesimulator \ No newline at end of file + - xctool clean build test -project TableKit.xcodeproj -scheme TableKit -sdk iphonesimulator \ No newline at end of file diff --git a/README.md b/README.md index c543553..a4b452c 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,14 @@ -![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/maxsokolov/tablet/assets/logo.png) - -#Tablet.swift +#TableKit

-Build Status +Build Status Swift 2.2 compatible Platform iOS -CocoaPods compatible -License: MIT +CocoaPods compatible +License: MIT

-Tablet is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of `switch` or `if` statements when you deal with bunch of different cells in different sections. +TableKit is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of `switch` or `if` statements when you deal with bunch of different cells in different sections. ## Features @@ -24,178 +22,7 @@ Tablet is a super lightweight yet powerful generic library that handles a comple - [x] Extensibility - [x] Tests -That's almost all you need to build a bunch of cells in a section: -```swift -let builder = TableRowBuilder(items: ["1", "2", "3", "4", "5"]) -``` -Tablet relies on self-sizing table view cells, respects cells reusability feature and also built with performace in mind. You don't have to worry about anything, just create your cells, setup autolayout constraints and be happy. See the Usage section to learn more. - -## Requirements - -- iOS 8.0+ -- Xcode 7.0+ -- Swift 2.2 - -## Installation - -### CocoaPods -To integrate Tablet into your Xcode project using CocoaPods, specify it in your `Podfile`: - -```ruby -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '8.0' -use_frameworks! - -pod 'Tablet' -``` - -Then, run the following command: - -```bash -$ pod install -``` - -## Usage - -### Type-safe configurable cells - -Let's say you want to put your cell configuration logic into cell itself. Say you want to pass your view model (or even model) to your cell. -You could easily do this using the `TableRowBuilder`. Your cell should conforms to `ConfigurableCell` protocol as you may see in example below: - -```swift -import Tablet - -class MyTableViewCell : UITableViewCell, ConfigurableCell { - - typealias T = User - - // this method is not required to be implemented if your cell's id equals to class name - static func reusableIdentifier() -> String { - return "reusable_id" - } - - static func estimatedHeight() -> Float { - return 255 - } - - func configure(item: T) { // item is user here - - textLabel?.text = item.username - detailTextLabel?.text = item.isActive ? "Active" : "Inactive" - } -} -``` -Once you've implemented the protocol, simply use the `TableRowBuilder` to build cells: - -```swift -import Tablet - -let rowBuilder = TableRowBuilder() -rowBuilder += users - -director = TableDirector(tableView: tableView) -tableDirector += TableSectionBuilder(rows: [rowBuilder]) -``` - -### Very basic table view - -You may want to setup a very basic table view, without any custom cells. In that case simply use the `TableBaseRowBuilder`. - -```swift -import Tablet - -let rowBuilder = TableBaseRowBuilder(items: [user1, user2, user3], id: "reusable_id") - .action(.configure) { (data) in - - data.cell?.textLabel?.text = data.item.username - data.cell?.detailTextLabel?.text = data.item.isActive ? "Active" : "Inactive" - } - -let sectionBuilder = TableSectionBuilder(headerTitle: "Users", footerTitle: nil, rows: [rowBuilder]) - -director = TableDirector(tableView: tableView) -director += sectionBuilder -``` - -### Cell actions - -Tablet provides a chaining approach to handle actions from your cells: - -```swift -import Tablet - -let rowBuilder = TableRowBuilder(items: [user1, user2, user3], id: "reusable_id") - .action(.configure) { (data) in - - } - .action(.click) { (data) in - - } - .valueAction(.shouldHighlight) { (data) in - - return false - } -``` - -### Custom cell actions -```swift -import Tablet - -struct MyCellActions { - static let ButtonClicked = "ButtonClicked" -} - -class MyTableViewCell : UITableViewCell { - - @IBAction func buttonClicked(sender: UIButton) { - - Action(key: MyCellActions.ButtonClicked, sender: self, userInfo: nil).invoke() - } -} -``` -And receive this actions with your row builder: -```swift -import Tablet - -let rowBuilder = TableRowBuilder(items: users) - .action(.click) { (data) in - - } - .action(.willDisplay) { (data) in - - } - .action(MyCellActions.ButtonClicked) { (data) in - - } -``` - -## Extensibility - -If you find that Tablet is not provide an action you need, for example you need UITableViewDelegate's `didEndDisplayingCell` method and it's not out of the box, -simply provide an extension for `TableDirector`: -```swift -import Tablet - -struct MyTableActions { - static let DidEndDisplayingCell = "DidEndDisplayingCell" -} - -extension TableDirector { - - public func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { - - invoke(action: .custom(MyTableActions.DidEndDisplayingCell), cell: cell, indexPath: indexPath) - } -} -``` -Catch your action with row builder: -```swift -let rowBuilder = TableRowBuilder(items: users) - .action(MyTableActions.DidEndDisplayingCell) { (data) -> Void in - - } -``` -You could also invoke an action that returns a value. +Docs will be updated soon. ## License diff --git a/Tablet.podspec b/TableKit.podspec similarity index 54% rename from Tablet.podspec rename to TableKit.podspec index c5be448..cdabc6c 100644 --- a/Tablet.podspec +++ b/TableKit.podspec @@ -1,17 +1,17 @@ Pod::Spec.new do |s| - s.name = 'Tablet' - s.module_name = 'Tablet' + s.name = 'TableKit' + s.module_name = 'TableKit' - s.version = '0.5.0' + s.version = '0.6.0' - s.homepage = 'https://github.com/maxsokolov/Tablet.swift' - s.summary = 'Powerful type-safe tool for UITableView. Swift 2.2 is required.' + s.homepage = 'https://github.com/maxsokolov/TableKit' + s.summary = 'Type-safe declarative table views. Swift 2.2 is required.' s.author = { 'Max Sokolov' => 'i@maxsokolov.net' } s.license = { :type => 'MIT', :file => 'LICENSE' } s.platforms = { :ios => '8.0' } s.ios.deployment_target = '8.0' - s.source_files = 'Tablet/*.swift' - s.source = { :git => 'https://github.com/maxsokolov/Tablet.swift.git', :tag => s.version } + s.source_files = 'TableKit/*.swift' + s.source = { :git => 'https://github.com/maxsokolov/TableKit.git', :tag => s.version } end \ No newline at end of file diff --git a/Tablet.xcworkspace/contents.xcworkspacedata b/TableKit.xcworkspace/contents.xcworkspacedata similarity index 53% rename from Tablet.xcworkspace/contents.xcworkspacedata rename to TableKit.xcworkspace/contents.xcworkspacedata index 8a2fad4..134624f 100644 --- a/Tablet.xcworkspace/contents.xcworkspacedata +++ b/TableKit.xcworkspace/contents.xcworkspacedata @@ -2,9 +2,9 @@ + location = "group:TableKit/TableKit.xcodeproj"> + location = "group:TableKitDemo/TableKitDemo.xcodeproj"> diff --git a/Tablet/Tablet.h b/TableKit/ConfigurableCell.swift similarity index 67% rename from Tablet/Tablet.h rename to TableKit/ConfigurableCell.swift index c09efa2..d3363b4 100644 --- a/Tablet/Tablet.h +++ b/TableKit/ConfigurableCell.swift @@ -18,7 +18,29 @@ // 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 Foundation; +import UIKit -FOUNDATION_EXPORT double TabletVersionNumber; -FOUNDATION_EXPORT const unsigned char TabletVersionString[]; \ No newline at end of file +public protocol ConfigurableCell { + + associatedtype T + + static func reusableIdentifier() -> String + static func estimatedHeight() -> CGFloat + static func defaultHeight() -> CGFloat? + func configure(_: T) +} + +public extension ConfigurableCell where Self: UITableViewCell { + + static func reusableIdentifier() -> String { + return String(self) + } + + static func estimatedHeight() -> CGFloat { + return UITableViewAutomaticDimension + } + + static func defaultHeight() -> CGFloat? { + return nil + } +} \ No newline at end of file diff --git a/TableKit/HeightStrategy.swift b/TableKit/HeightStrategy.swift new file mode 100644 index 0000000..c34bd40 --- /dev/null +++ b/TableKit/HeightStrategy.swift @@ -0,0 +1,48 @@ +// +// 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 HeightStrategy { + + var tableView: UITableView? { get set } + + func height(item: Item, indexPath: NSIndexPath, cell: Cell.Type) -> CGFloat +} + +public class PrototypeHeightStrategy: HeightStrategy { + + public weak var tableView: UITableView? + private var cachedHeights = [Int: CGFloat]() + + public func height(item: Item, indexPath: NSIndexPath, cell: Cell.Type) -> CGFloat { + + guard let cell = tableView?.dequeueReusableCellWithIdentifier(Cell.reusableIdentifier()) as? Cell else { return 0 } + + cell.bounds = CGRectMake(0, 0, tableView?.bounds.size.width ?? 0, cell.bounds.height) + + cell.configure(item) + + cell.setNeedsLayout() + cell.layoutIfNeeded() + + return cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height + 1 + } +} \ No newline at end of file diff --git a/Tablet/Info.plist b/TableKit/Info.plist similarity index 100% rename from Tablet/Info.plist rename to TableKit/Info.plist diff --git a/TableKit/Operators.swift b/TableKit/Operators.swift new file mode 100644 index 0000000..9dfb675 --- /dev/null +++ b/TableKit/Operators.swift @@ -0,0 +1,54 @@ +// +// Copyright (c) 2015 Max Sokolov https://twitter.com/max_sokolov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// - +/*public func +=(left: TableDirector, right: RowBuilder) { + left.append(section: TableSectionBuilder(rows: [right])) +} + +public func +=(left: TableDirector, right: [RowBuilder]) { + left.append(section: TableSectionBuilder(rows: right)) +} + +public func +=(left: TableDirector, right: TableSectionBuilder) { + left.append(section: right) +} + +public func +=(left: TableDirector, right: [TableSectionBuilder]) { + left.append(sections: right) +} + +// - +public func +=(left: TableRowBuilder, right: DataType) { + left.append(items: [right]) +} + +public func +=(left: TableRowBuilder, right: [DataType]) { + left.append(items: right) +} + +// - +public func +=(left: TableSectionBuilder, right: RowBuilder) { + left.append(row: right) +} + +public func +=(left: TableSectionBuilder, right: [RowBuilder]) { + left.append(rows: right) +}*/ \ No newline at end of file diff --git a/Tablet/TableDirector.swift b/TableKit/TableDirector.swift similarity index 71% rename from Tablet/TableDirector.swift rename to TableKit/TableDirector.swift index b79f730..e77a671 100644 --- a/Tablet/TableDirector.swift +++ b/TableKit/TableDirector.swift @@ -19,23 +19,23 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import UIKit -import Foundation /** Responsible for table view's datasource and delegate. */ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { - public unowned let tableView: UITableView - public weak var scrollDelegate: UIScrollViewDelegate? - private var sections = [TableSectionBuilder]() + public private(set) weak var tableView: UITableView? + private weak var scrollDelegate: UIScrollViewDelegate? + public private(set) var sections = [TableSection]() - public init(tableView: UITableView) { - - self.tableView = tableView + public init(tableView: UITableView, scrollDelegate: UIScrollViewDelegate? = nil) { super.init() - self.tableView.delegate = self - self.tableView.dataSource = self + + self.scrollDelegate = scrollDelegate + self.tableView = tableView + self.tableView?.delegate = self + self.tableView?.dataSource = self NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(didReceiveAction), name: TabletNotifications.CellAction, object: nil) } @@ -43,27 +43,15 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate deinit { NSNotificationCenter.defaultCenter().removeObserver(self) } - - // MARK: Private methods - /** - Find a row builder that responsible for building a row from cell with given item type. - - - Parameters: - - indexPath: path of cell to dequeue - - - Returns: A touple - (builder, builderItemIndex) - */ - private func builderAtIndexPath(indexPath: NSIndexPath) -> (RowBuilder, Int) { - return sections[indexPath.section].builderAtIndex(indexPath.row)! + public func reload() { + tableView?.reloadData() } - + // MARK: Public - public func invoke(action action: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath) -> AnyObject? { - - let builder = builderAtIndexPath(indexPath) - return builder.0.invoke(action: action, cell: cell, indexPath: indexPath, itemIndex: builder.1, userInfo: nil) + public func invoke(action action: TableRowActionType, cell: UITableViewCell?, indexPath: NSIndexPath) -> Any? { + return sections[indexPath.section].items[indexPath.row].invoke(action, cell: cell, path: indexPath) } public override func respondsToSelector(selector: Selector) -> Bool { @@ -78,13 +66,23 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate func didReceiveAction(notification: NSNotification) { - if let action = notification.object as? Action, indexPath = tableView.indexPathForCell(action.cell) { + if let action = notification.object as? Action, indexPath = tableView?.indexPathForCell(action.cell) { - let builder = builderAtIndexPath(indexPath) - builder.0.invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath, itemIndex: builder.1, userInfo: notification.userInfo) + //let builder = builderAtIndexPath(indexPath) + //builder.0.invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath, itemIndex: builder.1, userInfo: notification.userInfo) } } + // MARK: - Height + + public func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { + return sections[indexPath.section].items[indexPath.row].estimatedHeight + } + + public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { + return sections[indexPath.section].items[indexPath.row].defaultHeight + } + // MARK: UITableViewDataSource - configuration public func numberOfSectionsInTableView(tableView: UITableView) -> Int { @@ -92,22 +90,21 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate } public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return sections[section].numberOfRowsInSection + return sections[section].numberOfRows } public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - - let builder = builderAtIndexPath(indexPath) - - let cell = tableView.dequeueReusableCellWithIdentifier(builder.0.reusableIdentifier, forIndexPath: indexPath) + + let row = sections[indexPath.section].items[indexPath.row] + let cell = tableView.dequeueReusableCellWithIdentifier(row.reusableIdentifier, forIndexPath: indexPath) if cell.frame.size.width != tableView.frame.size.width { cell.frame = CGRectMake(0, 0, tableView.frame.size.width, cell.frame.size.height) cell.layoutIfNeeded() } - - builder.0.invoke(action: .configure, cell: cell, indexPath: indexPath, itemIndex: builder.1, userInfo: nil) - + + row.configure(cell) + return cell } @@ -141,14 +138,6 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate // MARK: UITableViewDelegate - actions - public func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { - return CGFloat(builderAtIndexPath(indexPath).0.estimatedRowHeight) - } - - public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { - return invoke(action: .height, cell: nil, indexPath: indexPath) as? CGFloat ?? UITableViewAutomaticDimension - } - public func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let cell = tableView.cellForRowAtIndexPath(indexPath) @@ -179,11 +168,11 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate // MARK: - Sections manipulation - - public func append(section section: TableSectionBuilder) { + public func append(section section: TableSection) { append(sections: [section]) } - public func append(sections sections: [TableSectionBuilder]) { + public func append(sections sections: [TableSection]) { sections.forEach { $0.tableDirector = self } self.sections.appendContentsOf(sections) @@ -192,20 +181,4 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate public func clear() { sections.removeAll() } -} - -public func +=(left: TableDirector, right: RowBuilder) { - left.append(section: TableSectionBuilder(rows: [right])) -} - -public func +=(left: TableDirector, right: [RowBuilder]) { - left.append(section: TableSectionBuilder(rows: right)) -} - -public func +=(left: TableDirector, right: TableSectionBuilder) { - left.append(section: right) -} - -public func +=(left: TableDirector, right: [TableSectionBuilder]) { - left.append(sections: right) } \ No newline at end of file diff --git a/TableKit/TableKit.h b/TableKit/TableKit.h new file mode 100644 index 0000000..c63484c --- /dev/null +++ b/TableKit/TableKit.h @@ -0,0 +1,19 @@ +// +// TableKit.h +// TableKit +// +// Created by Max Sokolov on 11/06/16. +// Copyright © 2016 Max Sokolov. All rights reserved. +// + +#import + +//! Project version number for TableKit. +FOUNDATION_EXPORT double TableKitVersionNumber; + +//! Project version string for TableKit. +FOUNDATION_EXPORT const unsigned char TableKitVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/TableKit/TableKit.xcodeproj/project.pbxproj b/TableKit/TableKit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..bf9dc87 --- /dev/null +++ b/TableKit/TableKit.xcodeproj/project.pbxproj @@ -0,0 +1,335 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + DA9EA7711D0B68460021F650 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */; }; + DA9EA7721D0B68460021F650 /* HeightStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7691D0B68460021F650 /* HeightStrategy.swift */; }; + DA9EA7731D0B68460021F650 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76A1D0B68460021F650 /* Operators.swift */; }; + DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76B1D0B68460021F650 /* TableDirector.swift */; }; + DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76C1D0B68460021F650 /* TableRow.swift */; }; + DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76D1D0B68460021F650 /* TableRowAction.swift */; }; + DA9EA7771D0B68460021F650 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76E1D0B68460021F650 /* TableRowBuilder.swift */; }; + DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA76F1D0B68460021F650 /* TableSection.swift */; }; + DA9EA7791D0B68460021F650 /* Tablet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9EA7701D0B68460021F650 /* Tablet.swift */; }; + DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA77E1D0B689C0021F650 /* TableKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DA9EA7561D0B679A0021F650 /* TableKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TableKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = ""; }; + DA9EA7691D0B68460021F650 /* HeightStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightStrategy.swift; sourceTree = ""; }; + DA9EA76A1D0B68460021F650 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = ""; }; + DA9EA76B1D0B68460021F650 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = ""; }; + DA9EA76C1D0B68460021F650 /* TableRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRow.swift; sourceTree = ""; }; + DA9EA76D1D0B68460021F650 /* TableRowAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowAction.swift; sourceTree = ""; }; + DA9EA76E1D0B68460021F650 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = ""; }; + DA9EA76F1D0B68460021F650 /* TableSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSection.swift; sourceTree = ""; }; + DA9EA7701D0B68460021F650 /* Tablet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tablet.swift; sourceTree = ""; }; + DA9EA77D1D0B689C0021F650 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DA9EA77E1D0B689C0021F650 /* TableKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableKit.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DA9EA7521D0B679A0021F650 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DA9EA74C1D0B679A0021F650 = { + isa = PBXGroup; + children = ( + DA9EA7671D0B68340021F650 /* Classes */, + DA9EA7571D0B679A0021F650 /* Products */, + DA9EA77C1D0B68860021F650 /* Supporting Files */, + ); + sourceTree = ""; + }; + DA9EA7571D0B679A0021F650 /* Products */ = { + isa = PBXGroup; + children = ( + DA9EA7561D0B679A0021F650 /* TableKit.framework */, + ); + name = Products; + sourceTree = ""; + }; + DA9EA7671D0B68340021F650 /* Classes */ = { + isa = PBXGroup; + children = ( + DA9EA7681D0B68460021F650 /* ConfigurableCell.swift */, + DA9EA7691D0B68460021F650 /* HeightStrategy.swift */, + DA9EA76A1D0B68460021F650 /* Operators.swift */, + DA9EA76B1D0B68460021F650 /* TableDirector.swift */, + DA9EA76C1D0B68460021F650 /* TableRow.swift */, + DA9EA76D1D0B68460021F650 /* TableRowAction.swift */, + DA9EA76E1D0B68460021F650 /* TableRowBuilder.swift */, + DA9EA76F1D0B68460021F650 /* TableSection.swift */, + DA9EA7701D0B68460021F650 /* Tablet.swift */, + ); + name = Classes; + sourceTree = ""; + }; + DA9EA77C1D0B68860021F650 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + DA9EA77D1D0B689C0021F650 /* Info.plist */, + DA9EA77E1D0B689C0021F650 /* TableKit.h */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + DA9EA7531D0B679A0021F650 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + DA9EA7801D0B689C0021F650 /* TableKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + DA9EA7551D0B679A0021F650 /* TableKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = DA9EA75E1D0B679A0021F650 /* Build configuration list for PBXNativeTarget "TableKit" */; + buildPhases = ( + DA9EA7511D0B679A0021F650 /* Sources */, + DA9EA7521D0B679A0021F650 /* Frameworks */, + DA9EA7531D0B679A0021F650 /* Headers */, + DA9EA7541D0B679A0021F650 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TableKit; + productName = TableKit; + productReference = DA9EA7561D0B679A0021F650 /* TableKit.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DA9EA74D1D0B679A0021F650 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0730; + ORGANIZATIONNAME = "Max Sokolov"; + TargetAttributes = { + DA9EA7551D0B679A0021F650 = { + CreatedOnToolsVersion = 7.3; + }; + }; + }; + buildConfigurationList = DA9EA7501D0B679A0021F650 /* Build configuration list for PBXProject "TableKit" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = DA9EA74C1D0B679A0021F650; + productRefGroup = DA9EA7571D0B679A0021F650 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DA9EA7551D0B679A0021F650 /* TableKit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DA9EA7541D0B679A0021F650 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DA9EA7511D0B679A0021F650 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DA9EA7711D0B68460021F650 /* ConfigurableCell.swift in Sources */, + DA9EA7721D0B68460021F650 /* HeightStrategy.swift in Sources */, + DA9EA7781D0B68460021F650 /* TableSection.swift in Sources */, + DA9EA7751D0B68460021F650 /* TableRow.swift in Sources */, + DA9EA7761D0B68460021F650 /* TableRowAction.swift in Sources */, + DA9EA7741D0B68460021F650 /* TableDirector.swift in Sources */, + DA9EA7771D0B68460021F650 /* TableRowBuilder.swift in Sources */, + DA9EA7791D0B68460021F650 /* Tablet.swift in Sources */, + DA9EA7731D0B68460021F650 /* Operators.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + DA9EA75C1D0B679A0021F650 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + DA9EA75D1D0B679A0021F650 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + DA9EA75F1D0B679A0021F650 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DA9EA7601D0B679A0021F650 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DA9EA7501D0B679A0021F650 /* Build configuration list for PBXProject "TableKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DA9EA75C1D0B679A0021F650 /* Debug */, + DA9EA75D1D0B679A0021F650 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DA9EA75E1D0B679A0021F650 /* Build configuration list for PBXNativeTarget "TableKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DA9EA75F1D0B679A0021F650 /* Debug */, + DA9EA7601D0B679A0021F650 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = DA9EA74D1D0B679A0021F650 /* Project object */; +} diff --git a/TableKit/TableRow.swift b/TableKit/TableRow.swift new file mode 100644 index 0000000..620342a --- /dev/null +++ b/TableKit/TableRow.swift @@ -0,0 +1,85 @@ +// +// 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 RowConfigurable { + + func configure(cell: UITableViewCell) +} + +public protocol RowActionable { + + 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: Row { + + public let item: ItemType + private var actions = [String: RowAction]() + + public var reusableIdentifier: String { + return CellType.reusableIdentifier() + } + + public var estimatedHeight: CGFloat { + return CellType.estimatedHeight() + } + + public var defaultHeight: CGFloat { + return CellType.defaultHeight() ?? UITableViewAutomaticDimension + } + + public init(item: ItemType, actions: [TableRowAction]? = nil) { + self.item = item + } + + // MARK: - RowConfigurable - + + public func configure(cell: UITableViewCell) { + (cell as? CellType)?.configure(item) + } + + // MARK: - RowActionable - + + public func invoke(action: TableRowActionType, cell: UITableViewCell?, path: NSIndexPath) -> Any? { + return actions[action.key]?.invoke() + } + + public func hasAction(action: TableRowActionType) -> Bool { + return actions[action.key] != nil + } + + // MARK: - actions - + + public func action(action: TableRowAction) -> Self { + + actions[action.type.key] = action + return self + } +} \ No newline at end of file diff --git a/TableKit/TableRowAction.swift b/TableKit/TableRowAction.swift new file mode 100644 index 0000000..9c73c79 --- /dev/null +++ b/TableKit/TableRowAction.swift @@ -0,0 +1,68 @@ +// +// 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 enum TableRowActionType { + + case click + 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)" + } + } +} + +protocol RowAction { + + func invoke() -> Any? +} + +public class TableRowAction: RowAction { + + public let type: TableRowActionType + + public init(_ type: TableRowActionType, handler: (row: TableRow) -> Void) { + self.type = type + } + + public init(_ type: TableRowActionType, handler: (row: TableRow) -> T) { + self.type = type + } + + // MARK: - RowAction - + + func invoke() -> Any? { + return nil + } +} \ No newline at end of file diff --git a/Tablet/TableRowBuilder.swift b/TableKit/TableRowBuilder.swift similarity index 58% rename from Tablet/TableRowBuilder.swift rename to TableKit/TableRowBuilder.swift index 7c57528..be7777a 100644 --- a/Tablet/TableRowBuilder.swift +++ b/TableKit/TableRowBuilder.swift @@ -19,72 +19,64 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import UIKit -import Foundation public typealias ReturnValue = AnyObject? -enum ActionHandler { - - case Handler((data: ActionData) -> Void) - case ValueHandler((data: ActionData) -> AnyObject?) - - func invoke(data: ActionData) -> ReturnValue { - - switch (self) { - case .Handler(let handler): - handler(data: data) - return nil - case .ValueHandler(let handler): - return handler(data: data) - } - } -} - -public protocol RowBuilder { - - var reusableIdentifier: String { get } - var numberOfRows: Int { get } - var estimatedRowHeight: Float { get } - - func invoke(action action: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int, userInfo: [NSObject: AnyObject]?) -> AnyObject? - func registerCell(inTableView tableView: UITableView) -} - /** Responsible for building cells of given type and passing items to them. */ -public class TableBaseRowBuilder : RowBuilder { +/*public class TableRowBuilder : RowBuilder { + + public private(set) weak var tableDirector: TableDirector? + private var heightStrategy: HeightStrategy? private var actions = [String: ActionHandler]() private var items = [DataType]() - public let reusableIdentifier: String + public func reusableIdentifier(_: Int) -> String { + return CellType.reusableIdentifier() + } public var numberOfRows: Int { return items.count } - public var estimatedRowHeight: Float { - return 44 - } - - public init(item: DataType, id: String? = nil) { + // MARK: - Initializers - - reusableIdentifier = id ?? String(CellType) + public init(item: DataType) { items.append(item) } - public init(items: [DataType]? = nil, id: String? = nil) { - - reusableIdentifier = id ?? String(CellType) + public init(items: [DataType]? = nil) { if let items = items { self.items.appendContentsOf(items) } } + + // MARK: - RowHeightCalculatable - + + public func rowHeight(index: Int, indexPath: NSIndexPath) -> CGFloat { + return CellType.defaultHeight() ?? heightStrategy?.height(item(index: index), indexPath: indexPath, cell: CellType.self) ?? UITableViewAutomaticDimension + } + + public func estimatedRowHeight(index: Int, indexPath: NSIndexPath) -> CGFloat { + return CellType.estimatedHeight() + } + + // MARK: - RowConfigurable - + + public func configure(cell: UITableViewCell, path: NSIndexPath, index: Int) { + + (cell as? CellType)?.configure(items[index]) + } // MARK: - Chaining actions - + public func addAction(action: TableRowAction) { + + } + public func action(key: String, handler: (data: ActionData) -> Void) -> Self { actions[key] = .Handler(handler) @@ -105,15 +97,19 @@ public class TableBaseRowBuilder AnyObject? { + if case .configure = action { + (cell as? CellType)?.configure(item(index: itemIndex)) + } + if let action = actions[action.key] { return action.invoke(ActionData(cell: cell as? CellType, indexPath: indexPath, item: items[itemIndex], itemIndex: itemIndex, userInfo: userInfo)) } return nil } - - public func registerCell(inTableView tableView: UITableView) { + + private func registerCell(inTableView tableView: UITableView) { - if tableView.dequeueReusableCellWithIdentifier(reusableIdentifier) != nil { + if tableView.dequeueReusableCellWithIdentifier(reusableIdentifier(0)) != nil { return } @@ -121,14 +117,47 @@ public class TableBaseRowBuilder Self { + + return self + } + + public func insert(items: [DataType], atIndex index: Int, animated: UITableViewRowAnimation) -> Self { + + self.items.insertContentsOf(items, at: index) + + return self + } + + public func move(indexes: [Int], toIndexes: [Int]) -> Self { + + return self + } + + public func update(index index: Int, item: DataType, animated: UITableViewRowAnimation) -> Self { + + return self + } + + public func item(index index: Int) -> DataType { + return items[index] + } + public func append(items items: [DataType]) { self.items.appendContentsOf(items) } @@ -136,38 +165,4 @@ public class TableBaseRowBuilder : TableBaseRowBuilder { - - public override var estimatedRowHeight: Float { - return CellType.estimatedHeight() - } - - public init(item: DataType) { - super.init(item: item, id: CellType.reusableIdentifier()) - } - - public init(items: [DataType]? = nil) { - super.init(items: items, id: CellType.reusableIdentifier()) - } - - public override func invoke(action action: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int, userInfo: [NSObject: AnyObject]?) -> AnyObject? { - - if case .configure = action { - (cell as? CellType)?.configure(items[itemIndex]) - } - return super.invoke(action: action, cell: cell, indexPath: indexPath, itemIndex: itemIndex, userInfo: userInfo) - } -} - -public func +=(left: TableBaseRowBuilder, right: DataType) { - left.append(items: [right]) -} - -public func +=(left: TableBaseRowBuilder, right: [DataType]) { - left.append(items: right) -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/Tablet/TableSectionBuilder.swift b/TableKit/TableSection.swift similarity index 59% rename from Tablet/TableSectionBuilder.swift rename to TableKit/TableSection.swift index 546ae0d..9046fbc 100644 --- a/Tablet/TableSectionBuilder.swift +++ b/TableKit/TableSection.swift @@ -19,22 +19,16 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import UIKit -import Foundation /** Responsible for building a certain table view section. Can host several row builders. */ -public class TableSectionBuilder { - - weak var tableDirector: TableDirector? { - didSet { - guard let director = tableDirector else { return } - builders.forEach { $0.registerCell(inTableView: director.tableView) } - } - } +public class TableSection { - private var builders = [RowBuilder]() + weak var tableDirector: TableDirector? + + public private(set) var items = [Row]() public var headerTitle: String? public var footerTitle: String? @@ -43,25 +37,25 @@ public class TableSectionBuilder { public private(set) var footerView: UIView? /// A total number of rows in section of each row builder. - public var numberOfRowsInSection: Int { - return builders.reduce(0) { $0 + $1.numberOfRows } + public var numberOfRows: Int { + return items.count } - public init(rows: [RowBuilder]? = nil) { + public init(rows: [Row]? = nil) { if let initialRows = rows { - builders.appendContentsOf(initialRows) + items.appendContentsOf(initialRows) } } - public convenience init(headerTitle: String?, footerTitle: String?, rows: [RowBuilder]?) { + public convenience init(headerTitle: String?, footerTitle: String?, rows: [Row]?) { self.init(rows: rows) self.headerTitle = headerTitle self.footerTitle = footerTitle } - public convenience init(headerView: UIView?, footerView: UIView?, rows: [RowBuilder]?) { + public convenience init(headerView: UIView?, footerView: UIView?, rows: [Row]?) { self.init(rows: rows) self.headerView = headerView @@ -71,39 +65,16 @@ public class TableSectionBuilder { // MARK: - Public - public func clear() { - builders.removeAll() + items.removeAll() } - public func append(row row: RowBuilder) { + public func append(row row: Row) { append(rows: [row]) } - public func append(rows rows: [RowBuilder]) { + public func append(rows rows: [Row]) { - if let tableView = tableDirector?.tableView { rows.forEach { $0.registerCell(inTableView: tableView) } } - builders.appendContentsOf(rows) + //if let director = tableDirector { rows.forEach { $0.willUpdateDirector(director) } } + //builders.appendContentsOf(rows) } - - // MARK: - Internal - - - func builderAtIndex(index: Int) -> (RowBuilder, Int)? { - - var builderIndex = index - for builder in builders { - if builderIndex < builder.numberOfRows { - return (builder, builderIndex) - } - builderIndex -= builder.numberOfRows - } - - return nil - } -} - -public func +=(left: TableSectionBuilder, right: RowBuilder) { - left.append(row: right) -} - -public func +=(left: TableSectionBuilder, right: [RowBuilder]) { - left.append(rows: right) } \ No newline at end of file diff --git a/Tablet/Tablet.swift b/TableKit/Tablet.swift similarity index 72% rename from Tablet/Tablet.swift rename to TableKit/Tablet.swift index 46b8767..fb22bde 100644 --- a/Tablet/Tablet.swift +++ b/TableKit/Tablet.swift @@ -19,37 +19,11 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import UIKit -import Foundation struct TabletNotifications { static let CellAction = "TabletNotificationsCellAction" } -/** - The actions that Tablet provides. -*/ -public enum ActionType { - - case click - 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 ActionData { @@ -69,6 +43,7 @@ public class ActionData { } } + /** A custom action that you can trigger from your cell. You can eacily catch actions using a chaining manner with your row builder. @@ -94,24 +69,4 @@ public class Action { public func invoke() { NSNotificationCenter.defaultCenter().postNotificationName(TabletNotifications.CellAction, object: self, userInfo: userInfo) } -} - -/** - If you want to delegate your cell configuration logic to cell itself (with your view model or even model) than - just provide an implementation of this protocol for your cell. Enjoy safe-typisation. -*/ -public protocol ConfigurableCell { - - associatedtype T - - static func reusableIdentifier() -> String - static func estimatedHeight() -> Float - func configure(_: T) -} - -public extension ConfigurableCell where Self: UITableViewCell { - - static func reusableIdentifier() -> String { - return String(self) - } } \ No newline at end of file diff --git a/TabletDemo/Classes/Application/AppDelegate.swift b/TableKitDemo/Classes/Application/AppDelegate.swift similarity index 100% rename from TabletDemo/Classes/Application/AppDelegate.swift rename to TableKitDemo/Classes/Application/AppDelegate.swift diff --git a/TabletDemo/Classes/Presentation/Controllers/HeaderFooterController.swift b/TableKitDemo/Classes/Presentation/Controllers/HeaderFooterController.swift similarity index 57% rename from TabletDemo/Classes/Presentation/Controllers/HeaderFooterController.swift rename to TableKitDemo/Classes/Presentation/Controllers/HeaderFooterController.swift index 1e1a7c7..6c8d62f 100644 --- a/TabletDemo/Classes/Presentation/Controllers/HeaderFooterController.swift +++ b/TableKitDemo/Classes/Presentation/Controllers/HeaderFooterController.swift @@ -7,7 +7,7 @@ // import UIKit -import Tablet +import TableKit class HeaderFooterController: UIViewController { @@ -21,13 +21,13 @@ class HeaderFooterController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - let rows = TableRowBuilder(items: ["3", "4", "5"]) + //let rows = TableRowBuilder(items: ["3", "4", "5"]) - let headerView = UIView(frame: CGRectMake(0, 0, 100, 100)) - headerView.backgroundColor = UIColor.lightGrayColor() + //let headerView = UIView(frame: CGRectMake(0, 0, 100, 100)) + //headerView.backgroundColor = UIColor.lightGrayColor() - let section = TableSectionBuilder(headerView: headerView, footerView: nil, rows: [rows]) + //let section = TableSectionBuilder(headerView: headerView, footerView: nil, rows: [rows]) - tableDirector += section + //tableDirector += section } } \ No newline at end of file diff --git a/TableKitDemo/Classes/Presentation/Controllers/MainController.swift b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift new file mode 100644 index 0000000..9a2f174 --- /dev/null +++ b/TableKitDemo/Classes/Presentation/Controllers/MainController.swift @@ -0,0 +1,101 @@ +// +// MainController.swift +// TabletDemo +// +// Created by Max Sokolov on 16/04/16. +// Copyright © 2016 Tablet. All rights reserved. +// + +import UIKit +import TableKit + +class MainController: UIViewController { + + @IBOutlet weak var tableView: UITableView! { + didSet { + tableDirector = TableDirector(tableView: tableView) + } + } + var tableDirector: TableDirector! + + override func viewDidLoad() { + super.viewDidLoad() + + /*let rowBuilder = TableRowBuilder(items: ["1", "1", "1", "1"]) + .action(.click) { [unowned self] data in + + self.performSegueWithIdentifier("headerfooter", sender: nil) + }*/ + + + + + let a = TableRowAction(.click) { + (row) in + + print("3") + } + + + + let row1 = TableRow(item: "1") + let row2 = TableRow(item: "2") + let row3 = TableRow(item: "3", actions: [a]) + + + + row1 + .action(TableRowAction(.click) { (row) in + + print("1") + }) + .action(TableRowAction(.click) { (row) -> String in + + print("2") + + return "" + }) + + + + let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3]) + + + + 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) + } +} \ No newline at end of file diff --git a/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift b/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift new file mode 100644 index 0000000..c809967 --- /dev/null +++ b/TableKitDemo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift @@ -0,0 +1,33 @@ +// +// 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" + } + + override func layoutSubviews() { + super.layoutSubviews() + + contentView.layoutIfNeeded() + + subtitleLabel.preferredMaxLayoutWidth = subtitleLabel.bounds.size.width + } +} \ No newline at end of file diff --git a/TabletDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift b/TableKitDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift similarity index 79% rename from TabletDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift rename to TableKitDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift index 2e4884b..8180860 100644 --- a/TabletDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift +++ b/TableKitDemo/Classes/Presentation/Views/StoryboardTableViewCell.swift @@ -7,7 +7,7 @@ // import UIKit -import Tablet +import TableKit class StoryboardTableViewCell: UITableViewCell, ConfigurableCell { @@ -16,8 +16,4 @@ class StoryboardTableViewCell: UITableViewCell, ConfigurableCell { func configure(value: T) { textLabel?.text = value } - - static func estimatedHeight() -> Float { - return 44 - } } \ No newline at end of file diff --git a/TabletDemo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json b/TableKitDemo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from TabletDemo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json rename to TableKitDemo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/TabletDemo/Resources/Info.plist b/TableKitDemo/Resources/Info.plist similarity index 90% rename from TabletDemo/Resources/Info.plist rename to TableKitDemo/Resources/Info.plist index 6c48029..6905cc6 100644 --- a/TabletDemo/Resources/Info.plist +++ b/TableKitDemo/Resources/Info.plist @@ -33,6 +33,8 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight diff --git a/TabletDemo/Resources/Storyboards/LaunchScreen.storyboard b/TableKitDemo/Resources/Storyboards/LaunchScreen.storyboard similarity index 84% rename from TabletDemo/Resources/Storyboards/LaunchScreen.storyboard rename to TableKitDemo/Resources/Storyboards/LaunchScreen.storyboard index c9b7564..0a546bb 100644 --- a/TabletDemo/Resources/Storyboards/LaunchScreen.storyboard +++ b/TableKitDemo/Resources/Storyboards/LaunchScreen.storyboard @@ -1,8 +1,8 @@ - + - + diff --git a/TabletDemo/Resources/Storyboards/Main.storyboard b/TableKitDemo/Resources/Storyboards/Main.storyboard similarity index 59% rename from TabletDemo/Resources/Storyboards/Main.storyboard rename to TableKitDemo/Resources/Storyboards/Main.storyboard index 1a1d1c2..4edf1ae 100644 --- a/TabletDemo/Resources/Storyboards/Main.storyboard +++ b/TableKitDemo/Resources/Storyboards/Main.storyboard @@ -39,8 +39,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/TabletDemo/TabletDemo.xcodeproj/project.pbxproj b/TableKitDemo/TableKitDemo.xcodeproj/project.pbxproj similarity index 85% rename from TabletDemo/TabletDemo.xcodeproj/project.pbxproj rename to TableKitDemo/TableKitDemo.xcodeproj/project.pbxproj index c07b7a8..9175ff7 100644 --- a/TabletDemo/TabletDemo.xcodeproj/project.pbxproj +++ b/TableKitDemo/TableKitDemo.xcodeproj/project.pbxproj @@ -7,7 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - DA539CC41D00DC6000368ACB /* Tablet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA539CC31D00DC6000368ACB /* Tablet.framework */; }; + DA08A0531CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */; }; + DA9EA7821D0B6B070021F650 /* TableKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA9EA7811D0B6B070021F650 /* TableKit.framework */; }; DAC2D5CA1C9D303E009E9C19 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D5C91C9D303E009E9C19 /* AppDelegate.swift */; }; DAC2D5CF1C9D30A7009E9C19 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D5CD1C9D30A7009E9C19 /* Main.storyboard */; }; DAC2D5D01C9D30A7009E9C19 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC2D5CE1C9D30A7009E9C19 /* LaunchScreen.storyboard */; }; @@ -18,8 +19,9 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - DA539CC31D00DC6000368ACB /* Tablet.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tablet.framework; path = "../Tablet/build/Debug-iphoneos/Tablet.framework"; sourceTree = ""; }; - DAB7EB271BEF787300D2AD5E /* TabletDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TabletDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardImageTableViewCell.swift; sourceTree = ""; }; + DA9EA7811D0B6B070021F650 /* TableKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TableKit.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/TableKit-blgxvmkyvpocltgadmpliruugomo/Build/Products/Debug-iphonesimulator/TableKit.framework"; sourceTree = ""; }; + DAB7EB271BEF787300D2AD5E /* TableKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; DAC2D5C91C9D303E009E9C19 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; DAC2D5CD1C9D30A7009E9C19 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; DAC2D5CE1C9D30A7009E9C19 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; @@ -35,17 +37,17 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DA539CC41D00DC6000368ACB /* Tablet.framework in Frameworks */, + DA9EA7821D0B6B070021F650 /* TableKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - DA539CC21D00DC5300368ACB /* Frameworks */ = { + DA539C871CF50B1800368ACB /* Frameworks */ = { isa = PBXGroup; children = ( - DA539CC31D00DC6000368ACB /* Tablet.framework */, + DA9EA7811D0B6B070021F650 /* TableKit.framework */, ); name = Frameworks; sourceTree = ""; @@ -55,7 +57,7 @@ children = ( DAC2D5C61C9D2FE5009E9C19 /* Classes */, DAC2D5CB1C9D3058009E9C19 /* Resources */, - DA539CC21D00DC5300368ACB /* Frameworks */, + DA539C871CF50B1800368ACB /* Frameworks */, DAB7EB281BEF787300D2AD5E /* Products */, ); sourceTree = ""; @@ -63,7 +65,7 @@ DAB7EB281BEF787300D2AD5E /* Products */ = { isa = PBXGroup; children = ( - DAB7EB271BEF787300D2AD5E /* TabletDemo.app */, + DAB7EB271BEF787300D2AD5E /* TableKitDemo.app */, ); name = Products; sourceTree = ""; @@ -134,6 +136,7 @@ isa = PBXGroup; children = ( DACB71771CC2D6ED00432BD3 /* StoryboardTableViewCell.swift */, + DA08A0521CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift */, ); path = Views; sourceTree = ""; @@ -141,9 +144,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - DAB7EB261BEF787300D2AD5E /* TabletDemo */ = { + DAB7EB261BEF787300D2AD5E /* TableKitDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = DAB7EB391BEF787300D2AD5E /* Build configuration list for PBXNativeTarget "TabletDemo" */; + buildConfigurationList = DAB7EB391BEF787300D2AD5E /* Build configuration list for PBXNativeTarget "TableKitDemo" */; buildPhases = ( DAB7EB231BEF787300D2AD5E /* Sources */, DAB7EB241BEF787300D2AD5E /* Frameworks */, @@ -153,9 +156,9 @@ ); dependencies = ( ); - name = TabletDemo; + name = TableKitDemo; productName = TabletDemo; - productReference = DAB7EB271BEF787300D2AD5E /* TabletDemo.app */; + productReference = DAB7EB271BEF787300D2AD5E /* TableKitDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -174,7 +177,7 @@ }; }; }; - buildConfigurationList = DAB7EB221BEF787300D2AD5E /* Build configuration list for PBXProject "TabletDemo" */; + buildConfigurationList = DAB7EB221BEF787300D2AD5E /* Build configuration list for PBXProject "TableKitDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -187,7 +190,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - DAB7EB261BEF787300D2AD5E /* TabletDemo */, + DAB7EB261BEF787300D2AD5E /* TableKitDemo */, ); }; /* End PBXProject section */ @@ -214,6 +217,7 @@ DACB71761CC2D63D00432BD3 /* MainController.swift in Sources */, DAC2D5CA1C9D303E009E9C19 /* AppDelegate.swift in Sources */, DACB717A1CC2D89D00432BD3 /* HeaderFooterController.swift in Sources */, + DA08A0531CF4E9B500BBF1F8 /* StoryboardImageTableViewCell.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -310,8 +314,8 @@ INFOPLIST_FILE = Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tablet.tablet; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo; + PRODUCT_NAME = TableKitDemo; PROVISIONING_PROFILE = ""; }; name = Debug; @@ -325,8 +329,8 @@ INFOPLIST_FILE = Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tablet.tablet; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo; + PRODUCT_NAME = TableKitDemo; PROVISIONING_PROFILE = ""; }; name = Release; @@ -334,7 +338,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - DAB7EB221BEF787300D2AD5E /* Build configuration list for PBXProject "TabletDemo" */ = { + DAB7EB221BEF787300D2AD5E /* Build configuration list for PBXProject "TableKitDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( DAB7EB371BEF787300D2AD5E /* Debug */, @@ -343,7 +347,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DAB7EB391BEF787300D2AD5E /* Build configuration list for PBXNativeTarget "TabletDemo" */ = { + DAB7EB391BEF787300D2AD5E /* Build configuration list for PBXNativeTarget "TableKitDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( DAB7EB3A1BEF787300D2AD5E /* Debug */, diff --git a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TableKitDemo/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to TableKitDemo/TableKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate b/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index c9f97f2..0000000 Binary files a/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Tablet/Tablet.xcodeproj/project.pbxproj b/Tablet/Tablet.xcodeproj/project.pbxproj deleted file mode 100644 index 49ea0b1..0000000 --- a/Tablet/Tablet.xcodeproj/project.pbxproj +++ /dev/null @@ -1,423 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - DAC2D6741C9D743D009E9C19 /* Tablet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC2D6691C9D743D009E9C19 /* Tablet.framework */; }; - DAC2D6871C9D7517009E9C19 /* Tablet.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC2D6851C9D7517009E9C19 /* Tablet.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DAC2D6901C9D799E009E9C19 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D68C1C9D799E009E9C19 /* TableDirector.swift */; }; - DAC2D6911C9D799E009E9C19 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D68D1C9D799E009E9C19 /* TableRowBuilder.swift */; }; - DAC2D6921C9D799E009E9C19 /* TableSectionBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D68E1C9D799E009E9C19 /* TableSectionBuilder.swift */; }; - DAC2D6931C9D799E009E9C19 /* Tablet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D68F1C9D799E009E9C19 /* Tablet.swift */; }; - DAC2D6991C9D7A3F009E9C19 /* TabletTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2D6961C9D7A3B009E9C19 /* TabletTests.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - DAC2D6751C9D743D009E9C19 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAC2D6601C9D743D009E9C19 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAC2D6681C9D743D009E9C19; - remoteInfo = Tablet; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - DAC2D6691C9D743D009E9C19 /* Tablet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Tablet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DAC2D6731C9D743D009E9C19 /* TabletTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TabletTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DAC2D6841C9D7517009E9C19 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DAC2D6851C9D7517009E9C19 /* Tablet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tablet.h; sourceTree = ""; }; - DAC2D68C1C9D799E009E9C19 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = ""; }; - DAC2D68D1C9D799E009E9C19 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = ""; }; - DAC2D68E1C9D799E009E9C19 /* TableSectionBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSectionBuilder.swift; sourceTree = ""; }; - DAC2D68F1C9D799E009E9C19 /* Tablet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tablet.swift; sourceTree = ""; }; - DAC2D6951C9D7A3B009E9C19 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DAC2D6961C9D7A3B009E9C19 /* TabletTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabletTests.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - DAC2D6651C9D743D009E9C19 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DAC2D6701C9D743D009E9C19 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DAC2D6741C9D743D009E9C19 /* Tablet.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - DAC2D65F1C9D743D009E9C19 = { - isa = PBXGroup; - children = ( - DAC2D68B1C9D7990009E9C19 /* Classes */, - DAC2D6941C9D7A03009E9C19 /* Tests */, - DAC2D6831C9D74EE009E9C19 /* Supporting Files */, - DAC2D66A1C9D743D009E9C19 /* Products */, - ); - sourceTree = ""; - }; - DAC2D66A1C9D743D009E9C19 /* Products */ = { - isa = PBXGroup; - children = ( - DAC2D6691C9D743D009E9C19 /* Tablet.framework */, - DAC2D6731C9D743D009E9C19 /* TabletTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - DAC2D6831C9D74EE009E9C19 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - DAC2D6841C9D7517009E9C19 /* Info.plist */, - DAC2D6851C9D7517009E9C19 /* Tablet.h */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - DAC2D68B1C9D7990009E9C19 /* Classes */ = { - isa = PBXGroup; - children = ( - DAC2D68F1C9D799E009E9C19 /* Tablet.swift */, - DAC2D68C1C9D799E009E9C19 /* TableDirector.swift */, - DAC2D68D1C9D799E009E9C19 /* TableRowBuilder.swift */, - DAC2D68E1C9D799E009E9C19 /* TableSectionBuilder.swift */, - ); - name = Classes; - sourceTree = ""; - }; - DAC2D6941C9D7A03009E9C19 /* Tests */ = { - isa = PBXGroup; - children = ( - DAC2D6951C9D7A3B009E9C19 /* Info.plist */, - DAC2D6961C9D7A3B009E9C19 /* TabletTests.swift */, - ); - name = Tests; - path = ../Tests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - DAC2D6661C9D743D009E9C19 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DAC2D6871C9D7517009E9C19 /* Tablet.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - DAC2D6681C9D743D009E9C19 /* Tablet */ = { - isa = PBXNativeTarget; - buildConfigurationList = DAC2D67D1C9D743D009E9C19 /* Build configuration list for PBXNativeTarget "Tablet" */; - buildPhases = ( - DAC2D6641C9D743D009E9C19 /* Sources */, - DAC2D6651C9D743D009E9C19 /* Frameworks */, - DAC2D6661C9D743D009E9C19 /* Headers */, - DAC2D6671C9D743D009E9C19 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Tablet; - productName = Tablet; - productReference = DAC2D6691C9D743D009E9C19 /* Tablet.framework */; - productType = "com.apple.product-type.framework"; - }; - DAC2D6721C9D743D009E9C19 /* TabletTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = DAC2D6801C9D743D009E9C19 /* Build configuration list for PBXNativeTarget "TabletTests" */; - buildPhases = ( - DAC2D66F1C9D743D009E9C19 /* Sources */, - DAC2D6701C9D743D009E9C19 /* Frameworks */, - DAC2D6711C9D743D009E9C19 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DAC2D6761C9D743D009E9C19 /* PBXTargetDependency */, - ); - name = TabletTests; - productName = TabletTests; - productReference = DAC2D6731C9D743D009E9C19 /* TabletTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - DAC2D6601C9D743D009E9C19 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; - ORGANIZATIONNAME = Tablet; - TargetAttributes = { - DAC2D6681C9D743D009E9C19 = { - CreatedOnToolsVersion = 7.2; - }; - DAC2D6721C9D743D009E9C19 = { - CreatedOnToolsVersion = 7.2; - }; - }; - }; - buildConfigurationList = DAC2D6631C9D743D009E9C19 /* Build configuration list for PBXProject "Tablet" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = DAC2D65F1C9D743D009E9C19; - productRefGroup = DAC2D66A1C9D743D009E9C19 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - DAC2D6681C9D743D009E9C19 /* Tablet */, - DAC2D6721C9D743D009E9C19 /* TabletTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - DAC2D6671C9D743D009E9C19 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DAC2D6711C9D743D009E9C19 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - DAC2D6641C9D743D009E9C19 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DAC2D6901C9D799E009E9C19 /* TableDirector.swift in Sources */, - DAC2D6921C9D799E009E9C19 /* TableSectionBuilder.swift in Sources */, - DAC2D6911C9D799E009E9C19 /* TableRowBuilder.swift in Sources */, - DAC2D6931C9D799E009E9C19 /* Tablet.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DAC2D66F1C9D743D009E9C19 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DAC2D6991C9D7A3F009E9C19 /* TabletTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - DAC2D6761C9D743D009E9C19 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAC2D6681C9D743D009E9C19 /* Tablet */; - targetProxy = DAC2D6751C9D743D009E9C19 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - DAC2D67B1C9D743D009E9C19 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - DAC2D67C1C9D743D009E9C19 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - DAC2D67E1C9D743D009E9C19 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tablet.tablet; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - DAC2D67F1C9D743D009E9C19 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tablet.tablet; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - DAC2D6811C9D743D009E9C19 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = ../Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tablet.tablet.TabletTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - DAC2D6821C9D743D009E9C19 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = ../Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tablet.tablet.TabletTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - DAC2D6631C9D743D009E9C19 /* Build configuration list for PBXProject "Tablet" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DAC2D67B1C9D743D009E9C19 /* Debug */, - DAC2D67C1C9D743D009E9C19 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DAC2D67D1C9D743D009E9C19 /* Build configuration list for PBXNativeTarget "Tablet" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DAC2D67E1C9D743D009E9C19 /* Debug */, - DAC2D67F1C9D743D009E9C19 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DAC2D6801C9D743D009E9C19 /* Build configuration list for PBXNativeTarget "TabletTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DAC2D6811C9D743D009E9C19 /* Debug */, - DAC2D6821C9D743D009E9C19 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = DAC2D6601C9D743D009E9C19 /* Project object */; -} diff --git a/Tablet/Tablet.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tablet/Tablet.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 78fd6b2..0000000 --- a/Tablet/Tablet.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Tablet/Tablet.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate b/Tablet/Tablet.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index fbea635..0000000 Binary files a/Tablet/Tablet.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Tablet/Tablet.xcodeproj/xcshareddata/xcschemes/Tablet.xcscheme b/Tablet/Tablet.xcodeproj/xcshareddata/xcschemes/Tablet.xcscheme deleted file mode 100644 index b6e3630..0000000 --- a/Tablet/Tablet.xcodeproj/xcshareddata/xcschemes/Tablet.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tablet/Tablet.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist b/Tablet/Tablet.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index d54e643..0000000 --- a/Tablet/Tablet.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,19 +0,0 @@ - - - - - SuppressBuildableAutocreation - - DAC2D6681C9D743D009E9C19 - - primary - - - DAC2D6721C9D743D009E9C19 - - primary - - - - - diff --git a/Tablet/Tablet.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Tablet/Tablet.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b454..0000000 --- a/Tablet/Tablet.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/Tablet/Tablet.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/xcschememanagement.plist b/Tablet/Tablet.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 96dcbf8..0000000 --- a/Tablet/Tablet.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - Tablet.xcscheme_^#shared#^_ - - orderHint - 0 - - - SuppressBuildableAutocreation - - DAC2D6681C9D743D009E9C19 - - primary - - - DAC2D6721C9D743D009E9C19 - - primary - - - - - diff --git a/TabletDemo/Classes/Presentation/Controllers/MainController.swift b/TabletDemo/Classes/Presentation/Controllers/MainController.swift deleted file mode 100644 index 1375ff0..0000000 --- a/TabletDemo/Classes/Presentation/Controllers/MainController.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// MainController.swift -// TabletDemo -// -// Created by Max Sokolov on 16/04/16. -// Copyright © 2016 Tablet. All rights reserved. -// - -import UIKit -import Tablet - -class MainController: UIViewController { - - @IBOutlet weak var tableView: UITableView! { - didSet { - tableDirector = TableDirector(tableView: tableView) - } - } - var tableDirector: TableDirector! - - override func viewDidLoad() { - super.viewDidLoad() - - let rows = TableRowBuilder(items: ["1", "2", "3"]) - .action(.click) { [unowned self] e in - self.performSegueWithIdentifier("headerfooter", sender: nil) - } - - tableDirector += rows - } -} \ No newline at end of file diff --git a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index ae39eeb..0000000 Binary files a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 6fe6130..0000000 Binary files a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b454..0000000 --- a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/TabletDemo.xcscheme b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/TabletDemo.xcscheme deleted file mode 100644 index 6db4123..0000000 --- a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/TabletDemo.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index c382e1a..0000000 --- a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - TabletDemo.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - DAB7EB261BEF787300D2AD5E - - primary - - - - - diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b454..0000000 --- a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/TabletDemo.xcscheme b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/TabletDemo.xcscheme deleted file mode 100644 index 5b59ce8..0000000 --- a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/TabletDemo.xcscheme +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/xcschememanagement.plist b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 08916f9..0000000 --- a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/maxsokolov.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - TabletDemo.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - DAB7EB261BEF787300D2AD5E - - primary - - - DAC2D5DB1C9D6433009E9C19 - - primary - - - - -