Skip to content

Commit

Permalink
Support for Xcode 7.0-7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
m-revetria committed Dec 11, 2015
1 parent f1fa1a7 commit 7eaa626
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ After the dismissal animation completes, `dismissView` calls `onDidDismissView`
## Requirements

* iOS 8.0+
* Xcode 7.2+
* Xcode 7.0+

## Getting involved

Expand Down
20 changes: 10 additions & 10 deletions Source/DynamicCollectionViewFlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ public class DynamicCollectionViewFlowLayout: UICollectionViewFlowLayout {
return animator.itemsInRect(rect) as? [UICollectionViewLayoutAttributes]
}

override public func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
override public func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath?) -> UICollectionViewLayoutAttributes? {
guard let indexPath = indexPath else {
return nil
}

guard let animator = dynamicAnimator else {
return super.layoutAttributesForItemAtIndexPath(indexPath)
}
Expand All @@ -103,9 +107,9 @@ public class DynamicCollectionViewFlowLayout: UICollectionViewFlowLayout {

override public func prepareForCollectionViewUpdates(updateItems: [UICollectionViewUpdateItem]) {
super.prepareForCollectionViewUpdates(updateItems)

updateItems.filter { $0.updateAction == .Insert && layoutAttributesForItemAtIndexPath($0.indexPathAfterUpdate!) == nil } .forEach {
setupAttributesForIndexPath($0.indexPathAfterUpdate!)
updateItems.filter { $0.updateAction == .Insert && layoutAttributesForItemAtIndexPath($0.indexPathAfterUpdate) == nil } .forEach {
setupAttributesForIndexPath($0.indexPathAfterUpdate)
}
}

Expand All @@ -129,12 +133,8 @@ public class DynamicCollectionViewFlowLayout: UICollectionViewFlowLayout {
return top
}

func setupAttributesForIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
guard let animator = dynamicAnimator else {
return nil
}

guard let collectionView = collectionView else {
func setupAttributesForIndexPath(indexPath: NSIndexPath?) -> UICollectionViewLayoutAttributes? {
guard let indexPath = indexPath, animator = dynamicAnimator, collectionView = collectionView else {
return nil
}

Expand Down

0 comments on commit 7eaa626

Please sign in to comment.