Skip to content

Commit

Permalink
refs #735 cleanup crashing function code
Browse files Browse the repository at this point in the history
make loop improvements

Signed-off-by: Joseph Mattello <mail@joemattiello.com>
  • Loading branch information
JoeMatt committed May 6, 2022
1 parent e00b904 commit e00bc08
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions Sources/Transition/HeroTransition+Start.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ extension HeroTransition {
}

// There is no covariant in Swift, so we need to add plugins one by one.
for plugin in plugins {
processors.append(plugin)
animators.append(plugin)
plugins.forEach {
processors.append($0)
animators.append($0)
}

transitionContainer?.isUserInteractionEnabled = isUserInteractionEnabled
Expand All @@ -110,11 +110,11 @@ extension HeroTransition {

context = HeroContext(container: container)

for processor in processors {
processor.hero = self
processors.forEach {
$0.hero = self
}
for animator in animators {
animator.hero = self
animators.forEach {
$0.hero = self
}

if let toView = toView, let fromView = fromView, toView != fromView {
Expand Down Expand Up @@ -160,24 +160,16 @@ extension HeroTransition {
context.insertToViewFirst = true
}

for processor in processors {
processor.process(fromViews: context.fromViews, toViews: context.toViews)
processors.forEach {
$0.process(fromViews: context.fromViews, toViews: context.toViews)
}

animatingFromViews = context.fromViews.filter { (view: UIView) -> Bool in
for animator in animators {
if animator.canAnimate(view: view, appearing: false) {
return true
}
}
return false
animators.contains { $0.canAnimate(view: view, appearing: false) }
}

animatingToViews = context.toViews.filter { (view: UIView) -> Bool in
for animator in animators {
if animator.canAnimate(view: view, appearing: true) {
return true
}
}
return false
animators.contains { $0.canAnimate(view: view, appearing: true) }
}

if let toView = toView {
Expand Down

0 comments on commit e00bc08

Please sign in to comment.