Skip to content

Commit

Permalink
Merge branch 'release/1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcylin committed May 24, 2020
2 parents 70ec82d + 23d95ae commit 89894d0
Show file tree
Hide file tree
Showing 61 changed files with 2,774 additions and 2,446 deletions.
3 changes: 3 additions & 0 deletions .codecov.yml
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:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/run_tests.yml
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
10 changes: 7 additions & 3 deletions .jazzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ clean: true
author: bcylin
author_url: https://github.com/bcylin
github_url: https://github.com/bcylin/QuickTableViewController
github_file_prefix: https://github.com/bcylin/QuickTableViewController/blob/v1.2.1
xcodebuild_arguments: [-project, QuickTableViewController.xcodeproj, -scheme, QuickTableViewController-iOS]
github_file_prefix: https://github.com/bcylin/QuickTableViewController/blob/v1.2.2
xcodebuild_arguments: [
-project, QuickTableViewController.xcodeproj,
-scheme, QuickTableViewController-iOS,
-sdk, iphonesimulator
]
module: QuickTableViewController
module_version: 1.2.1
module_version: 1.2.2
output: docs/output
theme: fullwidth
skip_undocumented: true
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ disabled_rules:
- force_cast
- function_body_length
- identifier_name
- implicit_return
- line_length
- vertical_whitespace
opt_in_rules:
Expand All @@ -14,7 +15,6 @@ opt_in_rules:
- explicit_top_level_acl
- fatal_error_message
- first_where
- implicit_return
- implicitly_unwrapped_optional
- let_var_whitespace
- multiline_parameters
Expand Down
10 changes: 1 addition & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
language: objective-c
osx_image: xcode11.1
osx_image: xcode11.3
cache:
- bundler
- cocoapods
before_install:
- export LANG=en_US.UTF-8
- xcrun instruments -s devices
install:
- bundle install --without development --deployment --jobs=3 --retry=3
- bundle exec rake launch:simulators
- bundle exec pod install
before_script:
- if [ -n "$DANGER_GITHUB_API_TOKEN" ]; then bundle exec danger; fi
script:
- set -e
- bundle exec rake "test:ios[QuickTableViewController-iOS]"
- bash <(curl -s https://codecov.io/bash) -cF ios -J "QuickTableViewController"
- bundle exec rake "test:ios[Example-iOS]"
- make -B carthage
- make -B docs
after_success:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## v1.2.2

#### Fixes

* Fix `SwitchRow` subtitles, [#45](https://github.com/bcylin/QuickTableViewController/pull/45) by [@dnicolson](https://github.com/dnicolson)

#### Project Updates

* Add an example of dynamic table, [#42](https://github.com/bcylin/QuickTableViewController/pull/42) by [@twodayslate](https://github.com/twodayslate)
* Convert specs to XCTests
* Move tests to GitHub Actions

## v1.2.1

* Support Swift Package
Expand Down
24 changes: 0 additions & 24 deletions Dangerfile

This file was deleted.

2 changes: 1 addition & 1 deletion Example-iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>101</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
89 changes: 89 additions & 0 deletions Example-iOS/ViewControllers/DynamicTableView.swift
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 Example-iOS/ViewControllers/DynamicTableViewController.swift
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()
}
}
2 changes: 1 addition & 1 deletion Example-iOS/ViewControllers/ExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal final class ExampleViewController: QuickTableViewController {

tableContents = [
Section(title: "Switch", rows: [
SwitchRow(text: "Setting 1", switchValue: true, icon: .image(globe), action: didToggleSwitch()),
SwitchRow(text: "Setting 1", detailText: .subtitle("Example subtitle"), switchValue: true, icon: .image(globe), action: didToggleSwitch()),
SwitchRow(text: "Setting 2", switchValue: false, icon: .image(time), action: didToggleSwitch())
]),

Expand Down
6 changes: 6 additions & 0 deletions Example-iOS/ViewControllers/RootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ internal final class RootViewController: QuickTableViewController {
NavigationRow(text: "UILabel customization", detailText: .none, action: { [weak self] _ in
self?.navigationController?.pushViewController(AppearanceViewController(), animated: true)
})
]),

Section(title: "Dynamic", rows: [
NavigationRow(text: "Dynamic Rows", detailText: .none, action: { [weak self] _ in
self?.navigationController?.pushViewController(DynamicViewController(), animated: true)
})
])
]
}
Expand Down
4 changes: 2 additions & 2 deletions Example-iOSUITests/ExampleUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ internal final class ExampleUITests: XCTestCase {
let tables = XCUIApplication().tables
let existance = NSPredicate(format: "exists == true")

tables.switches["Setting 1"].tap()
tables.switches.firstMatch.tap()
expectation(for: existance, evaluatedWith: tables.staticTexts["Setting 1 = false"], handler: nil)
waitForExpectations(timeout: 5, handler: nil)

tables.switches["Setting 1"].tap()
tables.switches.firstMatch.tap()
expectation(for: existance, evaluatedWith: tables.staticTexts["Setting 1 = true"], handler: nil)
waitForExpectations(timeout: 5, handler: nil)

Expand Down
2 changes: 1 addition & 1 deletion Example-iOSUITests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Example-tvOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>101</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion Example-tvOSUITests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
Loading

0 comments on commit 89894d0

Please sign in to comment.