Skip to content

Commit

Permalink
fix flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed Jun 6, 2018
1 parent 0918c28 commit f4dab9e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Animator/HeroCoreAnimationViewContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ extension CALayer {
let copiedAnim = anim.copy() as! CAAnimation
copiedAnim.delegate = nil // having delegate resulted some weird animation behavior
CALayer.heroAddedAnimations!.append((self, forKey!, copiedAnim))
hero_add(anim: anim, forKey: forKey)
} else {
hero_add(anim: anim, forKey: forKey)
}
Expand Down

1 comment on commit f4dab9e

@happiness9721
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about merge line 43 and 45, the full function will be looks like:

@objc dynamic func hero_add(anim: CAAnimation, forKey: String?) {
  if CALayer.heroAddedAnimations != nil {
    let copiedAnim = anim.copy() as! CAAnimation
    copiedAnim.delegate = nil // having delegate resulted some weird animation behavior
    CALayer.heroAddedAnimations!.append((self, forKey!, copiedAnim))
  }
  hero_add(anim: anim, forKey: forKey)
}

Please sign in to comment.