From ffac9fae14cbf71036ea42a0c556ca110cacb6a9 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Sun, 19 Jun 2016 12:35:12 +0300 Subject: [PATCH 1/5] add insert section method --- Sources/TableDirector.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index 5c1021c..26564a9 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -229,6 +229,12 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate return self } + public func insert(section section: TableSection, atIndex index: Int) -> Self { + + sections.insert(section, atIndex: index) + return self + } + public func clear() -> Self { sections.removeAll() From acebd1c3e83a2635e848fe1d6f6151570b96481e Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Sun, 19 Jun 2016 12:37:12 +0300 Subject: [PATCH 2/5] add delete section method --- Sources/TableDirector.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index 26564a9..2ad6581 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -235,6 +235,12 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate return self } + public func delete(index index: Int) -> Self { + + sections.removeAtIndex(index) + return self + } + public func clear() -> Self { sections.removeAll() From 126720f388450a839d72415ee1cf28a294ef04ba Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Tue, 21 Jun 2016 22:46:05 +0300 Subject: [PATCH 3/5] remove tableView from CellHeightCalculatable --- Sources/HeightStrategy.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sources/HeightStrategy.swift b/Sources/HeightStrategy.swift index c6e7d25..1fbc0cd 100644 --- a/Sources/HeightStrategy.swift +++ b/Sources/HeightStrategy.swift @@ -22,8 +22,6 @@ import UIKit public protocol CellHeightCalculatable { - var tableView: UITableView? { get set } - func height(row: Row, path: NSIndexPath) -> CGFloat func estimatedHeight(row: Row, path: NSIndexPath) -> CGFloat @@ -32,7 +30,7 @@ public protocol CellHeightCalculatable { public class PrototypeHeightStrategy: CellHeightCalculatable { - public weak var tableView: UITableView? + private weak var tableView: UITableView? private var prototypes = [String: UITableViewCell]() private var cachedHeights = [Int: CGFloat]() private var separatorHeight = 1 / UIScreen.mainScreen().scale From 080b3f04582cce5a9e5961c1b047e7572a4052f9 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Fri, 24 Jun 2016 23:01:19 +0300 Subject: [PATCH 4/5] supports iOS 7 --- .../Controllers/RowBuilderCellsController.swift | 7 ++----- Demo/Resources/Storyboards/Main.storyboard | 10 ---------- Demo/TableKitDemo.xcodeproj/project.pbxproj | 8 ++++---- README.md | 6 +----- TableKit.xcodeproj/project.pbxproj | 9 +++++---- 5 files changed, 12 insertions(+), 28 deletions(-) diff --git a/Demo/Classes/Presentation/Controllers/RowBuilderCellsController.swift b/Demo/Classes/Presentation/Controllers/RowBuilderCellsController.swift index acc3fc2..02ec115 100644 --- a/Demo/Classes/Presentation/Controllers/RowBuilderCellsController.swift +++ b/Demo/Classes/Presentation/Controllers/RowBuilderCellsController.swift @@ -26,12 +26,9 @@ class RowBuilderCellsController: UIViewController { let numbers = ["1", "2", "3", "4", "5"] - let clickAction = TableRowAction(.click) { [weak self] (data) in + let clickAction = TableRowAction(.click) { (data) in - let alert = UIAlertController(title: nil, message: data.item, preferredStyle: .Alert) - alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) - - self?.presentViewController(alert, animated: true, completion: nil) + print(data.item) } let rowBuilder = TableRowBuilder(items: numbers, actions: [clickAction]) diff --git a/Demo/Resources/Storyboards/Main.storyboard b/Demo/Resources/Storyboards/Main.storyboard index 8ea83c1..2aeae2e 100644 --- a/Demo/Resources/Storyboards/Main.storyboard +++ b/Demo/Resources/Storyboards/Main.storyboard @@ -189,16 +189,6 @@ - - - - - - - - - - diff --git a/Demo/TableKitDemo.xcodeproj/project.pbxproj b/Demo/TableKitDemo.xcodeproj/project.pbxproj index 0de8bcb..918356e 100644 --- a/Demo/TableKitDemo.xcodeproj/project.pbxproj +++ b/Demo/TableKitDemo.xcodeproj/project.pbxproj @@ -357,7 +357,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -395,7 +395,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; @@ -410,7 +410,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = Resources/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo; PRODUCT_NAME = TableKitDemo; @@ -426,7 +426,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = Resources/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.demo; PRODUCT_NAME = TableKitDemo; diff --git a/README.md b/README.md index 03bfd9b..e108069 100644 --- a/README.md +++ b/README.md @@ -166,10 +166,6 @@ Done, your table is ready. It's just awesome! To integrate TableKit 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 'TableKit' ``` #### Carthage @@ -179,7 +175,7 @@ Clone the repo and drag files from `Sources` folder into your Xcode project. ## Requirements -- iOS 8.0+ +- iOS 7.0+ - Xcode 7.0+ ## License diff --git a/TableKit.xcodeproj/project.pbxproj b/TableKit.xcodeproj/project.pbxproj index a72f71f..c874173 100644 --- a/TableKit.xcodeproj/project.pbxproj +++ b/TableKit.xcodeproj/project.pbxproj @@ -294,7 +294,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -337,7 +337,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -357,7 +357,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Configs/TableKit.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -376,7 +376,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Configs/TableKit.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.tablekit.TableKit; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -434,6 +434,7 @@ DA9EA7CE1D0EC45F0021F650 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; From 9fbe7c938394783caeb89a23989ca5df2407b4c9 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Fri, 24 Jun 2016 23:27:17 +0300 Subject: [PATCH 5/5] bump podspec --- TableKit.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TableKit.podspec b/TableKit.podspec index 58f4a5c..609c082 100644 --- a/TableKit.podspec +++ b/TableKit.podspec @@ -2,15 +2,15 @@ Pod::Spec.new do |s| s.name = 'TableKit' s.module_name = 'TableKit' - s.version = '0.8.0' + s.version = '0.8.1' 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.platforms = { :ios => '7.0' } + s.ios.deployment_target = '7.0' s.source_files = 'Sources/*.swift' s.source = { :git => 'https://github.com/maxsokolov/TableKit.git', :tag => s.version }