On Aug 30, 2017, at 14:04 , Rick Mann <rm...@latencyzero.com> wrote: > > But the X, Y versions have a double underscore: > > CGContext.__addArc(x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat, > radius: CGFloat) > > Why is this?
I believe the double-underscore prefix indicates an Obj-C API that is exposed through Swift but not intended for general use. It may be that it’s there for 3rd party developers who insist on using that particular API, or it may be for the Swift compiler to call through to. There is generally a better (simpler) API that does the same thing. In this case, it may be that the x/y plus 1/2 coordinate pattern is an outlier, and Swift standardizes on points instead, in geometrical methods. You can pass CGPoint(x: x1, y:y1) and CGPoint (x: x2, y: y2) into the other API. My guess is that Swift generates the exact same code for the parameters in either case, because it can *always* inline the CGPoint creation methods. You’re not paying a performance or code size penalty, and you are gaining consistency. I don’t know if my reasoning is correct, but it’s an argument that can be made in other similar cases too, so I think it’s something like that. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com