Conflicting declaration and documentation description for `[UIView initWithFrame:]`: nullable or nonnull?
| Originator: | adigitalknight | ||
| Number: | rdar://24759847 | Date Originated: | 21-Feb-2016 08:09 PM |
| Status: | Duplicate of 24506072 (Closed) | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
Summary: UIView.h gives this declaration: NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; NS_ASSUME_NONNULL_END But documentation's description reads: "Initializes and returns a newly allocated view object with the specified frame rectangle. An initialized view object or nil if the object couldn't be created." So declaration and documentation's description are conflicting (first one gives `nonnull`, second one gives `nullable`). Expected Results: Either documentation shouldn't say `nil` can be returned, or declaration should add the `nullable` keyword: - (nullable instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; Version: Xcode 7.2 and 7.3 beta 3 Notes: CLANG_ANALYZER_NONNULL is giving a warning with Xcode 7.3 beta 3 if we attempt to write a classic construct: http://i.stack.imgur.com/zeVBO.png
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!
Documentation was fixed and now reads: "Initializes and returns a newly allocated view object with the specified frame rectangle. An initialized view object."
Also reported on http://stackoverflow.com/q/35532777/1033581