Skip to content

Commit

Permalink
Merge branch 'release/v0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
adellibovi committed Sep 15, 2016
2 parents 1a4a7d0 + 2e95bb3 commit c9ee624
Show file tree
Hide file tree
Showing 83 changed files with 2,425 additions and 1,047 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ xcuserdata/
## Other
*.moved-aside
*.xcuserstate
*.xcworkspace

## Obj-C/Swift specific
*.hmap
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "External/Nimble"]
path = External/Nimble
url = git://github.com/Quick/Nimble.git
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
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: xcode7.3
osx_image: xcode8
script: sh build.sh
after_success:
- bash <(curl -s https://codecov.io/bash)
Binary file added Assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 54 additions & 3 deletions Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
CC19AB271D7DAB7F00B8B196 /* PickerControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC19AB261D7DAB7F00B8B196 /* PickerControl.swift */; };
CC28B4091D7D060B00B7CA97 /* CustomHeaderFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = CC28B4081D7D060B00B7CA97 /* CustomHeaderFooterView.xib */; };
CC28B40B1D7D064700B7CA97 /* CustomHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC28B40A1D7D064700B7CA97 /* CustomHeader.swift */; };
CC2B23AE1D84DF4B0025CDF8 /* ActionBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2B23AD1D84DF4B0025CDF8 /* ActionBar.swift */; };
CC5234581D730EF500F312E7 /* SelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC5234571D730EF500F312E7 /* SelectionViewController.swift */; };
CCBD2FBC1D87344E00C61DCC /* ActionBarManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCBD2FBB1D87344E00C61DCC /* ActionBarManager.swift */; };
CCBD2FC21D874BBA00C61DCC /* Rules.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCBD2FBE1D874BBA00C61DCC /* Rules.swift */; };
CCBD2FC31D874BBA00C61DCC /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCBD2FBF1D874BBA00C61DCC /* Validation.swift */; };
CCBD2FC41D874BBA00C61DCC /* ValidationError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCBD2FC01D874BBA00C61DCC /* ValidationError.swift */; };
CCBD2FC51D874BBA00C61DCC /* Validator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCBD2FC11D874BBA00C61DCC /* Validator.swift */; };
CCDDB6971D7DA9CB006C0F9F /* CustomItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCDDB6951D7DA9CB006C0F9F /* CustomItem.swift */; };
CCDDB6981D7DA9CB006C0F9F /* TextFieldItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCDDB6961D7DA9CB006C0F9F /* TextFieldItem.swift */; };
CCDDB69A1D7DA9DE006C0F9F /* TextFieldCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CCDDB6991D7DA9DE006C0F9F /* TextFieldCell.xib */; };
Expand Down Expand Up @@ -46,7 +52,13 @@
CC19AB261D7DAB7F00B8B196 /* PickerControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickerControl.swift; sourceTree = "<group>"; };
CC28B4081D7D060B00B7CA97 /* CustomHeaderFooterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomHeaderFooterView.xib; sourceTree = "<group>"; };
CC28B40A1D7D064700B7CA97 /* CustomHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomHeader.swift; sourceTree = "<group>"; };
CC2B23AD1D84DF4B0025CDF8 /* ActionBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ActionBar.swift; path = ActionBar/ActionBar.swift; sourceTree = "<group>"; };
CC5234571D730EF500F312E7 /* SelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectionViewController.swift; sourceTree = "<group>"; };
CCBD2FBB1D87344E00C61DCC /* ActionBarManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ActionBarManager.swift; path = ActionBar/ActionBarManager.swift; sourceTree = "<group>"; };
CCBD2FBE1D874BBA00C61DCC /* Rules.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Rules.swift; sourceTree = "<group>"; };
CCBD2FBF1D874BBA00C61DCC /* Validation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validation.swift; sourceTree = "<group>"; };
CCBD2FC01D874BBA00C61DCC /* ValidationError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationError.swift; sourceTree = "<group>"; };
CCBD2FC11D874BBA00C61DCC /* Validator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validator.swift; sourceTree = "<group>"; };
CCDDB6951D7DA9CB006C0F9F /* CustomItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomItem.swift; sourceTree = "<group>"; };
CCDDB6961D7DA9CB006C0F9F /* TextFieldItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldItem.swift; sourceTree = "<group>"; };
CCDDB6991D7DA9DE006C0F9F /* TextFieldCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TextFieldCell.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -96,6 +108,8 @@
257F72C31D07204A00F7B954 /* SampleApp */ = {
isa = PBXGroup;
children = (
CCBD2FBD1D874BBA00C61DCC /* Validator */,
CCBD2FC61D874BFC00C61DCC /* ActionBar */,
257F72C41D07204A00F7B954 /* AppDelegate.swift */,
CC5234571D730EF500F312E7 /* SelectionViewController.swift */,
257F72C61D07204A00F7B954 /* ViewController.swift */,
Expand Down Expand Up @@ -132,6 +146,26 @@
name = Frameworks;
sourceTree = "<group>";
};
CCBD2FBD1D874BBA00C61DCC /* Validator */ = {
isa = PBXGroup;
children = (
CCBD2FBE1D874BBA00C61DCC /* Rules.swift */,
CCBD2FBF1D874BBA00C61DCC /* Validation.swift */,
CCBD2FC01D874BBA00C61DCC /* ValidationError.swift */,
CCBD2FC11D874BBA00C61DCC /* Validator.swift */,
);
path = Validator;
sourceTree = "<group>";
};
CCBD2FC61D874BFC00C61DCC /* ActionBar */ = {
isa = PBXGroup;
children = (
CC2B23AD1D84DF4B0025CDF8 /* ActionBar.swift */,
CCBD2FBB1D87344E00C61DCC /* ActionBarManager.swift */,
);
name = ActionBar;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -180,11 +214,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = ODIGEO;
TargetAttributes = {
257F72C01D07204A00F7B954 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 7M6E9TXYGF;
LastSwiftMigration = 0800;
};
25FA9E171D24123100E2C899 = {
CreatedOnToolsVersion = 7.3.1;
Expand Down Expand Up @@ -288,11 +324,17 @@
files = (
CCDDB6981D7DA9CB006C0F9F /* TextFieldItem.swift in Sources */,
257F72C71D07204A00F7B954 /* ViewController.swift in Sources */,
CCBD2FC31D874BBA00C61DCC /* Validation.swift in Sources */,
CC28B40B1D7D064700B7CA97 /* CustomHeader.swift in Sources */,
CCBD2FC51D874BBA00C61DCC /* Validator.swift in Sources */,
CC5234581D730EF500F312E7 /* SelectionViewController.swift in Sources */,
CCBD2FC41D874BBA00C61DCC /* ValidationError.swift in Sources */,
CC19AB271D7DAB7F00B8B196 /* PickerControl.swift in Sources */,
CCBD2FBC1D87344E00C61DCC /* ActionBarManager.swift in Sources */,
CC2B23AE1D84DF4B0025CDF8 /* ActionBar.swift in Sources */,
257F72C51D07204A00F7B954 /* AppDelegate.swift in Sources */,
CCDDB6971D7DA9CB006C0F9F /* CustomItem.swift in Sources */,
CCBD2FC21D874BBA00C61DCC /* Rules.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -347,8 +389,10 @@
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_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -392,8 +436,10 @@
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_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -412,6 +458,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -420,28 +467,32 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 224FEB30105CBE2EBFFC9EE9 /* Pods-SampleApp.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 7M6E9TXYGF;
INFOPLIST_FILE = "$(SRCROOT)/SampleApp/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.odigeo.tableviewkit.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
SWIFT_VERSION = 3.0;
};
name = Debug;
};
257F72D51D07204A00F7B954 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D368DEDD0DD5DD15CD2C3F65 /* Pods-SampleApp.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 7M6E9TXYGF;
INFOPLIST_FILE = "$(SRCROOT)/SampleApp/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.odigeo.tableviewkit.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 2.3;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -28,6 +28,16 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "25FA9E171D24123100E2C899"
BuildableName = "SampleAppTests.xctest"
BlueprintName = "SampleAppTests"
ReferencedContainer = "container:SampleApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
Expand Down
10 changes: 10 additions & 0 deletions Examples/SampleApp/SampleApp.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public enum Direction {

public protocol ActionBarDelegate {

func actionBar(actionBar: ActionBar, direction: Direction) -> NSIndexPath?
func actionBar(actionBar: ActionBar, doneButtonPressed doneButtonItem: UIBarButtonItem)
func actionBar(_ actionBar: ActionBar, direction: Direction)
func actionBar(_ actionBar: ActionBar, doneButtonPressed doneButtonItem: UIBarButtonItem)
}

public class ActionBar: UIToolbar {
open class ActionBar: UIToolbar {

var navigationControl: UISegmentedControl!
var actionBarDelegate: ActionBarDelegate!
Expand All @@ -40,29 +40,29 @@ public class ActionBar: UIToolbar {
super.init(coder: aDecoder)!
}

private func setup() {
fileprivate func setup() {

let previousButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.init(rawValue: 105)!, target: self, action: #selector(previousHandler))
let nextButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.init(rawValue: 106)!, target: self, action: #selector(nextHandler))
let doneButton = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: #selector(handleActionBarDone))
let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(handleActionBarDone))

let spacer = UIBarButtonItem(barButtonSystemItem: .FixedSpace, target: nil, action: nil)
let spacer = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
spacer.width = 40.0

let flexible = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil)
let flexible = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)

items = [previousButtonItem, spacer, nextButtonItem, flexible, doneButton]
}

@objc func handleActionBarDone(item: UIBarButtonItem) {
@objc func handleActionBarDone(_ item: UIBarButtonItem) {
actionBarDelegate.actionBar(self, doneButtonPressed: item)
}

@objc func previousHandler(sender: UIBarButtonItem) {
@objc func previousHandler(_ sender: UIBarButtonItem) {
actionBarDelegate.actionBar(self, direction: .previous)
}

@objc func nextHandler(sender: UIBarButtonItem) {
@objc func nextHandler(_ sender: UIBarButtonItem) {
actionBarDelegate.actionBar(self, direction: .next)
}
}
61 changes: 61 additions & 0 deletions Examples/SampleApp/SampleApp/ActionBar/ActionBarManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// ActionBarManager.swift
// SampleApp
//
// Created by Alfredo Delli Bovi on 12/09/2016.
// Copyright © 2016 ODIGEO. All rights reserved.
//

import Foundation
import TableViewKit

class ActionBarManager: ActionBarDelegate {

let manager: TableViewManager

init(manager: TableViewManager) {
self.manager = manager
}

public func actionBar(_ actionBar: ActionBar, direction: Direction) {
guard let indexPath = indexPathForResponder(forDirection: direction) else { return }

manager.tableView.scrollToRow(at: indexPath, at: .top, animated: true)
manager.tableView.cellForRow(at: indexPath)?.becomeFirstResponder()
}

public func actionBar(_ actionBar: ActionBar, doneButtonPressed doneButtonItem: UIBarButtonItem) { }

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

func isFirstResponder(item: Item) -> Bool {
if isResponder(item: item),
let indexPath = item.indexPath(in: manager),
manager.tableView.cellForRow(at: indexPath)?.isFirstResponder == true {
return true
}
return false
}

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

let array = manager.sections.flatMap { $0.items }
guard let currentItem = array.first(where: isFirstResponder),
let index = array.index(of: currentItem)
else { return nil }

let item: Item?

switch direction {
case .next:
item = array.suffix(from: index).dropFirst().first(where: isResponder)
case .previous:
item = array.prefix(upTo: index).reversed().first(where: isResponder)
}

return item?.indexPath(in: manager)

}
}
13 changes: 6 additions & 7 deletions Examples/SampleApp/SampleApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,31 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: Any]?) -> Bool {
// Override point for customization after application launch.

return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

Expand Down
Loading

0 comments on commit c9ee624

Please sign in to comment.