-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
2,425 additions
and
1,047 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ xcuserdata/ | |
## Other | ||
*.moved-aside | ||
*.xcuserstate | ||
*.xcworkspace | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Examples/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Examples/SampleApp/SampleApp.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Examples/SampleApp/SampleApp/ActionBar/ActionBarManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.