Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcylin committed Sep 19, 2018
2 parents bc193c7 + 8c21bec commit ac3ae8c
Show file tree
Hide file tree
Showing 74 changed files with 1,629 additions and 315 deletions.
4 changes: 3 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
coverage:
status:
patch: off
comment:
layout: "diff, files"
ignore:
- "Carthage/**/*"
- "Example*/**/*"
- "*Tests/**/*"
- "Tests/**/*"
- "Pods/**/*"
2 changes: 1 addition & 1 deletion .jazzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ github_url: https://github.com/bcylin/QuickTableViewController
github_file_prefix: https://github.com/bcylin/QuickTableViewController/blob/develop
xcodebuild_arguments: [-project, QuickTableViewController.xcodeproj, -scheme, QuickTableViewController-iOS]
module: QuickTableViewController
module_version: 0.9.1
module_version: 1.0.0
output: docs/output
theme: fullwidth
skip_undocumented: true
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ install:
before_script:
- if [ -n "$DANGER_GITHUB_API_TOKEN" ]; then bundle exec danger; fi
script:
- bundle exec rake "ci:build[QuickTableViewController-iOS, 3.0]"
- bundle exec rake "ci:test[QuickTableViewController-iOS]"
- set -o pipefail
- xcodebuild clean build -workspace QuickTableViewController.xcworkspace -scheme QuickTableViewController-iOS -sdk iphonesimulator SWIFT_VERSION=3.0 | bundle exec xcpretty -c
- bundle exec rake "test:ios[QuickTableViewController-iOS]"
- bundle exec rake "test:tvos[QuickTableViewController-tvOS]"
- bash <(curl -s https://codecov.io/bash) -cF ios -J "QuickTableViewController"
- bundle exec rake "ci:test[Example-iOS]"
- bundle exec rake "test:ios[Example-iOS]"
- bundle exec rake "build:tvos[Example-tvOS]"
- make -B carthage
- make -B docs
after_success:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## v1.0.0

#### Enhancements

* Support tvOS

## v0.9.1

#### Fixes
Expand Down
8 changes: 5 additions & 3 deletions Example-iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// AppDelegate.swift
// Example
// Example-iOS
//
// Created by Ben on 01/09/2015.
// Copyright (c) 2015 bcylin.
Expand Down Expand Up @@ -33,8 +33,10 @@ internal final class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {

// See AppearanceViewController for the setups.
UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = .blue
if #available(iOS 9.0, *) {
// See AppearanceViewController for the setups.
UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = .blue
}

window = UIWindow(frame: UIScreen.main.bounds)
window?.backgroundColor = UIColor.white
Expand Down
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>0.9.1</string>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>101</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion Example-iOS/ViewControllers/AppearanceViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// AppearanceViewController.swift
// Example
// Example-iOS
//
// Created by Ben on 30/01/2018.
// Copyright © 2018 bcylin.
Expand Down
49 changes: 26 additions & 23 deletions Example-iOS/ViewControllers/CustomizationViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CustomizationViewController.swift
// Example
// Example-iOS
//
// Created by Ben on 30/01/2018.
// Copyright © 2018 bcylin.
Expand All @@ -26,7 +26,6 @@

import UIKit
import QuickTableViewController
import Weakify

private final class CustomCell: UITableViewCell {}
private final class CustomSwitchCell: SwitchCell {}
Expand Down Expand Up @@ -60,26 +59,26 @@ internal final class CustomizationViewController: QuickTableViewController {
title: "SwitchRow\n<CustomSwitchCell>",
switchValue: true,
customization: set(label: "0-0"),
action: weakify(self, type(of: self).log)
action: showLog()
),
CustomSwitchRow<SwitchCell>(
title: "CustomSwitchRow\n<SwitchCell>",
switchValue: false,
customization: set(label: "0-1"),
action: weakify(self, type(of: self).log)
action: showLog()
)
]),

Section(title: "Tap Action", rows: [
TapActionRow<CustomTapActionCell>(
title: "TapActionRow\n<CustomTapActionCell>",
customization: set(label: "1-0"),
action: weakify(self, type(of: self).log)
action: showLog()
),
CustomTapActionRow<TapActionCell>(
title: "CustomTapActionRow\n<TapActionCell>",
customization: set(label: "1-1"),
action: weakify(self, type(of: self).log)
action: showLog()
)
]),

Expand All @@ -88,24 +87,25 @@ internal final class CustomizationViewController: QuickTableViewController {
title: "NavigationRow",
subtitle: .none,
customization: set(label: "2-0"),
action: weakify(self, type(of: self).log)),
action: showLog()
),
NavigationRow<CustomCell>(
title: "NavigationRow<CustomCell>",
subtitle: .belowTitle(".subtitle"),
customization: set(label: "2-1"),
action: weakify(self, type(of: self).log)
action: showLog()
),
CustomNavigationRow(
title: "CustomNavigationRow",
subtitle: .rightAligned(".value1"),
customization: set(label: "2-2"),
action: weakify(self, type(of: self).log)
action: showLog()
),
CustomNavigationRow<CustomCell>(
title: "CustomNavigationRow<CustomCell>",
subtitle: .leftAligned(".value2"),
customization: set(label: "2-3"),
action: weakify(self, type(of: self).log)
action: showLog()
)
]),

Expand All @@ -114,19 +114,19 @@ internal final class CustomizationViewController: QuickTableViewController {
title: "OptionRow",
isSelected: false,
customization: set(label: "3-0"),
action: weakify(self, type(of: self).log)
action: showLog()
),
CustomOptionRow(
title: "CustomOptionRow",
isSelected: false,
customization: set(label: "3-1"),
action: weakify(self, type(of: self).log)
action: showLog()
),
CustomOptionRow<CustomOptionCell>(
title: "CustomOptionRow<CustomOptionCell>",
isSelected: false,
customization: set(label: "3-2"),
action: weakify(self, type(of: self).log)
action: showLog()
)
]),

Expand Down Expand Up @@ -155,16 +155,19 @@ internal final class CustomizationViewController: QuickTableViewController {
}
}

private func log(_ sender: Row) {
if let option = sender as? OptionRowCompatible, !option.isSelected {
return
}

let text = (sender as! RowStyle).cellReuseIdentifier
debugging.rows = [NavigationRow(title: text, subtitle: .none)]
print(text)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
self?.tableView.reloadData()
private func showLog() -> (Row) -> Void {
return { [weak self] in
if let option = $0 as? OptionRowCompatible, !option.isSelected {
return
}
let identifier = ($0 as! RowStyle).cellReuseIdentifier
self?.debugging.rows = [
NavigationRow(title: identifier, subtitle: .none, customization: self?.set(label: "debug"))
]
print(identifier)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
self?.tableView.reloadData()
}
}
}

Expand Down
71 changes: 38 additions & 33 deletions Example-iOS/ViewControllers/DefaultViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// DefaultViewController.swift
// Example
// Example-iOS
//
// Created by Ben on 01/09/2015.
// Copyright (c) 2015 bcylin.
Expand All @@ -26,7 +26,6 @@

import UIKit
import QuickTableViewController
import Weakify

internal final class DefaultViewController: QuickTableViewController {

Expand All @@ -46,25 +45,25 @@ internal final class DefaultViewController: QuickTableViewController {

tableContents = [
Section(title: "Switch", rows: [
SwitchRow(title: "Setting 1", switchValue: true, icon: .image(globe), action: weakify(self, type(of: self).didToggleSwitch)),
SwitchRow(title: "Setting 2", switchValue: false, icon: .image(time), action: weakify(self, type(of: self).didToggleSwitch))
SwitchRow(title: "Setting 1", switchValue: true, icon: .image(globe), action: didToggleSwitch()),
SwitchRow(title: "Setting 2", switchValue: false, icon: .image(time), action: didToggleSwitch())
]),

Section(title: "Tap Action", rows: [
TapActionRow(title: "Tap action", action: weakify(self, type(of: self).showAlert))
TapActionRow(title: "Tap action", action: showAlert())
]),

Section(title: "Navigation", rows: [
NavigationRow(title: "CellStyle.default", subtitle: .none, icon: .image(gear)),
NavigationRow(title: "CellStyle", subtitle: .belowTitle(".subtitle"), icon: .image(globe)),
NavigationRow(title: "CellStyle", subtitle: .rightAligned(".value1"), icon: .image(time), action: weakify(self, type(of: self).showDetail)),
NavigationRow(title: "CellStyle", subtitle: .rightAligned(".value1"), icon: .image(time), action: showDetail()),
NavigationRow(title: "CellStyle", subtitle: .leftAligned(".value2"))
], footer: "UITableViewCellStyle.Value2 hides the image view."),

RadioSection(title: "Radio Buttons", options: [
OptionRow(title: "Option 1", isSelected: true, action: weakify(self, type(of: self).didToggleSelection)),
OptionRow(title: "Option 2", isSelected: false, action: weakify(self, type(of: self).didToggleSelection)),
OptionRow(title: "Option 3", isSelected: false, action: weakify(self, type(of: self).didToggleSelection))
OptionRow(title: "Option 1", isSelected: true, action: didToggleSelection()),
OptionRow(title: "Option 2", isSelected: false, action: didToggleSelection()),
OptionRow(title: "Option 3", isSelected: false, action: didToggleSelection())
], footer: "See RadioSection for more details."),

debugging
Expand All @@ -81,41 +80,47 @@ internal final class DefaultViewController: QuickTableViewController {

// MARK: - Private Methods

private func didToggleSelection(_ sender: Row) {
guard let option = sender as? OptionRowCompatible else {
return
private func didToggleSelection() -> (Row) -> Void {
return { [weak self] in
if let option = $0 as? OptionRowCompatible {
let state = "\(option.title) is " + (option.isSelected ? "selected" : "deselected")
self?.showDebuggingText(state)
}
}
let state = "\(option.title) is " + (option.isSelected ? "selected" : "deselected")
print(state)
showDebuggingText(state)
}

private func didToggleSwitch(_ sender: Row) {
if let row = sender as? SwitchRowCompatible {
let state = "\(row.title) = \(row.switchValue)"
print(state)
showDebuggingText(state)
private func didToggleSwitch() -> (Row) -> Void {
return { [weak self] in
if let row = $0 as? SwitchRowCompatible {
let state = "\(row.title) = \(row.switchValue)"
self?.showDebuggingText(state)
}
}
}

private func showAlert(_ sender: Row) {
let alert = UIAlertController(title: "Action Triggered", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .cancel) { [unowned self] _ in
self.dismiss(animated: true, completion: nil)
})
present(alert, animated: true, completion: nil)
private func showAlert() -> (Row) -> Void {
return { [weak self] _ in
let alert = UIAlertController(title: "Action Triggered", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .cancel) { [weak self] _ in
self?.dismiss(animated: true, completion: nil)
})
self?.present(alert, animated: true, completion: nil)
}
}

private func showDetail(_ sender: Row) {
let detail = "\(sender.title)\(sender.subtitle?.text ?? "")"
let controller = UIViewController()
controller.view.backgroundColor = UIColor.white
controller.title = detail
navigationController?.pushViewController(controller, animated: true)
showDebuggingText(detail + " is selected")
private func showDetail() -> (Row) -> Void {
return { [weak self] in
let detail = $0.title + ($0.subtitle?.text ?? "")
let controller = UIViewController()
controller.view.backgroundColor = .white
controller.title = detail
self?.navigationController?.pushViewController(controller, animated: true)
self?.showDebuggingText(detail + " is selected")
}
}

private func showDebuggingText(_ text: String) {
print(text)
debugging.rows = [NavigationRow(title: text, subtitle: .none)]
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
self?.tableView.reloadData()
Expand Down
2 changes: 1 addition & 1 deletion Example-iOS/ViewControllers/RootViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// RootViewController.swift
// Example
// Example-iOS
//
// Created by Ben on 30/01/2018.
// Copyright © 2018 bcylin.
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>0.9.1</string>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
Loading

0 comments on commit ac3ae8c

Please sign in to comment.