view

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PresentDetailYAML

func PresentDetailYAML(w io.Writer, detail DetailOutput) error

PresentDetailYAML writes DetailOutput as YAML to w.

func PresentTreeYAML

func PresentTreeYAML(w io.Writer, tree TreeOutput) error

PresentTreeYAML writes TreeOutput as YAML to w.

func RunInteractive

func RunInteractive(appName string, device string) error

Types

type Constraint

type Constraint struct {
	Class           string  `json:"class,omitempty" yaml:"class,omitempty"`
	Address         string  `json:"address,omitempty" yaml:"address,omitempty"`
	FirstItem       string  `json:"firstItem" yaml:"firstItem"`
	FirstAttribute  string  `json:"firstAttribute" yaml:"firstAttribute"`
	Relation        string  `json:"relation" yaml:"relation"`
	SecondItem      string  `json:"secondItem" yaml:"secondItem"`
	SecondAttribute string  `json:"secondAttribute" yaml:"secondAttribute"`
	Multiplier      float64 `json:"multiplier" yaml:"multiplier"`
	Constant        float64 `json:"constant" yaml:"constant"`
	Priority        float64 `json:"priority" yaml:"priority"`
}

Constraint represents a single NSLayoutConstraint.

type DetailOutput

type DetailOutput struct {
	UIKit   UIKitView      `yaml:"uikit"`
	SwiftUI *SwiftUIOutput `yaml:"swiftui,omitempty"`
}

DetailOutput is the YAML output for detail mode.

func RunDetail

func RunDetail(appName string, address string, swiftUI string, device string) (DetailOutput, error)

RunDetail fetches the detail for a specific view address. swiftUI should be "none", "compact", or "full".

type Insets

type Insets struct {
	Top    float64 `json:"top" yaml:"top"`
	Left   float64 `json:"left" yaml:"left"`
	Bottom float64 `json:"bottom" yaml:"bottom"`
	Right  float64 `json:"right" yaml:"right"`
}

Insets represents edge insets.

type LayerInfo

type LayerInfo struct {
	Class   string `json:"class" yaml:"class"`
	Address string `json:"address" yaml:"address"`
}

LayerInfo represents a CALayer summary.

type Point

type Point struct {
	X float64 `json:"x" yaml:"x"`
	Y float64 `json:"y" yaml:"y"`
}

Point represents a 2D point.

type Rect

type Rect struct {
	X      float64 `json:"x" yaml:"x"`
	Y      float64 `json:"y" yaml:"y"`
	Width  float64 `json:"width" yaml:"width"`
	Height float64 `json:"height" yaml:"height"`
}

Rect represents a rectangle with origin and size.

type Size

type Size struct {
	Width  float64 `yaml:"width"`
	Height float64 `yaml:"height"`
}

Size represents a 2D size (width x height).

type SwiftUINode

type SwiftUINode struct {
	Name      string        `yaml:"name"`
	Type      string        `yaml:"type,omitempty"`
	Position  *Point        `yaml:"position,omitempty"`
	Size      *Size         `yaml:"size,omitempty"`
	Value     string        `yaml:"value,omitempty"`
	Transform string        `yaml:"transform,omitempty"`
	Children  []SwiftUINode `yaml:"children,omitempty"`
}

SwiftUINode represents a node in the SwiftUI view debug tree.

func ParseSwiftUIJSON

func ParseSwiftUIJSON(data []byte, compact bool) ([]SwiftUINode, error)

ParseSwiftUIJSON parses _viewDebugData() JSON bytes into SwiftUINode trees. compact mode skips intermediate ModifiedContent/_ViewModifier_Content nodes without size.

type SwiftUIOutput

type SwiftUIOutput struct {
	Tree []SwiftUINode `yaml:"tree"`
}

SwiftUIOutput wraps the SwiftUI tree for YAML output.

type TreeOutput

type TreeOutput struct {
	Views []UIKitView `json:"views" yaml:"views"`
}

TreeOutput is the top-level output for tree mode.

func RunTree

func RunTree(appName string, maxDepth int, frontmost bool, device string) (TreeOutput, error)

RunTree fetches the view hierarchy and returns a TreeOutput. If frontmost is true, only the frontmost view controller's subtree is returned.

type UIKitView

type UIKitView struct {
	Class              string       `json:"class" yaml:"class"`
	Address            string       `json:"address" yaml:"address"`
	Inheritance        string       `json:"inheritance,omitempty" yaml:"inheritance,omitempty"`
	Frame              *Rect        `json:"frame,omitempty" yaml:"frame,omitempty"`
	Bounds             *Rect        `json:"bounds,omitempty" yaml:"bounds,omitempty"`
	Position           *Point       `json:"position,omitempty" yaml:"position,omitempty"`
	Hidden             *bool        `json:"hidden,omitempty" yaml:"hidden,omitempty"`
	LayoutMargins      *Insets      `json:"layoutMargins,omitempty" yaml:"layoutMargins,omitempty"`
	HasAmbiguousLayout *bool        `json:"hasAmbiguousLayout,omitempty" yaml:"hasAmbiguousLayout,omitempty"`
	Layer              *LayerInfo   `json:"layer,omitempty" yaml:"layer,omitempty"`
	Constraints        []Constraint `json:"constraints,omitempty" yaml:"constraints,omitempty"`
	SubviewCount       *int         `json:"subviewCount,omitempty" yaml:"subviewCount,omitempty"`
	IsHostingView      bool         `json:"isHostingView,omitempty" yaml:"isHostingView,omitempty"`
	Snapshot           string       `json:"snapshot,omitempty" yaml:"snapshot,omitempty"`
	Subviews           []UIKitView  `json:"subviews,omitempty" yaml:"subviews,omitempty"`
}

UIKitView represents a UIKit view node (used for both tree and detail).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL