[swift-evolution] [Review] SE-0005 Better Translation of Objective-C APIs Into Swift

Ben Rimmington me at benrimmington.com
Wed Jan 27 13:45:50 CST 2016


Matthew,

> On 27 Jan 2016, at 19:26, Matthew Johnson <matthew at anandabits.com> wrote:
> 
> This is better IMO:
> 
> func appendArc(center center: Point, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool)
> 
> However, I think this is an example of where explicit annotation is probably necessary to get the best result.  A heuristic can’t always do the right thing and I think this example is past the point of diminishing returns for heuristics.

The "append" methods of the AppKit.NSBezierPath patch are:

>    func append(path: NSBezierPath)
> +  func append(rect rect: Rect)
> +  func append(points points: PointArray, count: Int)
>    func appendWithOvalIn(rect: Rect)
> +  func appendWithArc(center center: Point, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool)
> +  func appendWithArc(center center: Point, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat)
>    func appendWithArcFrom(point1: Point, to point2: Point, radius: CGFloat)
> +  func append(glyph glyph: NSGlyph, in font: NSFont)
> +  func append(glyphs glyphs: UnsafeMutablePointer<NSGlyph>, count: Int, in font: NSFont)
> +  func append(packedGlyphs packedGlyphs: UnsafePointer<Int8>)
> +  func append(roundedRect rect: Rect, xRadius: CGFloat, yRadius: CGFloat)

Would you need to annotate all the methods?

-- Ben


More information about the swift-evolution mailing list