Skip to content

Commit

Permalink
#38 model property of the event (both for collection and cells) is no…
Browse files Browse the repository at this point in the history
…w optional because it may be nil in certain situations (ie. didEndDisplayCell events)
  • Loading branch information
malcommac committed Nov 24, 2019
1 parent 37a5a27 commit 1a362e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -20,7 +20,7 @@ public extension CollectionCellAdapter {
public let indexPath: IndexPath?

/// Represented model instance
public let element: Model
public let element: Model?

/// Managed source collection
public var collection: UICollectionView? {
Expand Down Expand Up @@ -50,7 +50,7 @@ public extension CollectionCellAdapter {
/// - path: cell's path
/// - collection: parent cell's collection instance
internal init(element: Any?, cell: Any?, path: IndexPath?) {
self.element = element as! Model
self.element = element as? Model
self.cell = cell as? Cell
self.indexPath = path
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Owl/Table/Cell Adapters/TableCellAdapter+Events.swift
Expand Up @@ -51,14 +51,14 @@ public extension TableCellAdapter {
public let indexPath: IndexPath?

// Target element of the event.
public let element: Model
public let element: Model?

// Target static typed cell if available.
// This value maybe `nil` if, at the time of the request, no cell is contextually associable with the event.
public var cell: Cell?

internal init(item: Any? = nil, cell: Any? = nil, indexPath: IndexPath? = nil) {
self.element = item as! Model
self.element = item as? Model
self.cell = cell as? Cell
self.indexPath = indexPath
}
Expand Down

0 comments on commit 1a362e3

Please sign in to comment.