From 7b3f0c28bc43ed25248fad2e197228fc815b0909 Mon Sep 17 00:00:00 2001 From: featherless Date: Tue, 28 Nov 2017 10:28:08 -0500 Subject: [PATCH] [breaking] Rename the transitionController Swift API to mdm_transitionController. (#59) This avoids creating naming conflicts with local variables defined in view controllers with a similar name. --- README.md | 4 ++-- examples/ContextualExample.swift | 2 +- examples/CustomPresentationExample.swift | 2 +- examples/FadeExample.swift | 2 +- examples/MenuExample.swift | 2 +- examples/NavControllerFadeExample.swift | 2 +- examples/PhotoAlbumExample.swift | 2 +- src/UIViewController+TransitionController.h | 3 +-- tests/unit/TransitionTests.swift | 8 ++++---- tests/unit/TransitionWithCustomDurationTests.swift | 4 ++-- tests/unit/TransitionWithPresentationTests.swift | 4 ++-- 11 files changed, 17 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 8c28a6a..06f048d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ you can pick the custom transition you want to use: ```swift let viewController = MyViewController() -viewController.transitionController.transition = CustomTransition() +viewController.mdm_transitionController.transition = CustomTransition() present(viewController, animated: true) ``` @@ -129,7 +129,7 @@ and dismissal of our view controller: ```swift let viewController = MyViewController() -viewController.transitionController.transition = FadeTransition() +viewController.mdm_transitionController.transition = FadeTransition() present(viewController, animated: true) ``` diff --git a/examples/ContextualExample.swift b/examples/ContextualExample.swift index b394263..7000b87 100644 --- a/examples/ContextualExample.swift +++ b/examples/ContextualExample.swift @@ -35,7 +35,7 @@ class ContextualExampleViewController: ExampleViewController { // Note that in this example we're populating the contextual transition with the tapped view. // Our rudimentary transition will animate the context view to the center of the screen from its // current location. - controller.transitionController.transition = CompositeTransition(transitions: [ + controller.mdm_transitionController.transition = CompositeTransition(transitions: [ FadeTransition(target: .foreView), ContextualTransition(contextView: tapGesture.view!) ]) diff --git a/examples/CustomPresentationExample.swift b/examples/CustomPresentationExample.swift index 19b959c..ee70705 100644 --- a/examples/CustomPresentationExample.swift +++ b/examples/CustomPresentationExample.swift @@ -165,7 +165,7 @@ extension CustomPresentationExampleViewController { extension CustomPresentationExampleViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let modal = ModalViewController() - modal.transitionController.transition = transitions[indexPath.row].transition + modal.mdm_transitionController.transition = transitions[indexPath.row].transition showDetailViewController(modal, sender: self) } } diff --git a/examples/FadeExample.swift b/examples/FadeExample.swift index 0c0f146..552659b 100644 --- a/examples/FadeExample.swift +++ b/examples/FadeExample.swift @@ -30,7 +30,7 @@ class FadeExampleViewController: ExampleViewController { // controller that you'll make use of is the `transition` property. Setting this property will // dictate how the view controller is presented. For this example we've built a custom // FadeTransition, so we'll make use of that now: - modalViewController.transitionController.transition = FadeTransition(target: .foreView) + modalViewController.mdm_transitionController.transition = FadeTransition(target: .foreView) // Note that once we assign the transition object to the view controller, the transition will // govern all subsequent presentations and dismissals of that view controller instance. If we diff --git a/examples/MenuExample.swift b/examples/MenuExample.swift index 8d28d46..f72fe30 100644 --- a/examples/MenuExample.swift +++ b/examples/MenuExample.swift @@ -21,7 +21,7 @@ class MenuExampleViewController: ExampleViewController { func didTap() { let modalViewController = ModalViewController() - modalViewController.transitionController.transition = MenuTransition() + modalViewController.mdm_transitionController.transition = MenuTransition() present(modalViewController, animated: true) } diff --git a/examples/NavControllerFadeExample.swift b/examples/NavControllerFadeExample.swift index dbbfe94..fdf5b73 100644 --- a/examples/NavControllerFadeExample.swift +++ b/examples/NavControllerFadeExample.swift @@ -31,7 +31,7 @@ class NavControllerFadeExampleViewController: ExampleViewController { // controller that you'll make use of is the `transition` property. Setting this property will // dictate how the view controller is presented. For this example we've built a custom // FadeTransition, so we'll make use of that now: - modalViewController.transitionController.transition = FadeTransition(target: .foreView) + modalViewController.mdm_transitionController.transition = FadeTransition(target: .foreView) cachedNavDelegate = navigationController?.delegate diff --git a/examples/PhotoAlbumExample.swift b/examples/PhotoAlbumExample.swift index bb7f720..e3a0b90 100644 --- a/examples/PhotoAlbumExample.swift +++ b/examples/PhotoAlbumExample.swift @@ -73,7 +73,7 @@ public class PhotoAlbumExampleViewController: UICollectionViewController, PhotoA public override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let viewController = PhotoAlbumViewController(album: album) viewController.currentPhoto = album.photos[indexPath.row] - viewController.transitionController.transition = PhotoAlbumTransition(backDelegate: self, + viewController.mdm_transitionController.transition = PhotoAlbumTransition(backDelegate: self, foreDelegate: viewController) present(viewController, animated: true) } diff --git a/src/UIViewController+TransitionController.h b/src/UIViewController+TransitionController.h index b1f5279..6d73d48 100644 --- a/src/UIViewController+TransitionController.h +++ b/src/UIViewController+TransitionController.h @@ -29,7 +29,6 @@ Side effects: If the view controller's transitioningDelegate is nil when the controller is created, then the controller will also be set to the transitioningDelegate property. */ -@property(nonatomic, strong, readonly, nonnull) id mdm_transitionController - NS_SWIFT_NAME(transitionController); +@property(nonatomic, strong, readonly, nonnull) id mdm_transitionController; @end diff --git a/tests/unit/TransitionTests.swift b/tests/unit/TransitionTests.swift index 88730e6..1dfdc46 100644 --- a/tests/unit/TransitionTests.swift +++ b/tests/unit/TransitionTests.swift @@ -32,7 +32,7 @@ class TransitionTests: XCTestCase { func testTransitionDidEndDoesComplete() { let presentedViewController = UIViewController() - presentedViewController.transitionController.transition = InstantCompletionTransition() + presentedViewController.mdm_transitionController.transition = InstantCompletionTransition() let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: true) { @@ -46,7 +46,7 @@ class TransitionTests: XCTestCase { func testTransitionCompositionDoesComplete() { let presentedViewController = UIViewController() - presentedViewController.transitionController.transition = CompositeTransition(transitions: [ + presentedViewController.mdm_transitionController.transition = CompositeTransition(transitions: [ InstantCompletionTransition(), InstantCompletionTransition() ]) @@ -64,7 +64,7 @@ class TransitionTests: XCTestCase { func testTransitionFallbackToOtherTransitionDoesComplete() { let presentedViewController = UIViewController() let transition = FallbackTransition(to: InstantCompletionTransition()) - presentedViewController.transitionController.transition = transition + presentedViewController.mdm_transitionController.transition = transition let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: true) { @@ -80,7 +80,7 @@ class TransitionTests: XCTestCase { func testTransitionFallbackToSelfDoesComplete() { let presentedViewController = UIViewController() let transition = FallbackTransition() - presentedViewController.transitionController.transition = transition + presentedViewController.mdm_transitionController.transition = transition let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: true) { diff --git a/tests/unit/TransitionWithCustomDurationTests.swift b/tests/unit/TransitionWithCustomDurationTests.swift index 6421c10..9ecf7a1 100644 --- a/tests/unit/TransitionWithCustomDurationTests.swift +++ b/tests/unit/TransitionWithCustomDurationTests.swift @@ -60,7 +60,7 @@ class TransitionWithCustomDurationTests: XCTestCase { func testDefaultDurationIsProvidedViaContext() { let presentedViewController = UIViewController() let transition = DurationMemoryTransition() - presentedViewController.transitionController.transition = transition + presentedViewController.mdm_transitionController.transition = transition let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: true) { @@ -79,7 +79,7 @@ class TransitionWithCustomDurationTests: XCTestCase { let presentedViewController = UIViewController() let customDuration: TimeInterval = 0.1 let transition = CustomDurationMemoryTransition(with: customDuration) - presentedViewController.transitionController.transition = transition + presentedViewController.mdm_transitionController.transition = transition let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: true) { diff --git a/tests/unit/TransitionWithPresentationTests.swift b/tests/unit/TransitionWithPresentationTests.swift index 4192e2d..d0888f4 100644 --- a/tests/unit/TransitionWithPresentationTests.swift +++ b/tests/unit/TransitionWithPresentationTests.swift @@ -32,7 +32,7 @@ class TransitionWithPresentationTests: XCTestCase { func testPresentationControllerIsQueriedAndCompletesWithoutAnimation() { let presentedViewController = UIViewController() - presentedViewController.transitionController.transition = + presentedViewController.mdm_transitionController.transition = PresentationTransition(presentationControllerType: TestingPresentationController.self) let didComplete = expectation(description: "Did complete") @@ -47,7 +47,7 @@ class TransitionWithPresentationTests: XCTestCase { func testPresentationControllerIsQueriedAndCompletesWithAnimation() { let presentedViewController = UIViewController() - presentedViewController.transitionController.transition = + presentedViewController.mdm_transitionController.transition = PresentationTransition(presentationControllerType: TransitionPresentationController.self) let didComplete = expectation(description: "Did complete")