Swift / Core Graphics - would like `transform` to default to nil in convenience calls
Originator: | markd | ||
Number: | rdar://30480949 | Date Originated: | 2/11/2017 |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Product Version: | Xcode Version 8.3 beta 2 (8W120l) |
Classification: | Enhancement | Reproducible: | N/A |
Area: Core Graphics Summary: Hi! The Swift wrappers for Core Graphics are very nice. There's one wart where unnecessary complexity leaks out: let squarePath = CGPath(rect: rect1, transform: nil) let ovalpath = CGPath(ellipseIn: rect2, transform: nil) let roundedRectanglePath = CGPath(roundedRect: rect3, cornerWidth: 10.0, cornerHeight: 10.0, transform: nil) It'd be nice if the transform argument defaulted to nil so we can leave it out of the call entirely. If I try to leave it out, e.g. path = CGPath(rect: controlRect) I get this: /Users/markd/Projects/BNR/GrafDemo/GrafDemo/ConvenienceView.swift:109:20: Cannot invoke initializer for type 'CGPath' with an argument list of type '(rect: CGRect)' /Users/markd/Projects/BNR/GrafDemo/GrafDemo/ConvenienceView.swift:109:20: Overloads for 'CGPath' exist with these partially matching parameter lists: (rect: CGRect, transform: UnsafePointer<CGAffineTransform>?), (ellipseIn: CGRect, transform: UnsafePointer<CGAffineTransform>?), (roundedRect: CGRect, cornerWidth: CGFloat, cornerHeight: CGFloat, transform: UnsafePointer<CGAffineTransform>?), (__byDashing: CGPath, transform: UnsafePointer<CGAffineTransform>?, phase: CGFloat, lengths: UnsafePointer<CGFloat>?, count: Int), (__byStroking: CGPath, transform: UnsafePointer<CGAffineTransform>?, lineWidth: CGFloat, lineCap: CGLineCap, lineJoin: CGLineJoin, miterLimit: CGFloat) Steps to Reproduce: . Expected Results: . Actual Results: . Version: Xcode Version 8.3 beta 2 (8W120l), 10.12.2 (16C67) 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!