#IUO Swift's version of `+imageNamed` uses init but it's possible to fail
| Originator: | gordon | ||
| Number: | rdar://18218733 | Date Originated: | 03-Sep-2014 03:47 PM |
| Status: | Closed | Resolved: | 18-Sep-2014 |
| Product: | Developer Tools | Product Version: | Swift 1.0 |
| Classification: | Other Bug | Reproducible: | Not Applicable |
Summary: The docs for `+[UIImage imageNamed:]` state that the method returns: “The image object for the specified file, or nil if the method could not find the specified image.” However, the Swift version of this API uses `init` and is typed as `init(named name: String) -> UIImage` This seems incorrect, since the image with that name might not exist. I think this method would be better as `class func imageNamed(named name: String) -> UIImage?` That seems like it would match the behavior of the existing API much closer.
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!
Resolved in Xcode 6.1