ShapeMarkup
A markup element that represents a shape or text box with customizable appearance and behavior.
Declaration
struct ShapeMarkupOverview
Use ShapeMarkup to add geometric shapes, lines, and text containers to your markup content. Shapes can be filled, stroked, rotated, and configured with various visual properties.
// Create a filled rectangle
let rect = ShapeMarkup(
frame: CGRect(x: 0, y: 0, width: 100, height: 50),
fillColor: CGColor(red: 0, green: 0, blue: 1, alpha: 1),
type: .rectangle
)
// Create a resizable textbox
var textBox = ShapeMarkup(
frame: CGRect(x: 0, y: 0, width: 80, height: 80),
type: .rectangle,
attributedText: AttributedString("Star!"),
flags: [.flexibleWidth]
)
textBox.attributedText = AttributedString("This text will cause the box to expand")
// Create an arrow line
let arrow = ShapeMarkup(
frame: CGRect(x: 0, y: 0, width: 200, height: 2),
strokeColor: CGColor(red: 0, green: 0, blue: 0, alpha: 1),
type: .line(start: .zero, control: CGPoint(x: 0.5, y: 0), end: CGPoint(x: 1, y: 0)),
endLineMarker: .arrow
)Topics
Configuring fill and stroke
Identifying markup
Initializers
init(configuration:frame:rotation:)init(shape:frame:rotation:fillColor:strokeColor:lineWidth:opacity:startLineMarker:endLineMarker:attributedText:allowedInteractions:autoresizing:id:)