Skip to content

Commit edeb1ea

Browse files
committed
Initial commit
0 parents  commit edeb1ea

18 files changed

+1313
-0
lines changed

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Xcode
2+
#
3+
build/
4+
*.pbxuser
5+
!default.pbxuser
6+
*.mode1v3
7+
!default.mode1v3
8+
*.mode2v3
9+
!default.mode2v3
10+
*.perspectivev3
11+
!default.perspectivev3
12+
xcuserdata
13+
*.xccheckout
14+
*.moved-aside
15+
DerivedData
16+
*.hmap
17+
*.ipa
18+
*.xcuserstate
19+
20+
# CocoaPods
21+
#
22+
# We recommend against adding the Pods directory to your .gitignore. However
23+
# you should judge for yourself, the pros and cons are mentioned at:
24+
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25+
#
26+

Classes/CKWaveCollectionViewAnimator.swift

+306
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// UIApplicationExtension.swift
3+
// CKWaveCollectionViewTransition
4+
//
5+
// Created by Salvation on 7/21/15.
6+
// Copyright (c) 2015 CezaryKopacz. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
extension UIApplication {
12+
13+
static func statusBarHeight() -> CGFloat {
14+
15+
let kStatusBarHeight: CGFloat = CGRectGetHeight(UIApplication.sharedApplication().statusBarFrame)
16+
let statusBarVisible = !UIApplication.sharedApplication().statusBarHidden
17+
return statusBarVisible ? kStatusBarHeight : 0
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// UICollectionViewExtension.swift
3+
// CKWaveCollectionViewTransition
4+
//
5+
// Created by Salvation on 7/21/15.
6+
// Copyright (c) 2015 CezaryKopacz. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import ObjectiveC
11+
12+
private var selectedIndexPathAssociationKey: UInt8 = 0
13+
private var fromPointAssociationKey: UInt8 = 1
14+
15+
extension UICollectionViewController {
16+
17+
var selectedIndexPath: NSIndexPath! {
18+
get {
19+
return objc_getAssociatedObject(self, &selectedIndexPathAssociationKey) as? NSIndexPath
20+
}
21+
set(newValue) {
22+
objc_setAssociatedObject(self, &selectedIndexPathAssociationKey, newValue, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN))
23+
}
24+
}
25+
26+
var fromPoint: CGPoint! {
27+
get {
28+
let value = objc_getAssociatedObject(self, &fromPointAssociationKey) as? NSValue
29+
return value!.CGPointValue()
30+
}
31+
set(newValue) {
32+
let value = NSValue(CGPoint: newValue)
33+
objc_setAssociatedObject(self, &fromPointAssociationKey, value, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN))
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// UICollectionViewExtension.swift
3+
// CKWaveCollectionViewTransition
4+
//
5+
// Created by Salvation on 7/21/15.
6+
// Copyright (c) 2015 CezaryKopacz. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
extension UICollectionView {
12+
13+
func numberOfVisibleRowsAndColumn() -> (rows: Int, columns: Int) {
14+
15+
var rows = 1
16+
var columns = 0
17+
var currentWidth: CGFloat = 0.0
18+
19+
let visibleCells = self.visibleCells() as? Array<UICollectionViewCell>
20+
21+
for cell in visibleCells! {
22+
23+
if (currentWidth + cell.frame.size.width) < self.frame.size.width {
24+
currentWidth += cell.frame.size.width
25+
if rows == 1 { //we only care about first row
26+
27+
columns++
28+
}
29+
} else {
30+
rows++
31+
currentWidth = cell.frame.size.width
32+
}
33+
}
34+
35+
return (rows, columns)
36+
}
37+
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// UIViewControllerExtension.swift
3+
// CKWaveCollectionViewTransition
4+
//
5+
// Created by Salvation on 7/21/15.
6+
// Copyright (c) 2015 CezaryKopacz. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
extension UIViewController {
12+
13+
func navigationBarHeight() -> CGFloat {
14+
15+
let kNavigationBarHeight: CGFloat = 44.0
16+
17+
var navigationBarVisible = true
18+
if let navigationController = self.navigationController {
19+
navigationBarVisible = !navigationController.navigationBarHidden
20+
}
21+
22+
return navigationBarVisible ? kNavigationBarHeight : 0
23+
}
24+
}

0 commit comments

Comments
 (0)