Skip to content

Commit

Permalink
[BottomSheet] Deprecate to-be-removed APIs. (#2539)
Browse files Browse the repository at this point in the history
These APIs will either be made private or deleted altogether in an effort to reduce the public surface area of the BottomSheet component.

The final API will consist of the following:

- `MDCBottomSheetController`: the easiest integration point for a bottom sheet. Implements accessibility escape gesture support.
- `MDCBottomSheetTransition`: the Material Motion transition entry-point. This may be where the transition is customized by clients in the future.
  • Loading branch information
jverkoey committed Nov 29, 2017
1 parent fa22f6d commit 411eaec
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
9 changes: 9 additions & 0 deletions components/BottomSheet/src/MDCBottomSheetController.m
Expand Up @@ -22,7 +22,10 @@

#import <MotionTransitioning/MotionTransitioning.h>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@interface MDCBottomSheetController () <MDCBottomSheetPresentationControllerDelegate>
#pragma clang diagnostic pop
@end

@implementation MDCBottomSheetController {
Expand Down Expand Up @@ -56,7 +59,10 @@ - (void)viewDidLoad {
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
self.mdc_bottomSheetPresentationController.delegate = self;
#pragma clang diagnostic pop

[self.contentViewController.view layoutIfNeeded];
}
Expand Down Expand Up @@ -86,8 +92,11 @@ - (void)setTrackingScrollView:(UIScrollView *)trackingScrollView {
_transition.trackingScrollView = trackingScrollView;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)bottomSheetPresentationControllerDidDismissBottomSheet:
(nonnull __unused MDCBottomSheetPresentationController *)bottomSheet {
#pragma clang diagnostic pop
[self.delegate bottomSheetControllerDidDismissBottomSheet:self];
}

Expand Down
12 changes: 2 additions & 10 deletions components/BottomSheet/src/MDCBottomSheetPresentationController.h
Expand Up @@ -21,11 +21,7 @@
/**
Delegate for MDCBottomSheetPresentationController.
*/
// TODO( https://github.com/material-components/material-components-ios/issues/2418 ):
// Enable deprecation once internal clients have migrated to the new APIs or until a reasonable
// period of time has passed.
//__deprecated_msg("Assign an instance of MDCBottomSheetTransition to your view controller's "
// "mdm_transitionController.transition instead.")
__deprecated_msg("This API will soon be made private. Use MDCBottomSheetController instead.")
@protocol MDCBottomSheetPresentationControllerDelegate <UIAdaptivePresentationControllerDelegate>
@optional

Expand Down Expand Up @@ -53,11 +49,7 @@
/**
A UIPresentationController for presenting a modal view controller as a bottom sheet.
*/
// TODO( https://github.com/material-components/material-components-ios/issues/2418 ):
// Enable deprecation once internal clients have migrated to the new APIs or until a reasonable
// period of time has passed.
//__deprecated_msg("Assign an instance of MDCBottomSheetTransition to your view controller's "
// "mdm_transitionController.transition instead.")
__deprecated_msg("This API will soon be made private. Use MDCBottomSheetController instead.")
@interface MDCBottomSheetPresentationController : UIPresentationController

/**
Expand Down
Expand Up @@ -31,11 +31,8 @@
The presenting UIViewController then calls presentViewController:animated:completion:
[rootViewController presentViewController:myDialogViewController animated:YES completion:...];
*/
// TODO( https://github.com/material-components/material-components-ios/issues/2418 ):
// Enable deprecation once internal clients have migrated to the new APIs or until a reasonable
// period of time has passed.
//__deprecated_msg("Assign an instance of MDCBottomSheetTransition to your view controller's "
// "mdm_transitionController.transition instead.")
__deprecated_msg("Assign an instance of MDCBottomSheetTransition to your view controller's "
"mdm_transitionController.transition instead.")
@interface MDCBottomSheetTransitionController
: NSObject <UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate>

Expand Down
Expand Up @@ -29,12 +29,12 @@
@return nil if the view controller is not managed by a Material bottom sheet presentation
controller.
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property(nonatomic, nullable, readonly)
MDCBottomSheetPresentationController *mdc_bottomSheetPresentationController;
// TODO( https://github.com/material-components/material-components-ios/issues/2418 ):
// Enable deprecation once internal clients have migrated to the new APIs or until a reasonable
// period of time has passed.
// __deprecated_msg("Assign an instance of MDCBottomSheetTransition to your view controller's "
// "mdm_transitionController.transition instead.");
MDCBottomSheetPresentationController *mdc_bottomSheetPresentationController
__deprecated_msg("Assign an instance of MDCBottomSheetTransition to your view controller's "
"mdm_transitionController.transition instead.");
#pragma clang diagnostic pop

@end
Expand Up @@ -20,11 +20,14 @@

@implementation UIViewController (MaterialBottomSheet)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (MDCBottomSheetPresentationController *)mdc_bottomSheetPresentationController {
id presentationController = self.presentationController;
if ([presentationController isKindOfClass:[MDCBottomSheetPresentationController class]]) {
return (MDCBottomSheetPresentationController *)presentationController;
}
#pragma clang diagnostic pop

return nil;
}
Expand Down

0 comments on commit 411eaec

Please sign in to comment.