From eccd598a1b43f276c7de223cb2b0e92cec3c3360 Mon Sep 17 00:00:00 2001 From: Alexander Zimin Date: Sun, 6 Nov 2016 04:12:48 +0300 Subject: [PATCH] fixed memory problem with strong references --- AZTransitions.podspec | 2 +- Source/CustomModalTransition.swift | 15 ++++++++------- Source/Info.plist | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AZTransitions.podspec b/AZTransitions.podspec index bced3b3..0cec8d9 100644 --- a/AZTransitions.podspec +++ b/AZTransitions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "AZTransitions" - s.version = "0.21" + s.version = "0.22" s.summary = "Framework that helps you to work with custom modal transtions." s.description = <<-DESC With this framework can easily work with custom modal transitions. CustomModalTransition class provides you with all nesessary API, so you should only think about aniamtions. diff --git a/Source/CustomModalTransition.swift b/Source/CustomModalTransition.swift index a39c91a..e0c47af 100644 --- a/Source/CustomModalTransition.swift +++ b/Source/CustomModalTransition.swift @@ -53,8 +53,8 @@ open class CustomModalTransition: NSObject { // MARK: - Transition Parameters - public fileprivate(set) var transitionContext: UIViewControllerContextTransitioning! - public fileprivate(set) var transitionContainerView: UIView! + public fileprivate(set) weak var transitionContext: UIViewControllerContextTransitioning! + public fileprivate(set) weak var transitionContainerView: UIView! public fileprivate(set) var isPresenting: Bool = false public fileprivate(set) var isInteractive: Bool = false @@ -62,12 +62,12 @@ open class CustomModalTransition: NSObject { // You can choose any pair // Presented/preseting style view controllees - public fileprivate(set) var presentedViewController: UIViewController! - public fileprivate(set) var presentingViewController: UIViewController! + public fileprivate(set) weak var presentedViewController: UIViewController! + public fileprivate(set) weak var presentingViewController: UIViewController! // Apple style view controllers - public fileprivate(set) var fromViewController: UIViewController! - public fileprivate(set) var toViewController: UIViewController! + public fileprivate(set) weak var fromViewController: UIViewController! + public fileprivate(set) weak var toViewController: UIViewController! public func viewControllerFor(type: TransitionViewControllerType) -> UIViewController { switch type { @@ -120,6 +120,7 @@ open class CustomModalTransition: NSObject { } public func cancelInteractiveTransition() { + // http://openradar.appspot.com/14675246 interactionController.completionSpeed = 0.999 // http://stackoverflow.com/a/22968139/188461 interactionController.cancel() @@ -183,7 +184,7 @@ open class CustomModalTransition: NSObject { // MARK: - Private fileprivate var interactionController: UIPercentDrivenInteractiveTransition! - fileprivate var owningController: UIViewController! + fileprivate weak var owningController: UIViewController! } // MARK: - UIViewControllerTransitioningDelegate diff --git a/Source/Info.plist b/Source/Info.plist index 1c17c9e..c9d8ad7 100644 --- a/Source/Info.plist +++ b/Source/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.21 + 0.22 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass