Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed Dec 18, 2016
1 parent 3e182a4 commit 190e046
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Hero/ClearPreprocessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import UIKit
public class ClearPreprocessor:HeroPreprocessor {
public func process(context:HeroContext, fromViews:[UIView], toViews:[UIView]) {
for view in fromViews + toViews{
guard let options = context[view, "clearSubviewClasses"] else { continue }
guard context[view, "clearSubviewClasses"] != nil else { continue }
var parentView = view
if let _ = view as? UITableView, let wrapperView = view.subviews.get(0) {
parentView = wrapperView
Expand Down
16 changes: 8 additions & 8 deletions Hero/Hero.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import UIKit

internal class Hero:NSObject {
var toViewController:UIViewController!
var fromViewController:UIViewController!
var toViewController:UIViewController?
var fromViewController:UIViewController?

var interactive:Bool = false

Expand All @@ -40,8 +40,8 @@ internal class Hero:NSObject {
fileprivate var inContainerController = false
fileprivate weak var transitionContext:UIViewControllerContextTransitioning?

fileprivate var toView:UIView { return toViewController.view }
fileprivate var fromView:UIView { return fromViewController.view }
fileprivate var toView:UIView { return toViewController!.view }
fileprivate var fromView:UIView { return fromViewController!.view }

fileprivate var context:HeroContext!
fileprivate var animatingViewContainer:UIView!
Expand Down Expand Up @@ -98,18 +98,18 @@ internal extension Hero {
}

if let delegate = fromViewController as? HeroViewControllerDelegate{
delegate.heroWillStartAnimatingTo?(viewController: toViewController)
delegate.heroWillStartAnimatingTo?(viewController: toViewController!)
}
if let navigationController = fromViewController as? UINavigationController,
let delegate = navigationController.topViewController as? HeroViewControllerDelegate{
delegate.heroWillStartAnimatingTo?(viewController: toViewController)
delegate.heroWillStartAnimatingTo?(viewController: toViewController!)
}
if let delegate = toViewController as? HeroViewControllerDelegate{
delegate.heroWillStartAnimatingFrom?(viewController: fromViewController)
delegate.heroWillStartAnimatingFrom?(viewController: fromViewController!)
}
if let navigationController = toViewController as? UINavigationController,
let delegate = navigationController.topViewController as? HeroViewControllerDelegate{
delegate.heroWillStartAnimatingFrom?(viewController: fromViewController)
delegate.heroWillStartAnimatingFrom?(viewController: fromViewController!)
}

transitionContainer.isUserInteractionEnabled = false
Expand Down
2 changes: 1 addition & 1 deletion Hero/HeroDebugPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class HeroDebugPlugin: HeroPlugin {
}

public override func resume(from progress: Double, reverse: Bool) -> TimeInterval {
guard let interactiveContext = interactiveContext, let debugView = debugView else { return 0.4 }
guard interactiveContext != nil, let debugView = debugView else { return 0.4 }
debugView.delegate = nil

UIView.animate(withDuration: 0.4){
Expand Down
4 changes: 2 additions & 2 deletions Hero/HeroDefaultAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class HeroDefaultAnimator:HeroAnimator{

public func resume(from progress:Double, reverse:Bool) -> TimeInterval{
paused = false
var timePassed = (reverse ? 1 - progress : progress) * duration
let timePassed = (reverse ? 1 - progress : progress) * duration

var neededTime:TimeInterval = self.duration - timePassed
for (layer, anim) in removedAnimations{
Expand Down Expand Up @@ -80,7 +80,7 @@ public class HeroDefaultAnimator:HeroAnimator{
group.beginTime = layer.convertTime(CACurrentMediaTime(), from: nil) + delay - timePassed
}
}
for (layer, (delay, group)) in animationGroups{
for (layer, (_, group)) in animationGroups{
layer.removeAnimation(forKey: "hero")
layer.add(group, forKey: "hero")
}
Expand Down
2 changes: 0 additions & 2 deletions Hero/SourceIDPreprocessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class SourceIDPreprocessor:HeroPreprocessor {
extension SourceIDPreprocessor {
fileprivate func prepareFor(view:UIView, targetView:UIView, context:HeroContext){
let targetPos = context.container.layer.convert(targetView.layer.position, from: targetView.layer.superlayer)
let targetAnchor = targetView.layer.anchorPoint
let targetFrame = context.container.convert(targetView.bounds, from: targetView)

context[view, "position"] = targetPos.modifierParameters
if view.bounds != targetView.bounds{
Expand Down

0 comments on commit 190e046

Please sign in to comment.