Skip to content

Commit

Permalink
Xcode 8.1 / Swift 3.0.1 fixes. Bump to 5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTelezhkin committed Oct 28, 2016
1 parent 6ce7e46 commit cc3d139
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 18 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "DenHeadless/DTModelStorage" "3.0.0"
github "DenHeadless/DTModelStorage" "4.0.0"
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/DTModelStorage
2 changes: 1 addition & 1 deletion Carthage/Checkouts/realm-cocoa
4 changes: 2 additions & 2 deletions DTCollectionViewManager.podspec
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions Source/DTCollectionViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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))
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/CollectionViewFactoryTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cc3d139

Please sign in to comment.