Skip to content

Commit

Permalink
Remove code and swiftier code.
Browse files Browse the repository at this point in the history
  • Loading branch information
luxorules committed Oct 16, 2015
1 parent 07972d7 commit 325a3cb
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions CardAnimation/AnimatedCardView/AnimatedCardsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,7 @@ public class AnimatedCardsView: UIView {
frontView.removeFromSuperview()
self.relayoutSubViewsAnimated(true)
})

}

// //MARK: Handle Screen Rotation
// override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
// super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
// coordinator.animateAlongsideTransition({
// _ in
// self.gradientBackgroundLayer.frame = self.view.bounds
// self.relayoutSubViews()
// }, completion: nil)
// }

}

// MARK: Card Generation
Expand Down Expand Up @@ -205,14 +193,8 @@ extension AnimatedCardsView {
private func relayoutSubView(subView:UIView, relativeIndex:Int, animated:Bool = true, delay: NSTimeInterval = 0, haveBorderWidth: Bool = true, fadeAndDelete delete: Bool = false) {
let width = Constants.DefaultSize.width
subView.layer.anchorPoint = CGPointMake(0.5, 1)

// if let nestedImageView = subView.viewWithTag(10) as? UIImageView{
// nestedImageView.image = cardImageAtIndex(viewTag - 1)
// }

subView.layer.zPosition = CGFloat(1000 - relativeIndex)


var borderWidth: CGFloat = 0
let filterSubViewConstraints = subView.constraints.filter({$0.firstAttribute == .Width && $0.secondItem == nil})
if filterSubViewConstraints.count > 0{
Expand All @@ -232,12 +214,8 @@ extension AnimatedCardsView {

subView.layer.borderWidth = haveBorderWidth ? borderWidth : 0

UIView.animateWithDuration(animated ? animationsSpeed : 0, delay: delay, options: UIViewAnimationOptions.BeginFromCurrentState, animations: {
if delete {
subView.alpha = 0
} else {
subView.alpha = self.calculateAlphaForIndex(relativeIndex)
}
UIView.animateWithDuration(animated ? animationsSpeed : 0, delay: delay, options: .BeginFromCurrentState, animations: {
subView.alpha = delete ? 0 : self.calculateAlphaForIndex(relativeIndex)
self.layoutIfNeeded()
}, completion: { _ in
if delete {
Expand Down

0 comments on commit 325a3cb

Please sign in to comment.