Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
adellibovi committed Oct 27, 2017
2 parents 9a0b554 + 8d5f8bd commit 0e48f3d
Show file tree
Hide file tree
Showing 45 changed files with 804 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ identifier_name:
- id
- from
- to
- n
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.3
osx_image: xcode9
script:
- swiftlint
- travis_retry sh build.sh
Expand Down
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
All notable changes to this project will be documented in this file.

---

## [Unreleased]
## [1.2.0]
### Added
- Official support to Swift 4
- Support for `TableItem` method `redraw()`
- Support for `scrollViewWillEndDragging`
- Support for item's `copy` and `paste` action via `ActionPerformable`
### Changed
- Deprecated `Item` in favour of `TableItem`
- Deprecated `Section` in favour of `TableSection`
- Optimize diff algorithm used by `ObservableArray` for common methods such as `insert(at:)`, `remove(at:)` etc...
- Fix a bug where `manager` was not set correctly on `Item` or `Section`
- Fix memory ownership of `ObservableArray` for Swift 4

## [1.1.0]
### Added
Expand Down
22 changes: 20 additions & 2 deletions Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = ODIGEO;
TargetAttributes = {
257F72C01D07204A00F7B954 = {
Expand Down Expand Up @@ -299,13 +299,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-SampleApp-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
6AF3F1B07CA3D96A8145F9B2 /* [CP] Copy Pods Resources */ = {
Expand All @@ -329,9 +332,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-SampleApp/Pods-SampleApp-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/TableViewKit/TableViewKit.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TableViewKit.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -408,14 +414,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = 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_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -455,14 +467,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = 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_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 3 additions & 3 deletions Examples/SampleApp/SampleApp/ActionBar/ActionBarManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ActionBarManager: ActionBarDelegate {

fileprivate func indexPathForResponder(forDirection direction: Direction) -> IndexPath? {

func isFirstResponder(item: Item) -> Bool {
func isFirstResponder(item: TableItem) -> Bool {
if isResponder(item: item),
let indexPath = item.indexPath,
manager.tableView.cellForRow(at: indexPath)?.isFirstResponder == true {
Expand All @@ -29,7 +29,7 @@ class ActionBarManager: ActionBarDelegate {
return false
}

func isResponder(item: Item) -> Bool {
func isResponder(item: TableItem) -> Bool {
return (item as? UIResponder)?.canBecomeFirstResponder ?? false
}

Expand All @@ -38,7 +38,7 @@ class ActionBarManager: ActionBarDelegate {
let index = array.index(of: currentItem)
else { return nil }

let item: Item?
let item: TableItem?

switch direction {
case .next:
Expand Down
2 changes: 1 addition & 1 deletion Examples/SampleApp/SampleApp/CustomItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class CustomDrawer: CellDrawer {
}
}

public class CustomItem: Selectable, Item {
public class CustomItem: Selectable, TableItem {
public static var drawer = AnyCellDrawer(CustomDrawer.self)

public var title: String?
Expand Down
24 changes: 12 additions & 12 deletions Examples/SampleApp/SampleApp/Example1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ protocol ActionManagerCompatible {
}

class Example1: UIViewController, TableViewManagerCompatible {
fileprivate class FirstSection: Section, StaticStateful {
var items: ObservableArray<Item> = []
var states: [State: [Item]] = [:]
fileprivate class FirstSection: TableSection, StaticStateful {
var items: ObservableArray<TableItem> = []
var states: [State: [TableItem]] = [:]

enum State: Int {
case preParty
Expand Down Expand Up @@ -63,9 +63,9 @@ class Example1: UIViewController, TableViewManagerCompatible {

}

fileprivate class SecondSection: Section {
fileprivate class SecondSection: TableSection {

var items: ObservableArray<Item> = []
var items: ObservableArray<TableItem> = []

internal var header: HeaderFooterView = .view(CustomHeaderItem(title: "Second Section"))

Expand All @@ -75,7 +75,7 @@ class Example1: UIViewController, TableViewManagerCompatible {
self.vc = vc

let total: [Int] = Array(1...100)
let items = total.map({ (index) -> Item in
let items = total.map({ (index) -> TableItem in
if (index % 2 == 0) {
let item = TextFieldItem(placeHolder: "Textfield \(index)", actionBarDelegate: vc.actionBarManager)
return item
Expand All @@ -91,15 +91,15 @@ class Example1: UIViewController, TableViewManagerCompatible {
}
}

fileprivate class ThirdSection: Section, Stateful {
fileprivate class ThirdSection: TableSection, Stateful {

enum State {
case all
case selected(Item)
case selected(TableItem)
}

var items: ObservableArray<Item> = []
var allItems: [Item] = []
var items: ObservableArray<TableItem> = []
var allItems: [TableItem] = []
var currentState: State = .all

let vc: TableViewManagerCompatible
Expand All @@ -108,7 +108,7 @@ class Example1: UIViewController, TableViewManagerCompatible {
self.vc = vc

let total: [Int] = Array(1...10)
self.allItems = total.map { (index) -> Item in
self.allItems = total.map { (index) -> TableItem in
let item = CustomItem(title: "Label \(index)")
item.onSelection = { item in
switch self.currentState {
Expand All @@ -124,7 +124,7 @@ class Example1: UIViewController, TableViewManagerCompatible {
self.transition(to: currentState)
}

func items(for state: State) -> [Item] {
func items(for state: State) -> [TableItem] {
switch state {
case .all:
return allItems
Expand Down
6 changes: 3 additions & 3 deletions Examples/SampleApp/SampleApp/SelectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import Foundation
import UIKit
import TableViewKit

class SelectionSection: Section {
var items: ObservableArray<Item> = []
class SelectionSection: TableSection {
var items: ObservableArray<TableItem> = []
weak var tableViewManager: TableViewManager!

required init() { }
}

public protocol SelectionItemProtocol: Item {
public protocol SelectionItemProtocol: TableItem {

var value: Any { get }
var selected: Bool { get set }
Expand Down
4 changes: 2 additions & 2 deletions Examples/SampleApp/SampleApp/TextFieldItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TableViewKit

public class TextFieldCell: UITableViewCell, ItemCompatible, ActionBarDelegate {

public var item: Item?
public var item: TableItem?

public var textFieldItem: TextFieldItem {
get {
Expand Down Expand Up @@ -58,7 +58,7 @@ public class TextFieldDrawer: CellDrawer {
}
}

public class TextFieldItem: UIResponder, Item, ContentValidatable, Validationable {
public class TextFieldItem: UIResponder, TableItem, ContentValidatable, Validationable {

public static var drawer = AnyCellDrawer(TextFieldDrawer.self)

Expand Down
6 changes: 3 additions & 3 deletions Examples/SampleApp/SampleApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import TableViewKit

class ViewController: UIViewController, TableViewManagerCompatible {

fileprivate class CustomSection: Section {
var items: ObservableArray<Item>
fileprivate class CustomSection: TableSection {
var items: ObservableArray<TableItem>

let vc: ViewController

Expand All @@ -13,7 +13,7 @@ class ViewController: UIViewController, TableViewManagerCompatible {
self.items = []

let array: [UIViewController.Type] = [Example1.self]
let mappedItems = array.map({ (className) -> Item in
let mappedItems = array.map({ (className) -> TableItem in
let viewController = className.init(nibName: String(describing: className), bundle: nil)

let navigationController = UINavigationController(rootViewController: viewController)
Expand Down
22 changes: 20 additions & 2 deletions Examples/Viper/TableViewKit+VIPER.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "eDreams Odigeo";
TargetAttributes = {
25A741931D7ED45900473E02 = {
Expand Down Expand Up @@ -227,13 +227,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-TableViewKit+VIPER-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
87A11139382E8ED739E3CEEC /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -242,9 +245,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-TableViewKit+VIPER/Pods-TableViewKit+VIPER-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/TableViewKit/TableViewKit.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TableViewKit.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -311,14 +317,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = 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_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -358,14 +370,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = 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_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HelpCenterDrawer: CellDrawer {

class HelpCenterCell: UITableViewCell, ItemCompatible {

public var item: Item?
public var item: TableItem?

@IBOutlet var titleLabel: UILabel!
@IBOutlet var detailLabel: UILabel!
Expand Down
Loading

0 comments on commit 0e48f3d

Please sign in to comment.