fix warnings

This commit is contained in:
Max Sokolov 2016-10-03 13:25:44 +03:00
parent 3f88b6d0aa
commit 24a7f0589f
8 changed files with 34 additions and 34 deletions

View File

@ -28,6 +28,6 @@ class NibCellsController: UITableViewController {
let rows: [Row] = numbers.map { TableRow<Int, NibTableViewCell>(item: $0, actions: [shouldHighlightAction]) }
tableDirector.append(rows: rows)
_ = tableDirector.append(rows: rows)
}
}

View File

@ -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

View File

@ -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)
_ = left.append(rows: right)
}

View File

@ -22,8 +22,8 @@ import UIKit
class TableCellRegisterer {
fileprivate var registeredIds = Set<String>()
fileprivate weak var tableView: UITableView?
private var registeredIds = Set<String>()
private weak var tableView: UITableView?
init(tableView: UITableView?) {
self.tableView = tableView

View File

@ -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
}

View File

@ -51,8 +51,8 @@ public protocol Row: RowConfigurable, RowActionable, RowHashable {
open class TableRow<ItemType, CellType: ConfigurableCell>: Row where CellType.T == ItemType, CellType: UITableViewCell {
open let item: ItemType
fileprivate lazy var actions = [String: TableRowAction<ItemType, CellType>]()
fileprivate(set) open var editingActions: [UITableViewRowAction]?
private lazy var actions = [String: TableRowAction<ItemType, CellType>]()
private(set) open var editingActions: [UITableViewRowAction]?
open var hashValue: Int {
return ObjectIdentifier(self).hashValue
@ -113,9 +113,9 @@ open class TableRow<ItemType, CellType: ConfigurableCell>: Row where CellType.T
return self
}
open func action<T>(_ type: TableRowActionType, handler: (_ data: TableRowActionData<ItemType, CellType>) -> T) -> Self {
open func action<T>(_ type: TableRowActionType, handler: @escaping (_ data: TableRowActionData<ItemType, CellType>) -> T) -> Self {
//actions[type.key] = TableRowAction(type, handler: handler)
actions[type.key] = TableRowAction<ItemType, CellType>(type, handler: handler)
return self
}
}

View File

@ -64,7 +64,7 @@ open class TableRowActionData<ItemType, CellType: ConfigurableCell> where CellTy
open class TableRowAction<ItemType, CellType: ConfigurableCell> where CellType.T == ItemType, CellType: UITableViewCell {
open let type: TableRowActionType
fileprivate let handler: ((_ data: TableRowActionData<ItemType, CellType>) -> Any?)?
private let handler: ((_ data: TableRowActionData<ItemType, CellType>) -> Any?)?
public init(_ type: TableRowActionType, handler: @escaping (_ data: TableRowActionData<ItemType, CellType>) -> Void) {

View File

@ -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?