From 24a7f0589f87452aff60e99cd78334c68131ecc1 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Mon, 3 Oct 2016 13:25:44 +0300 Subject: [PATCH] fix warnings --- .../Controllers/NibCellsController.swift | 4 +-- Sources/HeightStrategy.swift | 8 +++--- Sources/Operators.swift | 14 +++++----- Sources/TableCellRegisterer.swift | 4 +-- Sources/TableDirector.swift | 26 +++++++++---------- Sources/TableRow.swift | 8 +++--- Sources/TableRowAction.swift | 2 +- Sources/TableSection.swift | 2 +- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Demo/Classes/Presentation/Controllers/NibCellsController.swift b/Demo/Classes/Presentation/Controllers/NibCellsController.swift index 5309ebf..e4edd0b 100644 --- a/Demo/Classes/Presentation/Controllers/NibCellsController.swift +++ b/Demo/Classes/Presentation/Controllers/NibCellsController.swift @@ -28,6 +28,6 @@ class NibCellsController: UITableViewController { let rows: [Row] = numbers.map { TableRow(item: $0, actions: [shouldHighlightAction]) } - tableDirector.append(rows: rows) + _ = tableDirector.append(rows: rows) } -} \ No newline at end of file +} diff --git a/Sources/HeightStrategy.swift b/Sources/HeightStrategy.swift index 017d9a6..850dde9 100644 --- a/Sources/HeightStrategy.swift +++ b/Sources/HeightStrategy.swift @@ -30,10 +30,10 @@ public protocol CellHeightCalculatable { open class PrototypeHeightStrategy: CellHeightCalculatable { - fileprivate weak var tableView: UITableView? - fileprivate var prototypes = [String: UITableViewCell]() - fileprivate var cachedHeights = [Int: CGFloat]() - fileprivate var separatorHeight = 1 / UIScreen.main.scale + private weak var tableView: UITableView? + private var prototypes = [String: UITableViewCell]() + private var cachedHeights = [Int: CGFloat]() + private var separatorHeight = 1 / UIScreen.main.scale init(tableView: UITableView?) { self.tableView = tableView diff --git a/Sources/Operators.swift b/Sources/Operators.swift index 3f0f555..f4e719d 100644 --- a/Sources/Operators.swift +++ b/Sources/Operators.swift @@ -20,27 +20,27 @@ // -- public func +=(left: TableDirector, right: TableSection) { - left.append(section: right) + _ = left.append(section: right) } public func +=(left: TableDirector, right: [TableSection]) { - left.append(sections: right) + _ = left.append(sections: right) } // -- public func +=(left: TableDirector, right: Row) { - left.append(sections: [TableSection(rows: [right])]) + _ = left.append(sections: [TableSection(rows: [right])]) } public func +=(left: TableDirector, right: [Row]) { - left.append(sections: [TableSection(rows: right)]) + _ = left.append(sections: [TableSection(rows: right)]) } // -- public func +=(left: TableSection, right: Row) { - left.append(row: right) + _ = left.append(row: right) } public func +=(left: TableSection, right: [Row]) { - left.append(rows: right) -} \ No newline at end of file + _ = left.append(rows: right) +} diff --git a/Sources/TableCellRegisterer.swift b/Sources/TableCellRegisterer.swift index 88c95a5..17928b8 100644 --- a/Sources/TableCellRegisterer.swift +++ b/Sources/TableCellRegisterer.swift @@ -22,8 +22,8 @@ import UIKit class TableCellRegisterer { - fileprivate var registeredIds = Set() - fileprivate weak var tableView: UITableView? + private var registeredIds = Set() + private weak var tableView: UITableView? init(tableView: UITableView?) { self.tableView = tableView diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index 16f9db2..3cda756 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -25,12 +25,12 @@ import UIKit */ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { - open fileprivate(set) weak var tableView: UITableView? - open fileprivate(set) var sections = [TableSection]() + open private(set) weak var tableView: UITableView? + open private(set) var sections = [TableSection]() - fileprivate weak var scrollDelegate: UIScrollViewDelegate? - fileprivate var heightStrategy: CellHeightCalculatable? - fileprivate var cellRegisterer: TableCellRegisterer? + private weak var scrollDelegate: UIScrollViewDelegate? + private var heightStrategy: CellHeightCalculatable? + private var cellRegisterer: TableCellRegisterer? open var shouldUsePrototypeCellHeightCalculation: Bool = false { didSet { @@ -90,7 +90,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { func didReceiveAction(_ notification: Notification) { guard let action = notification.object as? TableCellAction, let indexPath = tableView?.indexPath(for: action.cell) else { return } - invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath) + _ = invoke(action: .custom(action.key), cell: action.cell, indexPath: indexPath) } // MARK: - Height @@ -134,7 +134,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { } row.configure(cell) - invoke(action: .configure, cell: cell, indexPath: indexPath) + _ = invoke(action: .configure, cell: cell, indexPath: indexPath) return cell } @@ -180,16 +180,16 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { if invoke(action: .click, cell: cell, indexPath: indexPath) != nil { tableView.deselectRow(at: indexPath, animated: true) } else { - invoke(action: .select, cell: cell, indexPath: indexPath) + _ = invoke(action: .select, cell: cell, indexPath: indexPath) } } open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) { - invoke(action: .deselect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) + _ = invoke(action: .deselect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) } open func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { - invoke(action: .willDisplay, cell: cell, indexPath: indexPath) + _ = invoke(action: .willDisplay, cell: cell, indexPath: indexPath) } open func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool { @@ -217,7 +217,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { open func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { - invoke(action: .clickDelete, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) + _ = invoke(action: .clickDelete, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) } } @@ -225,7 +225,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { open func append(section: TableSection) -> Self { - append(sections: [section]) + _ = append(sections: [section]) return self } @@ -237,7 +237,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { open func append(rows: [Row]) -> Self { - append(section: TableSection(rows: rows)) + _ = append(section: TableSection(rows: rows)) return self } diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index c66ca1b..ad440b3 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -51,8 +51,8 @@ public protocol Row: RowConfigurable, RowActionable, RowHashable { open class TableRow: Row where CellType.T == ItemType, CellType: UITableViewCell { open let item: ItemType - fileprivate lazy var actions = [String: TableRowAction]() - fileprivate(set) open var editingActions: [UITableViewRowAction]? + private lazy var actions = [String: TableRowAction]() + private(set) open var editingActions: [UITableViewRowAction]? open var hashValue: Int { return ObjectIdentifier(self).hashValue @@ -113,9 +113,9 @@ open class TableRow: Row where CellType.T return self } - open func action(_ type: TableRowActionType, handler: (_ data: TableRowActionData) -> T) -> Self { + open func action(_ type: TableRowActionType, handler: @escaping (_ data: TableRowActionData) -> T) -> Self { - //actions[type.key] = TableRowAction(type, handler: handler) + actions[type.key] = TableRowAction(type, handler: handler) return self } } diff --git a/Sources/TableRowAction.swift b/Sources/TableRowAction.swift index 6228355..c4bafdb 100644 --- a/Sources/TableRowAction.swift +++ b/Sources/TableRowAction.swift @@ -64,7 +64,7 @@ open class TableRowActionData where CellTy open class TableRowAction where CellType.T == ItemType, CellType: UITableViewCell { open let type: TableRowActionType - fileprivate let handler: ((_ data: TableRowActionData) -> Any?)? + private let handler: ((_ data: TableRowActionData) -> Any?)? public init(_ type: TableRowActionType, handler: @escaping (_ data: TableRowActionData) -> Void) { diff --git a/Sources/TableSection.swift b/Sources/TableSection.swift index a229ccb..127ee0e 100644 --- a/Sources/TableSection.swift +++ b/Sources/TableSection.swift @@ -22,7 +22,7 @@ import UIKit open class TableSection { - open fileprivate(set) var rows = [Row]() + open private(set) var rows = [Row]() open var headerTitle: String? open var footerTitle: String?