Don't deprecate presentModalViewController:animated + dismissModalViewController
| Originator: | zach | ||
| Number: | rdar://11784423 | Date Originated: | 6/30/12 |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 6.0 |
| Classification: | Other Bug | Reproducible: | N/A |
Summary:
iOS 6 brought us many API changes. Many of these were for the better and quite awesome. Some of them, however, are not as beneficial. In particular, iOS 6 deprecates presentModalViewController:animated: and dismissModalViewControllerAnimated: in favor of new APIs introduced in iOS 5, presentViewController:animated:completion: and dismissViewControllerAnimated:completion:.
I would like to strongly protest the deprecation of these APIs and instead ask that they become implicit wrappers for the new APIs and implicitly pass in NULL as the completion parameter, eg:
- (void) presentModalViewController:(UIViewController *) modalViewController animated:(BOOL) animated {
[self presentViewController:modalViewController animated:animated completion:NULL];
}
and
- (void) dismissModalViewControllerAnimated:(BOOL) animated {
[self dismissViewControllerAnimated:animated completion:NULL];
}
My reasoning for this request twofold:
1. While having a completion block sounds like it might be useful, I can't actually think of a situation where I would need to use this. I'm not claiming that my lack of imagination means that there is no use-case for this API -- just that it exists only to solve a rare situation. Which leads to..
2. Forcing everyone to have a third parameter that is rarely used introduces a lot code smell and boilerplate code. Code, in general, is evil and prone to have bugs. Less code is better (and one could argue that one job of framework authors is to handle common tasks so that developers don't have to) -- so, don't force developers to write more than they really need!
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Completion block is useful!
I've used dismissViewControllerAnimated:completion: a number of times when presenting a 2nd modal view controller as a result of an action in the first.
Differing functionality
the deprecated method supports pushing a view controller that has wantsFullScreenLayout from one that hasn't. This is an open bug I have. The point is that now you have choice of whether or not the present view controller is modal or not.
too early
hasty and somewhat hysterical conclusions. Backward compatibility has always been important to Apple. take the same Uimapkit. so do not be nervous ahead of time. too stupid to break the compatibility is only for an optional third parameter.