diff --git a/.jazzy.yml b/.jazzy.yml
index 945b596a..685a8180 100644
--- a/.jazzy.yml
+++ b/.jazzy.yml
@@ -5,6 +5,6 @@ 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.5.2
+module_version: 0.5.3
output: docs/output
theme: fullwidth
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01485a11..f1564aee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Change Log
+## v0.5.3
+
+* Fix the cell reuse identifier of `SwitchRow` and `TapActionRow` to be compatible with `0.5.x`
+
+Cell Reuse identifier | SwitchRow | TapActionRow
+--------------------- | ------------------------------------ | ---------------------------------------
+`<= 0.5.0` | `NSStringFromClass(SwitchRow.self)` | `NSStringFromClass(TapActionRow.self)`
+`== 0.5.1` | `String(describing: SwitchRow.self)` | `String(describing: TapActionRow.self)`
+`== 0.5.2` | `String(describing: SwitchRow.self)` | `String(describing: TapActionRow.self)`
+`== 0.5.3` | `NSStringFromClass(SwitchRow.self)` | `NSStringFromClass(TapActionRow.self)`
+
## v0.5.2
#### Changes
diff --git a/Example/Info.plist b/Example/Info.plist
index 2be2386e..cf17c5d9 100644
--- a/Example/Info.plist
+++ b/Example/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.5.2
+ 0.5.3
CFBundleVersion
101
LSRequiresIPhoneOS
diff --git a/Example/ViewController.swift b/Example/ViewController.swift
index 27242cc1..ed84422a 100644
--- a/Example/ViewController.swift
+++ b/Example/ViewController.swift
@@ -26,6 +26,7 @@
import UIKit
import QuickTableViewController
+import Weakify
class ViewController: QuickTableViewController {
@@ -41,25 +42,25 @@ class ViewController: QuickTableViewController {
tableContents = [
Section(title: "Switch", rows: [
- SwitchRow(title: "Setting 1", switchValue: true, icon: Icon(image: globe), action: printValue),
- SwitchRow(title: "Setting 2", switchValue: false, icon: Icon(image: time), action: printValue)
+ SwitchRow(title: "Setting 1", switchValue: true, icon: Icon(image: globe), action: weakify(self, type(of: self).printValue)),
+ SwitchRow(title: "Setting 2", switchValue: false, icon: Icon(image: time), action: weakify(self, type(of: self).printValue))
]),
Section(title: "Tap Action", rows: [
- TapActionRow(title: "Tap action", action: showAlert)
+ TapActionRow(title: "Tap action", action: weakify(self, type(of: self).showAlert))
]),
Section(title: "Cell Styles", rows: [
NavigationRow(title: "CellStyle.Default", subtitle: .none, icon: Icon(image: gear)),
NavigationRow(title: "CellStyle", subtitle: .belowTitle(".Subtitle"), icon: Icon(image: globe)),
- NavigationRow(title: "CellStyle", subtitle: .rightAligned(".Value1"), icon: Icon(image: time), action: showDetail),
+ NavigationRow(title: "CellStyle", subtitle: .rightAligned(".Value1"), icon: Icon(image: time), action: weakify(self, type(of: self).showDetail)),
NavigationRow(title: "CellStyle", subtitle: .leftAligned(".Value2"))
]),
Section(title: "Navigation", rows: [
- NavigationRow(title: "Navigation", subtitle: .none, action: showDetail),
- NavigationRow(title: "Navigation", subtitle: .belowTitle("with subtitle"), action: showDetail),
- NavigationRow(title: "Navigation", subtitle: .rightAligned("with detail text"), action: showDetail)
+ NavigationRow(title: "Navigation", subtitle: .none, action: weakify(self, type(of: self).showDetail)),
+ NavigationRow(title: "Navigation", subtitle: .belowTitle("with subtitle"), action: weakify(self, type(of: self).showDetail)),
+ NavigationRow(title: "Navigation", subtitle: .rightAligned("with detail text"), action: weakify(self, type(of: self).showDetail))
], footer: "UITableViewCellStyle.Value2 is not listed."),
Section(title: nil, rows: [
diff --git a/Podfile b/Podfile
index a553a573..75b4f409 100644
--- a/Podfile
+++ b/Podfile
@@ -12,4 +12,5 @@ end
target :Example do
project "Example"
pod "QuickTableViewController", path: "./"
+ pod "Weakify", git: "https://github.com/klundberg/Weakify.git", tag: "v0.4.0"
end
diff --git a/Podfile.lock b/Podfile.lock
index d13c91bb..551f93a1 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -1,12 +1,14 @@
PODS:
- Nimble (6.1.0)
- Quick (1.1.0)
- - QuickTableViewController (0.5.2)
+ - QuickTableViewController (0.5.3)
+ - Weakify (0.4.0)
DEPENDENCIES:
- Nimble (from `https://github.com/Quick/Nimble.git`, tag `v6.1.0`)
- Quick (from `https://github.com/Quick/Quick.git`, tag `v1.1.0`)
- QuickTableViewController (from `./`)
+ - Weakify (from `https://github.com/klundberg/Weakify.git`, tag `v0.4.0`)
EXTERNAL SOURCES:
Nimble:
@@ -17,6 +19,9 @@ EXTERNAL SOURCES:
:tag: v1.1.0
QuickTableViewController:
:path: "./"
+ Weakify:
+ :git: https://github.com/klundberg/Weakify.git
+ :tag: v0.4.0
CHECKOUT OPTIONS:
Nimble:
@@ -25,12 +30,16 @@ CHECKOUT OPTIONS:
Quick:
:git: https://github.com/Quick/Quick.git
:tag: v1.1.0
+ Weakify:
+ :git: https://github.com/klundberg/Weakify.git
+ :tag: v0.4.0
SPEC CHECKSUMS:
Nimble: 46fc2a2c3f2f5bb5e2d7e89756fb710c1457f27a
Quick: 4700beb8056662b579facd79eaca7f04fb3d48e6
- QuickTableViewController: cbaacea5a467f2e1bf83d13a716c5bbd6bc9f6b2
+ QuickTableViewController: 245898ed807cd025e5fe6882402e5b9d54c6309f
+ Weakify: 77be86c462237baa373e97fcf57d4d8637c2e614
-PODFILE CHECKSUM: a12ebb981507415ad7c19091d127cf3c2f6c6af0
+PODFILE CHECKSUM: b520bcde1e1651aa7c27f37788849ebe65f1c362
COCOAPODS: 1.2.1
diff --git a/QuickTableViewController.podspec b/QuickTableViewController.podspec
index fc6ca814..8de4e69c 100644
--- a/QuickTableViewController.podspec
+++ b/QuickTableViewController.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "QuickTableViewController"
- s.version = "0.5.2"
+ s.version = "0.5.3"
s.summary = "A simple way to create a UITableView for settings."
s.screenshots = "https://bcylin.github.io/QuickTableViewController/img/screenshot.png"
diff --git a/QuickTableViewController/Info.plist b/QuickTableViewController/Info.plist
index 0d4fc0a8..c89d5f29 100644
--- a/QuickTableViewController/Info.plist
+++ b/QuickTableViewController/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.5.2
+ 0.5.3
CFBundleSignature
????
CFBundleVersion
diff --git a/QuickTableViewControllerTests/Info.plist b/QuickTableViewControllerTests/Info.plist
index c66dcccd..24f2e09c 100644
--- a/QuickTableViewControllerTests/Info.plist
+++ b/QuickTableViewControllerTests/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 0.5.2
+ 0.5.3
CFBundleSignature
????
CFBundleVersion
diff --git a/QuickTableViewControllerTests/QuickTableViewControllerSpec.swift b/QuickTableViewControllerTests/QuickTableViewControllerSpec.swift
index 46394ae7..af7c4e4c 100644
--- a/QuickTableViewControllerTests/QuickTableViewControllerSpec.swift
+++ b/QuickTableViewControllerTests/QuickTableViewControllerSpec.swift
@@ -58,8 +58,8 @@ class QuickTableViewControllerSpec: QuickSpec {
}
it("should register table view cell classes") {
- expect(tableView.dequeueReusableCell(withIdentifier: "SwitchCell")).to(beAnInstanceOf(SwitchCell.self))
- expect(tableView.dequeueReusableCell(withIdentifier: "TapActionCell")).to(beAnInstanceOf(TapActionCell.self))
+ expect(tableView.dequeueReusableCell(withIdentifier: "QuickTableViewController.SwitchCell")).to(beAnInstanceOf(SwitchCell.self))
+ expect(tableView.dequeueReusableCell(withIdentifier: "QuickTableViewController.TapActionCell")).to(beAnInstanceOf(TapActionCell.self))
expect(tableView.dequeueReusableCell(withIdentifier: "UITableViewCell")).to(beAnInstanceOf(UITableViewCell.self))
}
diff --git a/QuickTableViewControllerTests/SwitchRowSpec.swift b/QuickTableViewControllerTests/SwitchRowSpec.swift
index dcc12e83..ab08bef9 100644
--- a/QuickTableViewControllerTests/SwitchRowSpec.swift
+++ b/QuickTableViewControllerTests/SwitchRowSpec.swift
@@ -38,7 +38,7 @@ class SwitchRowSpec: QuickSpec {
it("should initialize with given parameters") {
expect(row.title) == "title"
expect(row.switchValue) == true
- expect(row.cellReuseIdentifier) == "SwitchCell"
+ expect(row.cellReuseIdentifier) == "QuickTableViewController.SwitchCell"
expect(row.action).notTo(beNil())
row.action?(row)
diff --git a/QuickTableViewControllerTests/TapActionRowSpec.swift b/QuickTableViewControllerTests/TapActionRowSpec.swift
index 6657d73a..58ef5a2e 100644
--- a/QuickTableViewControllerTests/TapActionRowSpec.swift
+++ b/QuickTableViewControllerTests/TapActionRowSpec.swift
@@ -37,7 +37,7 @@ class TapActionRowSpec: QuickSpec {
it("should initialize with given parameters") {
expect(row.title) == "title"
- expect(row.cellReuseIdentifier) == "TapActionCell"
+ expect(row.cellReuseIdentifier) == "QuickTableViewController.TapActionCell"
expect(row.action).notTo(beNil())
row.action?(row)
diff --git a/README.md b/README.md
index 95ccd46f..df8e8577 100644
--- a/README.md
+++ b/README.md
@@ -37,13 +37,13 @@ class ViewController: QuickTableViewController {
]),
Section(title: "Tap Action", rows: [
- TapActionRow(title: "Tap action", action: showAlert)
+ TapActionRow(title: "Tap action", action: { [weak self] in self?.showAlert($0) })
]),
Section(title: "Cell Styles", rows: [
NavigationRow(title: "CellStyle.Default", subtitle: .None, icon: Icon(image: UIImage(named: "exit"), highlightedImage: UIImage(named: "exit-highlighted"))),
NavigationRow(title: "CellStyle", subtitle: .BelowTitle(".Subtitle"), icon: Icon(image: UIImage(named: "language"))),
- NavigationRow(title: "CellStyle", subtitle: .RightAligned(".Value1"), icon: Icon(imageName: "timeMachine"), action: showDetail),
+ NavigationRow(title: "CellStyle", subtitle: .RightAligned(".Value1"), icon: Icon(imageName: "timeMachine"), action: { [weak self] in self?.showDetail($0) }),
NavigationRow(title: "CellStyle", subtitle: .LeftAligned(".Value2"))
])
]
@@ -122,14 +122,18 @@ tableView.register(CustomCell.self, forCellReuseIdentifier: "Subtitle.None")
tableView.register(CustomSubtitleCell.self, forCellReuseIdentifier: "Subtitle.BelowTitle")
tableView.register(CustomValue1StyleCell.self, forCellReuseIdentifier: "Subtitle.RightAligned")
tableView.register(CustomValue2StyleCell.self, forCellReuseIdentifier: "Subtitle.LeftAligned")
+```
+```swift
// SwitchRow
-tableView.register(CustomSwitchCell.self, forCellReuseIdentifier: "SwitchCell")
+tableView.register(CustomSwitchCell.self, forCellReuseIdentifier: NSStringFromClass(SwitchCell.self))
// TapActionRow
-tableView.register(CustomTapActionCell.self, forCellReuseIdentifier: "TapActionCell")
+tableView.register(CustomTapActionCell.self, forCellReuseIdentifier: NSStringFromClass(TapActionCell.self))
```
+> Note: in `0.5.1` & `0.5.2`, **SwitchRow** and **TapActionRow** were using `String(describing: SwitchCell.self)` and `String(describing: TapActionCell.self)` as reuse identifiers. Fixed in `0.5.3` for backward compatibility.
+
### Full Documentation
diff --git a/Source/NavigationRow.swift b/Source/NavigationRow.swift
index 088cab47..09a5d677 100644
--- a/Source/NavigationRow.swift
+++ b/Source/NavigationRow.swift
@@ -40,7 +40,7 @@ public struct NavigationRow: Row, Equatable, IconEnabled {
/// Returns `subtitle.style` as the reuse identifier of the table view cell to display the row.
public var cellReuseIdentifier: String {
- return subtitle?.style ?? String(describing: UITableViewCell.self)
+ return subtitle?.style ?? NSStringFromClass(UITableViewCell.self)
}
/// A closure related to the navigation when the row is selected.
diff --git a/Source/QuickTableViewController.swift b/Source/QuickTableViewController.swift
index 7f7a374e..b7450580 100644
--- a/Source/QuickTableViewController.swift
+++ b/Source/QuickTableViewController.swift
@@ -73,9 +73,9 @@ open class QuickTableViewController: UIViewController,
tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
tableView.dataSource = self
tableView.delegate = self
- tableView.register(SwitchCell.self, forCellReuseIdentifier: String(describing: SwitchCell.self))
- tableView.register(TapActionCell.self, forCellReuseIdentifier: String(describing: TapActionCell.self))
- tableView.register(UITableViewCell.self, forCellReuseIdentifier: String(describing: UITableViewCell.self))
+ tableView.register(SwitchCell.self, forCellReuseIdentifier: NSStringFromClass(SwitchCell.self))
+ tableView.register(TapActionCell.self, forCellReuseIdentifier: NSStringFromClass(TapActionCell.self))
+ tableView.register(UITableViewCell.self, forCellReuseIdentifier: NSStringFromClass(UITableViewCell.self))
}
open override func viewWillAppear(_ animated: Bool) {
@@ -148,7 +148,7 @@ open class QuickTableViewController: UIViewController,
}
cell?.textLabel?.text = row.title
- return cell ?? tableView.dequeueReusableCell(withIdentifier: String(describing: UITableViewCell.self), for: indexPath)
+ return cell ?? tableView.dequeueReusableCell(withIdentifier: NSStringFromClass(UITableViewCell.self), for: indexPath)
}
open func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
diff --git a/Source/SwitchRow.swift b/Source/SwitchRow.swift
index abaa69db..c32bb18b 100644
--- a/Source/SwitchRow.swift
+++ b/Source/SwitchRow.swift
@@ -46,7 +46,7 @@ public struct SwitchRow: Row, Equatable, IconEnabled {
}
/// The value is **SwitchCell**, as the reuse identifier of the table view cell to display the row.
- public let cellReuseIdentifier: String = String(describing: SwitchCell.self)
+ public let cellReuseIdentifier: String = NSStringFromClass(SwitchCell.self)
/// A closure that will be invoked when the switchValue is changed.
public var action: ((Row) -> Void)?
diff --git a/Source/TapActionRow.swift b/Source/TapActionRow.swift
index c38abf18..1ba8a473 100644
--- a/Source/TapActionRow.swift
+++ b/Source/TapActionRow.swift
@@ -36,7 +36,7 @@ public struct TapActionRow: Row, Equatable {
public let subtitle: Subtitle? = nil
/// The value is **TapActionCell**, as the reuse identifier of the table view cell to display the row.
- public let cellReuseIdentifier: String = String(describing: TapActionCell.self)
+ public let cellReuseIdentifier: String = NSStringFromClass(TapActionCell.self)
/// A closure as the tap action when the row is selected.
public var action: ((Row) -> Void)?