From cc3d13913888b022e45b32aa414ca40e18911d68 Mon Sep 17 00:00:00 2001 From: Denys Telezhkin Date: Fri, 28 Oct 2016 18:07:36 +0300 Subject: [PATCH] Xcode 8.1 / Swift 3.0.1 fixes. Bump to 5.1.0 --- CHANGELOG.md | 4 +++- Cartfile | 2 +- Cartfile.resolved | 4 ++-- Carthage/Checkouts/DTModelStorage | 2 +- Carthage/Checkouts/realm-cocoa | 2 +- DTCollectionViewManager.podspec | 4 ++-- LICENSE | 2 +- README.md | 6 +++--- Source/DTCollectionViewManager.swift | 10 +++++----- Tests/CollectionViewFactoryTestCase.swift | 2 +- 10 files changed, 20 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2479ccc..8a9cdc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. -## Next +## [5.1.0](https://github.com/DenHeadless/DTCollectionViewManager/releases/tag/5.1.0) + +Dependency changelog -> [DTModelStorage 4.0.0 and higher](https://github.com/DenHeadless/DTModelStorage/releases) * `CollectionViewUpdater` has been rewritten to use new `StorageUpdate` properties that track changes in order of their occurence. * `CollectionViewUpdater` `reloadItemClosure` and `DTCollectionViewManager` `updateCellClosure` now accept indexPath and model instead of just indexPath. This is done because update may happen after insertions and deletions and object that needs to be updated may exist on different indexPath. diff --git a/Cartfile b/Cartfile index 20c8fca..1a496c8 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "DenHeadless/DTModelStorage" "3.0.0" +github "DenHeadless/DTModelStorage" "4.0.0" diff --git a/Cartfile.resolved b/Cartfile.resolved index 64c521a..f5c617e 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ github "Quick/Nimble" "v5.1.0" -github "realm/realm-cocoa" "v2.0.2" -github "DenHeadless/DTModelStorage" "3.0.0" +github "realm/realm-cocoa" "v2.0.3" +github "DenHeadless/DTModelStorage" "4.0.0" diff --git a/Carthage/Checkouts/DTModelStorage b/Carthage/Checkouts/DTModelStorage index def3dac..7b87055 160000 --- a/Carthage/Checkouts/DTModelStorage +++ b/Carthage/Checkouts/DTModelStorage @@ -1 +1 @@ -Subproject commit def3dac51f25f069ab699a8c3462b448583016d5 +Subproject commit 7b87055c572254eba4b383e976239d9c00c862b6 diff --git a/Carthage/Checkouts/realm-cocoa b/Carthage/Checkouts/realm-cocoa index dcc6653..bfcd87e 160000 --- a/Carthage/Checkouts/realm-cocoa +++ b/Carthage/Checkouts/realm-cocoa @@ -1 +1 @@ -Subproject commit dcc6653205e796d4bfc79082d3c9b1849d263ab5 +Subproject commit bfcd87e6757570f1eed23fc5c1842116978810d3 diff --git a/DTCollectionViewManager.podspec b/DTCollectionViewManager.podspec index 6f632c4..13a5c0c 100644 --- a/DTCollectionViewManager.podspec +++ b/DTCollectionViewManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'DTCollectionViewManager' - s.version = '5.0.0' + s.version = '5.1.0' s.license = 'MIT' s.summary = 'Protocol-oriented UICollectionView management, powered by generics and associated types.' s.homepage = 'https://github.com/DenHeadless/DTCollectionViewManager' @@ -12,5 +12,5 @@ Pod::Spec.new do |s| s.ios.deployment_target = '8.0' s.tvos.deployment_target = '9.0' s.frameworks = 'UIKit', 'Foundation' - s.dependency 'DTModelStorage' , '~> 3.0.0' + s.dependency 'DTModelStorage' , '~> 4.0' end diff --git a/LICENSE b/LICENSE index bf6097b..d722cb5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 DenHeadless +Copyright (c) 2013 - 2016 Denys Telezhkin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 58720b1..aae77f7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg)]() -DTCollectionViewManager 5 +DTCollectionViewManager ================ > This is a sister-project for [DTTableViewManager](https://github.com/DenHeadless/DTTableViewManager) - great tool for UITableView management, built on the same principles. @@ -54,11 +54,11 @@ Powerful generic-based UICollectionView management framework, written in Swift 3 [CocoaPods](http://www.cocoapods.org): - pod 'DTCollectionViewManager', '~> 5.0.0' + pod 'DTCollectionViewManager', '~> 5.1' [Carthage](https://github.com/Carthage/Carthage): - github "DenHeadless/DTCollectionViewManager" ~> 5.0.0 + github "DenHeadless/DTCollectionViewManager" ~> 5.1.0 After running `carthage update` drop DTCollectionViewManager.framework and DTModelStorage.framework to Xcode project embedded binaries. diff --git a/Source/DTCollectionViewManager.swift b/Source/DTCollectionViewManager.swift index d4ce480..34b9808 100644 --- a/Source/DTCollectionViewManager.swift +++ b/Source/DTCollectionViewManager.swift @@ -603,7 +603,7 @@ extension DTCollectionViewManager : UICollectionViewDataSource } open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let model = RuntimeHelper.recursivelyUnwrapAnyValue(storage.item(at: indexPath)) else { + guard let item = storage.item(at: indexPath), let model = RuntimeHelper.recursivelyUnwrapAnyValue(item) else { handleCollectionViewFactoryError(DTCollectionViewFactoryError.nilCellModel(indexPath)) return UICollectionViewCell() } @@ -787,22 +787,22 @@ extension DTCollectionViewManager : UICollectionViewDelegateFlowLayout } open func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool { - guard let model = RuntimeHelper.recursivelyUnwrapAnyValue(storage.item(at: indexPath)), + guard let item = storage.item(at: indexPath), let model = RuntimeHelper.recursivelyUnwrapAnyValue(item), let cell = collectionView.cellForItem(at: indexPath) else { return false } if let reaction = collectionViewReactions.reaction(of: .cell, signature: EventMethodSignature.canPerformActionForItemAtIndexPath.rawValue, forModel: model) as? FiveArgumentsEventReaction { - return reaction.performWithArguments((action,sender,cell,model,indexPath)) as? Bool ?? false + return reaction.performWithArguments((action,sender as Any,cell,model,indexPath)) as? Bool ?? false } return (delegate as? UICollectionViewDelegate)?.collectionView?(collectionView, canPerformAction: action, forItemAt: indexPath, withSender: sender) ?? false } open func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) { defer { (delegate as? UICollectionViewDelegate)?.collectionView?(collectionView, performAction: action, forItemAt: indexPath, withSender: sender) } - guard let model = RuntimeHelper.recursivelyUnwrapAnyValue(storage.item(at: indexPath)), + guard let item = storage.item(at: indexPath), let model = RuntimeHelper.recursivelyUnwrapAnyValue(item), let cell = collectionView.cellForItem(at: indexPath) else { return } if let reaction = collectionViewReactions.reaction(of: .cell, signature: EventMethodSignature.performActionForItemAtIndexPath.rawValue, forModel: model) as? FiveArgumentsEventReaction { - _ = reaction.performWithArguments((action,sender,cell,model,indexPath)) + _ = reaction.performWithArguments((action,sender as Any,cell,model,indexPath)) } } diff --git a/Tests/CollectionViewFactoryTestCase.swift b/Tests/CollectionViewFactoryTestCase.swift index 53230e6..7021909 100644 --- a/Tests/CollectionViewFactoryTestCase.swift +++ b/Tests/CollectionViewFactoryTestCase.swift @@ -53,7 +53,7 @@ class CollectionViewFactoryTestCase: XCTestCase { func testNilHeaderFooterModel() { let model: Int? = nil do { - try _ = controller.manager.viewFactory.supplementaryViewOfKind("Foo", forModel: model, atIndexPath: indexPath(0, 0)) + try _ = controller.manager.viewFactory.supplementaryViewOfKind("Foo", forModel: model as Any, atIndexPath: indexPath(0, 0)) } catch DTCollectionViewFactoryError.nilSupplementaryModel(let kind, let indexPath) { expect(kind) == "Foo" expect(indexPath) == IndexPath(item: 0, section: 0)