Property of viewControllers in UIPageViewController does not match type of setter setViewControllers:
| Originator: | |||
| Number: | rdar://21859919 | Date Originated: | 7/16/2015 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | 7.1.1 |
| Classification: | Reproducible: |
Summary:
API for UIPageViewController has type dispatch between property and setter. I believe the setter should also contain the __kindof attribute to prevent a compiler error on a perfectly valid downcast to UIViewController in the viewControllers array.
@property (nullable, nonatomic, readonly) NSArray<__kindof UIViewController *> *viewControllers;
Notice __kindof attribute.
Setter,
- (void)setViewControllers:(nullable NSArray<UIViewController *> *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^ __nullable)(BOOL finished))completion;
Notice __kindof attribute missing from NSArray<UIViewController*>
Steps to Reproduce:
@interface MyVCSubClass : UIViewController
@end
@implimentation AppDelegate
-(void)test {
UIPageViewController *pageViewController = [UIPageViewController new];
MyVCSubClass *initialPage = [MyVCSubClass new];
// Error
[pageViewController setViewControllers:@[initialPage]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
}
@end
Expected Results:
API should allow setting of subclasses of UIViewController in typed array
Actual Results:
Compiler gives error of type mismatch
Version:
Xcode 7.0 Beta 3/7A152u
Notes:
Configuration:
Attachments:
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!