diff --git a/.gitignore b/.gitignore
index d534044..a4b4a49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,3 +65,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
+.DS_Store
diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/Configs/Owl.plist b/Configs/Owl.plist
index 42063e9..5eb0141 100644
--- a/Configs/Owl.plist
+++ b/Configs/Owl.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.0.4
+ $(MARKETING_VERSION)
CFBundleSignature
????
CFBundleVersion
diff --git a/Owl.xcodeproj/project.pbxproj b/Owl.xcodeproj/project.pbxproj
index 3341838..44d0f06 100644
--- a/Owl.xcodeproj/project.pbxproj
+++ b/Owl.xcodeproj/project.pbxproj
@@ -898,6 +898,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ CURRENT_PROJECT_VERSION = 0;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -906,6 +907,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MARKETING_VERSION = 1.1.1;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.Owl.Owl-iOS";
PRODUCT_NAME = Owl;
@@ -921,6 +923,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ CURRENT_PROJECT_VERSION = 0;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -929,6 +932,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MARKETING_VERSION = 1.1.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.Owl.Owl-iOS";
PRODUCT_NAME = Owl;
SKIP_INSTALL = YES;
diff --git a/OwlKit.podspec b/OwlKit.podspec
index 3cc54a7..b91f898 100644
--- a/OwlKit.podspec
+++ b/OwlKit.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OwlKit"
- s.version = "1.1.0"
+ s.version = "1.1.1"
s.summary = "A declarative type-safe framework for building fast and flexible list with Tables & Collections"
s.description = <<-DESC
Owl offers a data-driven declarative approach for building fast & flexible list in iOS. It supports both UICollectionView & UITableView; UIStackView is on the way!.
diff --git a/Package.swift b/Package.swift
index aef9c2b..2099822 100644
--- a/Package.swift
+++ b/Package.swift
@@ -5,6 +5,7 @@ import PackageDescription
let package = Package(
name: "Owl",
+ platforms: [.iOS(.v10)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
diff --git a/Sources/Owl/Collection/Cell Adapter/CollectionCellAdapter+Events.swift b/Sources/Owl/Collection/Cell Adapter/CollectionCellAdapter+Events.swift
index d5e9816..d9449e5 100644
--- a/Sources/Owl/Collection/Cell Adapter/CollectionCellAdapter+Events.swift
+++ b/Sources/Owl/Collection/Cell Adapter/CollectionCellAdapter+Events.swift
@@ -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? {
@@ -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
}
diff --git a/Sources/Owl/Collection/CollectionDirector.swift b/Sources/Owl/Collection/CollectionDirector.swift
index 72f04ac..77f447d 100644
--- a/Sources/Owl/Collection/CollectionDirector.swift
+++ b/Sources/Owl/Collection/CollectionDirector.swift
@@ -391,8 +391,10 @@ public extension CollectionDirector {
}
func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
- let (model, adapter) = context(forItemAt: indexPath)
- let _ = adapter.dispatchEvent(.endDisplay, model: model, cell: cell, path: indexPath, params: nil)
+ guard let adapter = adapterForCell(cell) else {
+ return
+ }
+ let _ = adapter.dispatchEvent(.endDisplay, model: nil, cell: cell, path: indexPath, params: nil)
}
private func adapterForCellClass(_ cell: UICollectionViewCell?) -> CollectionCellAdapterProtocol? {
diff --git a/Sources/Owl/Collection/HeaderFooter Adapter/CollectionHeaderFooterAdapter.swift b/Sources/Owl/Collection/HeaderFooter Adapter/CollectionHeaderFooterAdapter.swift
index 7c17daf..6e5655f 100644
--- a/Sources/Owl/Collection/HeaderFooter Adapter/CollectionHeaderFooterAdapter.swift
+++ b/Sources/Owl/Collection/HeaderFooter Adapter/CollectionHeaderFooterAdapter.swift
@@ -30,7 +30,7 @@ public extension CollectionHeaderFooterAdapterProtocol {
}
-public class CollectionHeaderFooterAdapter: CollectionHeaderFooterAdapterProtocol {
+open class CollectionHeaderFooterAdapter: CollectionHeaderFooterAdapterProtocol {
/// This is the cell type used to dequeue the model. You should not alter it.
public var modelCellType: Any.Type = View.self
diff --git a/Sources/Owl/Shared/Protocols/ElementRepresentable.swift b/Sources/Owl/Shared/Protocols/ElementRepresentable.swift
index 02e0637..176a0de 100644
--- a/Sources/Owl/Shared/Protocols/ElementRepresentable.swift
+++ b/Sources/Owl/Shared/Protocols/ElementRepresentable.swift
@@ -31,6 +31,12 @@ public protocol Differentiable {
func isContentEqual(to other: Differentiable) -> Bool
}
+public extension Differentiable {
+ func isContentEqual(to other: Differentiable) -> Bool {
+ return self.differenceIdentifier == other.differenceIdentifier
+ }
+}
+
// MARK: - ElementRepresentable -
public protocol ElementRepresentable: Differentiable {
diff --git a/Sources/Owl/Table/Cell Adapters/TableCellAdapter+Events.swift b/Sources/Owl/Table/Cell Adapters/TableCellAdapter+Events.swift
index c2438c2..a23d466 100644
--- a/Sources/Owl/Table/Cell Adapters/TableCellAdapter+Events.swift
+++ b/Sources/Owl/Table/Cell Adapters/TableCellAdapter+Events.swift
@@ -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
}
diff --git a/Sources/Owl/Table/Header Adapter/TableHeaderFooterAdapter.swift b/Sources/Owl/Table/Header Adapter/TableHeaderFooterAdapter.swift
index dee16c3..521cd25 100644
--- a/Sources/Owl/Table/Header Adapter/TableHeaderFooterAdapter.swift
+++ b/Sources/Owl/Table/Header Adapter/TableHeaderFooterAdapter.swift
@@ -34,7 +34,7 @@ public extension TableHeaderFooterAdapterProtocol {
// MARK: - TableHeaderFooterAdapter -
-public class TableHeaderFooterAdapter: TableHeaderFooterAdapterProtocol {
+open class TableHeaderFooterAdapter: TableHeaderFooterAdapterProtocol {
// MARK: - Public Properties -
diff --git a/Sources/Owl/Table/TableDirector.swift b/Sources/Owl/Table/TableDirector.swift
index 9c1c66f..044dfa9 100644
--- a/Sources/Owl/Table/TableDirector.swift
+++ b/Sources/Owl/Table/TableDirector.swift
@@ -703,9 +703,10 @@ extension TableDirector: UITableViewDataSource, UITableViewDelegate {
}
public func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
- //let adapter = adapterForCellClass(tableView.cellForRow(at: indexPath))
- let (model, adapter) = context(forItemAt: indexPath)
- let _ = adapter.dispatchEvent(.endDisplay, model: model, cell: cell, path: indexPath, params: nil)
+ guard let adapter = adapterForCellClass(cell) else {
+ return
+ }
+ let _ = adapter.dispatchEvent(.endDisplay, model: nil, cell: cell, path: indexPath, params: nil)
}
public func tableView(_ tableView: UITableView, shouldShowMenuForRowAt indexPath: IndexPath) -> Bool {
diff --git a/Sources/Owl/Table/TableSection.swift b/Sources/Owl/Table/TableSection.swift
index 64ae303..8813b39 100644
--- a/Sources/Owl/Table/TableSection.swift
+++ b/Sources/Owl/Table/TableSection.swift
@@ -12,7 +12,7 @@
import UIKit
-public class TableSection: Equatable, Copying, DifferentiableSection {
+open class TableSection: Equatable, Copying, DifferentiableSection {
// MARK: - Public Properties -
@@ -95,7 +95,7 @@ public class TableSection: Equatable, Copying, DifferentiableSection {
// MARK: - Initialization -
- required init(original: TableSection) {
+ required public init(original: TableSection) {
self.allElements = original.allElements
self.identifier = original.identifier
self.headerTitle = original.headerTitle