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

Commit

Permalink
[breaking] Rename the transitionController Swift API to mdm_transitio…
Browse files Browse the repository at this point in the history
…nController. (#59)

This avoids creating naming conflicts with local variables defined in view controllers with a similar name.
  • Loading branch information
jverkoey committed Nov 28, 2017
1 parent 972f756 commit 7b3f0c2
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -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)
```

Expand Down Expand Up @@ -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)
```

Expand Down
2 changes: 1 addition & 1 deletion examples/ContextualExample.swift
Expand Up @@ -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!)
])
Expand Down
2 changes: 1 addition & 1 deletion examples/CustomPresentationExample.swift
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion examples/FadeExample.swift
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/MenuExample.swift
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/NavControllerFadeExample.swift
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/PhotoAlbumExample.swift
Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions src/UIViewController+TransitionController.h
Expand Up @@ -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<MDMTransitionController> mdm_transitionController
NS_SWIFT_NAME(transitionController);
@property(nonatomic, strong, readonly, nonnull) id<MDMTransitionController> mdm_transitionController;

@end
8 changes: 4 additions & 4 deletions tests/unit/TransitionTests.swift
Expand Up @@ -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) {
Expand All @@ -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()
])
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/TransitionWithCustomDurationTests.swift
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/TransitionWithPresentationTests.swift
Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 7b3f0c2

Please sign in to comment.