Skip to content

Commit

Permalink
meaningful associatedtype name for ConfigurableCell
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsokolov committed Jun 26, 2018
1 parent dd8e5d0 commit 1d28233
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<a href="https://travis-ci.org/maxsokolov/TableKit"><img src="https://api.travis-ci.org/maxsokolov/TableKit.svg" alt="Build Status" /></a>
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_4.0-compatible-4BC51D.svg?style=flat" alt="Swift 4.0 compatible" /></a>
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-2.6.0-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-2.7.0-blue.svg" alt="CocoaPods compatible" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://raw.githubusercontent.com/maxsokolov/tablekit/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
</p>
Expand Down
4 changes: 2 additions & 2 deletions Sources/ConfigurableCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import UIKit

public protocol ConfigurableCell {

associatedtype T
associatedtype CellData

static var reuseIdentifier: String { get }
static var estimatedHeight: CGFloat? { get }
static var defaultHeight: CGFloat? { get }

func configure(with _: T)
func configure(with _: CellData)
}

public extension ConfigurableCell where Self: UITableViewCell {
Expand Down
4 changes: 2 additions & 2 deletions Sources/TableRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UIKit

open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableViewCell {

open let item: CellType.T
open let item: CellType.CellData
private lazy var actions = [String: [TableRowAction<CellType>]]()
private(set) open var editingActions: [UITableViewRowAction]?

Expand All @@ -46,7 +46,7 @@ open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableView
return CellType.self
}

public init(item: CellType.T, actions: [TableRowAction<CellType>]? = nil, editingActions: [UITableViewRowAction]? = nil) {
public init(item: CellType.CellData, actions: [TableRowAction<CellType>]? = nil, editingActions: [UITableViewRowAction]? = nil) {

self.item = item
self.editingActions = editingActions
Expand Down
6 changes: 3 additions & 3 deletions Sources/TableRowAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import UIKit

open class TableRowActionOptions<CellType: ConfigurableCell> where CellType: UITableViewCell {

open let item: CellType.T
open let item: CellType.CellData
open let cell: CellType?
open let indexPath: IndexPath
open let userInfo: [AnyHashable: Any]?

init(item: CellType.T, cell: CellType?, path: IndexPath, userInfo: [AnyHashable: Any]?) {
init(item: CellType.CellData, cell: CellType?, path: IndexPath, userInfo: [AnyHashable: Any]?) {

self.item = item
self.cell = cell
Expand Down Expand Up @@ -76,7 +76,7 @@ open class TableRowAction<CellType: ConfigurableCell> where CellType: UITableVie
self.handler = .action(handler)
}

public func invokeActionOn(cell: UITableViewCell?, item: CellType.T, path: IndexPath, userInfo: [AnyHashable: Any]?) -> Any? {
public func invokeActionOn(cell: UITableViewCell?, item: CellType.CellData, path: IndexPath, userInfo: [AnyHashable: Any]?) -> Any? {

return handler.invoke(withOptions: TableRowActionOptions(item: item, cell: cell as? CellType, path: path, userInfo: userInfo))
}
Expand Down
2 changes: 1 addition & 1 deletion TableKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Pod::Spec.new do |s|
s.name = 'TableKit'
s.module_name = 'TableKit'

s.version = '2.6.0'
s.version = '2.7.0'

s.homepage = 'https://github.com/maxsokolov/TableKit'
s.summary = 'Type-safe declarative table views with Swift.'
Expand Down

0 comments on commit 1d28233

Please sign in to comment.