Skip to content

UXIosGraphics

UXIosGraphics is the UIKit realization of UXGraphics, sibling of UXCocoaGraphics.

#use <UXKit> // or #import "UXIosGraphics.xc"

The ops act on the CGContext that UIKit set for this draw, inside libUXIos.m’s UXDrawView. It is valid during the callback and not outside it, the same arrangement as NSGraphicsContext on macOS and cairo_t on GTK.

Coordinates passed in are bounds-relative; the bound origin makes them absolute.

This is the main difference between the two Apple vocabularies, and it is easy to get backwards.

AppKitdefault space grows y up; the shim declares a flipped view
UIKitdefault space grows y down; nothing to do

UIKit already matches the protocol, so there is no flipped-view override here and no arithmetic to invert. Both frameworks draw through CoreGraphics, yet they differ in this convention, which would otherwise leak into every custom view.

The platforms do not agree on a coordinate convention, so the toolkit defines one in the protocol instead of in each view.

strokesNatively() // true

CoreGraphics strokes at sub-pixel precision with its own joins, so a path goes to it rather than through the neutral offsetter. Arrowheads stay neutral because CoreGraphics has no arrowhead, as on every hosted backend.