Skip to content

Commit

Permalink
Merge pull request #64 from quickbirdstudios/fix/pageCoordinator-memo…
Browse files Browse the repository at this point in the history
…ry-leaks

PageCoordinator memory leaks
  • Loading branch information
pauljohanneskraft committed Feb 3, 2019
2 parents 842ea31 + 4a580fe commit d295b4c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion XCoordinator.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'XCoordinator'
spec.version = '1.2.3'
spec.version = '1.2.4'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/quickbirdstudios/XCoordinator'
spec.authors = { 'Stefan Kofler' => 'stefan.kofler@quickbirdstudios.com', 'Paul Kraft' => 'pauljohannes.kraft@quickbirdstudios.com' }
Expand Down
2 changes: 1 addition & 1 deletion XCoordinator/Classes/PageCoordinator.swift
Expand Up @@ -29,7 +29,7 @@ open class PageCoordinator<RouteType: Route>: BaseCoordinator<RouteType, PageTra
return
}

super.init(initialTransition: .set(firstPage, direction: direction))
super.init(initialTransition: .multiple(.initial(pages: pages), .set(firstPage, direction: direction)))
}

// MARK: - Overrides
Expand Down
11 changes: 11 additions & 0 deletions XCoordinator/Classes/PageTransition.swift
Expand Up @@ -22,4 +22,15 @@ extension Transition where RootViewController: UIPageViewController {
}
}
}

static func initial(pages: [Presentable]) -> Transition {
return Transition(presentables: pages, animation: nil) { _, performer, completion in
CATransaction.begin()
CATransaction.setCompletionBlock {
pages.forEach { $0.presented(from: performer) }
completion?()
}
CATransaction.commit()
}
}
}

0 comments on commit d295b4c

Please sign in to comment.