Repository navigation
CutawayServer now speaks Cutaway protocol 1.2. Cutaway can switch the app's environment without touching the device's settings, shows more of what developers check most often, and your app can add its own attributes and parts to the hierarchy. Clients of protocol 1.0 and 1.1 keep working, and the server sends them only what their version defines.
What's new
Environment
- Switch the app's appearance (light or dark), text size, layout direction, and horizontal and vertical size classes from Cutaway. All five work on iOS 17 and later; on iOS 13 to 16, only the appearance can be switched.
- Overrides reach every window of the app, including windows that appear later, and take precedence over what the app sets on its windows and scenes. Overrides that the app's view controllers and views set still win.
- Cutaway gets its answer once the app has caught up with the change, including views that update a run loop turn later. The next capture shows the new look.
- When the connection closes for any reason, every window goes back to the app's own values.
Attributes
- An Accessibility section: label, hint, value, identifier, traits, and whether the view is an accessibility element. The text attributes and the element flag can be edited.
- Light and dark values of dynamic colors.
- References to other objects that link to them in the hierarchy: a stack view's arranged subviews, a scroll view's delegate, and a table or collection view's data source.
- Table and collection views: number of sections, number of items in total and per section, and visible index paths. Cells give their index path and reuse identifier. A stack view gives the custom spacing after each arranged subview.
- Images in image views and buttons: the image or symbol name, size, scale, rendering mode, and symbol configuration.
- Fonts in labels, text fields and text views: the full font description, its text style, and whether it adjusts to the text size. Whether it adjusts can be edited.
- Labels: the number of lines actually drawn, and whether the text is truncated.
- Reading attributes does not change the app's state. It does not trigger layout, call data sources, or load view controllers' views.
Customizing (guide)
A new extension interface lets your app add to what Cutaway shows. Call it on the main thread, before or after start():
CutawayServer.describe(_:_:)describes the views or layers of a class and its subclasses, with any of these parts:- Attribute groups of your own, shown after Cutaway's. They can be editable.
- Virtual children: parts of the interface a view draws itself, such as the bars of a chart, shown as nodes in the hierarchy.
- A flag that shows the instance collapsed at first.
- A flag that leaves the instance out of every image, for content that is sensitive or cannot be captured.
CutawayServer.registerColor(_:named:)gives a color a name. Color values equal to it, light and dark included, are shown with that name.
In builds without the server, the interface still compiles, and its calls do nothing.
Compatibility
- Works with Cutaway apps of protocol 1.0, 1.1 and 1.2.
- Requirements are unchanged: iOS 13 or later (iOS 15 or later when built with Xcode 27); Xcode 16.3 or later, Swift 6.1 or later, Swift Package Manager.
Installation
.package(url: "https://github.com/nothingsh/CutawayServer", from: "1.2.0")Full changes: 1.1.0...1.2.0