-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
61 changed files
with
2,774 additions
and
2,446 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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
coverage: | ||
status: | ||
patch: off | ||
project: | ||
default: | ||
target: 90% | ||
comment: | ||
layout: "diff, files" | ||
ignore: | ||
|
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,41 @@ | ||
name: Tests | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
run-tests: | ||
name: Run tests | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.6.x' | ||
- uses: actions/cache@v1 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: ${{ runner.os }}-gems- | ||
- uses: actions/cache@v1 | ||
with: | ||
path: Pods | ||
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | ||
restore-keys: ${{ runner.os }}-pods- | ||
- name: Bundle install | ||
run: | | ||
gem install bundler:2.1.4 | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
- name: Pod install | ||
run: | | ||
bundle exec pod install | ||
- run: | | ||
bundle exec fastlane ios unit_tests | ||
- run: | | ||
bundle exec fastlane tvos unit_tests | ||
- name: Report coverage | ||
run: | | ||
bash <(curl -s https://codecov.io/bash) -cF ios -J "QuickTableViewController" | ||
- run: | | ||
bundle exec fastlane ios ui_tests | ||
- run: | | ||
bundle exec fastlane tvos ui_tests |
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
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
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
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
This file was deleted.
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
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,89 @@ | ||
// | ||
// DynamicTableView.swift | ||
// Example-iOS | ||
// | ||
// Created by Zac on 14/02/2020. | ||
// | ||
// 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 Foundation | ||
import UIKit | ||
|
||
internal protocol QuickTableViewDelegate: class { | ||
func quickReload() | ||
} | ||
|
||
open class QuickTableView: UITableView { | ||
internal weak var quickDelegate: QuickTableViewDelegate? | ||
|
||
override open func reloadData() { | ||
self.quickDelegate?.quickReload() | ||
super.reloadData() | ||
} | ||
|
||
// MARK: Rows | ||
|
||
override open func reloadRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) { | ||
self.quickDelegate?.quickReload() | ||
super.reloadRows(at: indexPaths, with: animation) | ||
} | ||
|
||
override open func insertRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) { | ||
self.quickDelegate?.quickReload() | ||
super.insertRows(at: indexPaths, with: animation) | ||
} | ||
|
||
override open func deleteRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) { | ||
self.quickDelegate?.quickReload() | ||
super.deleteRows(at: indexPaths, with: animation) | ||
} | ||
|
||
override open func moveRow(at indexPath: IndexPath, to newIndexPath: IndexPath) { | ||
self.quickDelegate?.quickReload() | ||
super.moveRow(at: indexPath, to: newIndexPath) | ||
} | ||
|
||
// MARK: Sections | ||
|
||
override open func reloadSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) { | ||
self.quickDelegate?.quickReload() | ||
super.reloadSections(sections, with: animation) | ||
} | ||
|
||
override open func deleteSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) { | ||
self.quickDelegate?.quickReload() | ||
super.deleteSections(sections, with: animation) | ||
} | ||
|
||
override open func insertSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) { | ||
self.quickDelegate?.quickReload() | ||
super.insertSections(sections, with: animation) | ||
} | ||
|
||
override open func reloadSectionIndexTitles() { | ||
self.quickDelegate?.quickReload() | ||
super.reloadSectionIndexTitles() | ||
} | ||
|
||
override open func moveSection(_ section: Int, toSection newSection: Int) { | ||
self.quickDelegate?.quickReload() | ||
super.moveSection(section, toSection: newSection) | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
Example-iOS/ViewControllers/DynamicTableViewController.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,79 @@ | ||
// | ||
// DynamicTableViewController.swift | ||
// Example-iOS | ||
// | ||
// Created by Zac on 30/01/2018. | ||
// | ||
// 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 | ||
import QuickTableViewController | ||
|
||
internal final class DynamicViewController: QuickTableViewController { | ||
|
||
var dynamicRows: [Row & RowStyle] = [] | ||
|
||
private var cachedTableContents: [Section] = [] | ||
|
||
override var tableContents: [Section] { | ||
get { | ||
return cachedTableContents | ||
} | ||
set {} // swiftlint:disable:this unused_setter_value | ||
} | ||
|
||
private let quickTableView = QuickTableView(frame: .zero, style: .grouped) | ||
|
||
override var tableView: UITableView { | ||
get { | ||
return quickTableView | ||
} | ||
set {} // swiftlint:disable:this unused_setter_value | ||
} | ||
|
||
private func buildContents() -> [Section] { | ||
let rows: [Row & RowStyle] = [ | ||
TapActionRow(text: "AddCell", action: { [unowned self] _ in | ||
self.dynamicRows.append( | ||
NavigationRow(text: "UITableViewCell", detailText: .value1(String(describing: (self.dynamicRows.count + 1))), action: nil) | ||
) | ||
self.tableView.insertRows(at: [IndexPath(row: self.dynamicRows.count, section: 0)], with: .automatic) | ||
}) | ||
] + dynamicRows | ||
|
||
return [ | ||
Section(title: "Tap Action", rows: rows) | ||
] | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
title = "Dynamic" | ||
cachedTableContents = buildContents() | ||
quickTableView.quickDelegate = self | ||
} | ||
|
||
} | ||
|
||
extension DynamicViewController: QuickTableViewDelegate { | ||
func quickReload() { | ||
cachedTableContents = buildContents() | ||
} | ||
} |
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
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
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
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
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
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.