Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 7b3f0c2

Browse files
authored
[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.
1 parent 972f756 commit 7b3f0c2

11 files changed

+17
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ you can pick the custom transition you want to use:
1313

1414
```swift
1515
let viewController = MyViewController()
16-
viewController.transitionController.transition = CustomTransition()
16+
viewController.mdm_transitionController.transition = CustomTransition()
1717
present(viewController, animated: true)
1818
```
1919

@@ -129,7 +129,7 @@ and dismissal of our view controller:
129129
130130
```swift
131131
let viewController = MyViewController()
132-
viewController.transitionController.transition = FadeTransition()
132+
viewController.mdm_transitionController.transition = FadeTransition()
133133
present(viewController, animated: true)
134134
```
135135

examples/ContextualExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ContextualExampleViewController: ExampleViewController {
3535
// Note that in this example we're populating the contextual transition with the tapped view.
3636
// Our rudimentary transition will animate the context view to the center of the screen from its
3737
// current location.
38-
controller.transitionController.transition = CompositeTransition(transitions: [
38+
controller.mdm_transitionController.transition = CompositeTransition(transitions: [
3939
FadeTransition(target: .foreView),
4040
ContextualTransition(contextView: tapGesture.view!)
4141
])

examples/CustomPresentationExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ extension CustomPresentationExampleViewController {
165165
extension CustomPresentationExampleViewController {
166166
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
167167
let modal = ModalViewController()
168-
modal.transitionController.transition = transitions[indexPath.row].transition
168+
modal.mdm_transitionController.transition = transitions[indexPath.row].transition
169169
showDetailViewController(modal, sender: self)
170170
}
171171
}

examples/FadeExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FadeExampleViewController: ExampleViewController {
3030
// controller that you'll make use of is the `transition` property. Setting this property will
3131
// dictate how the view controller is presented. For this example we've built a custom
3232
// FadeTransition, so we'll make use of that now:
33-
modalViewController.transitionController.transition = FadeTransition(target: .foreView)
33+
modalViewController.mdm_transitionController.transition = FadeTransition(target: .foreView)
3434

3535
// Note that once we assign the transition object to the view controller, the transition will
3636
// govern all subsequent presentations and dismissals of that view controller instance. If we

examples/MenuExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MenuExampleViewController: ExampleViewController {
2121

2222
func didTap() {
2323
let modalViewController = ModalViewController()
24-
modalViewController.transitionController.transition = MenuTransition()
24+
modalViewController.mdm_transitionController.transition = MenuTransition()
2525
present(modalViewController, animated: true)
2626
}
2727

examples/NavControllerFadeExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class NavControllerFadeExampleViewController: ExampleViewController {
3131
// controller that you'll make use of is the `transition` property. Setting this property will
3232
// dictate how the view controller is presented. For this example we've built a custom
3333
// FadeTransition, so we'll make use of that now:
34-
modalViewController.transitionController.transition = FadeTransition(target: .foreView)
34+
modalViewController.mdm_transitionController.transition = FadeTransition(target: .foreView)
3535

3636
cachedNavDelegate = navigationController?.delegate
3737

examples/PhotoAlbumExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class PhotoAlbumExampleViewController: UICollectionViewController, PhotoA
7373
public override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
7474
let viewController = PhotoAlbumViewController(album: album)
7575
viewController.currentPhoto = album.photos[indexPath.row]
76-
viewController.transitionController.transition = PhotoAlbumTransition(backDelegate: self,
76+
viewController.mdm_transitionController.transition = PhotoAlbumTransition(backDelegate: self,
7777
foreDelegate: viewController)
7878
present(viewController, animated: true)
7979
}

src/UIViewController+TransitionController.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
Side effects: If the view controller's transitioningDelegate is nil when the controller is created,
3030
then the controller will also be set to the transitioningDelegate property.
3131
*/
32-
@property(nonatomic, strong, readonly, nonnull) id<MDMTransitionController> mdm_transitionController
33-
NS_SWIFT_NAME(transitionController);
32+
@property(nonatomic, strong, readonly, nonnull) id<MDMTransitionController> mdm_transitionController;
3433

3534
@end

tests/unit/TransitionTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TransitionTests: XCTestCase {
3232

3333
func testTransitionDidEndDoesComplete() {
3434
let presentedViewController = UIViewController()
35-
presentedViewController.transitionController.transition = InstantCompletionTransition()
35+
presentedViewController.mdm_transitionController.transition = InstantCompletionTransition()
3636

3737
let didComplete = expectation(description: "Did complete")
3838
window.rootViewController!.present(presentedViewController, animated: true) {
@@ -46,7 +46,7 @@ class TransitionTests: XCTestCase {
4646

4747
func testTransitionCompositionDoesComplete() {
4848
let presentedViewController = UIViewController()
49-
presentedViewController.transitionController.transition = CompositeTransition(transitions: [
49+
presentedViewController.mdm_transitionController.transition = CompositeTransition(transitions: [
5050
InstantCompletionTransition(),
5151
InstantCompletionTransition()
5252
])
@@ -64,7 +64,7 @@ class TransitionTests: XCTestCase {
6464
func testTransitionFallbackToOtherTransitionDoesComplete() {
6565
let presentedViewController = UIViewController()
6666
let transition = FallbackTransition(to: InstantCompletionTransition())
67-
presentedViewController.transitionController.transition = transition
67+
presentedViewController.mdm_transitionController.transition = transition
6868

6969
let didComplete = expectation(description: "Did complete")
7070
window.rootViewController!.present(presentedViewController, animated: true) {
@@ -80,7 +80,7 @@ class TransitionTests: XCTestCase {
8080
func testTransitionFallbackToSelfDoesComplete() {
8181
let presentedViewController = UIViewController()
8282
let transition = FallbackTransition()
83-
presentedViewController.transitionController.transition = transition
83+
presentedViewController.mdm_transitionController.transition = transition
8484

8585
let didComplete = expectation(description: "Did complete")
8686
window.rootViewController!.present(presentedViewController, animated: true) {

tests/unit/TransitionWithCustomDurationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TransitionWithCustomDurationTests: XCTestCase {
6060
func testDefaultDurationIsProvidedViaContext() {
6161
let presentedViewController = UIViewController()
6262
let transition = DurationMemoryTransition()
63-
presentedViewController.transitionController.transition = transition
63+
presentedViewController.mdm_transitionController.transition = transition
6464

6565
let didComplete = expectation(description: "Did complete")
6666
window.rootViewController!.present(presentedViewController, animated: true) {
@@ -79,7 +79,7 @@ class TransitionWithCustomDurationTests: XCTestCase {
7979
let presentedViewController = UIViewController()
8080
let customDuration: TimeInterval = 0.1
8181
let transition = CustomDurationMemoryTransition(with: customDuration)
82-
presentedViewController.transitionController.transition = transition
82+
presentedViewController.mdm_transitionController.transition = transition
8383

8484
let didComplete = expectation(description: "Did complete")
8585
window.rootViewController!.present(presentedViewController, animated: true) {

0 commit comments

Comments
 (0)