featureSet
TypeScriptget featureSet(): FeatureSetSwift declarationvar featureSet: FeatureSet { get }The set of features used by this markup.
struct · iOS 27.0+ · SDK 27.1
struct ShapeMarkupA markup element that represents a shape or text box with customizable appearance and behavior. 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. ```swift // Create a filled rectangle let rect = ShapeMarkup( shape: .rectangle, frame: CGRect(x: 0, y: 0, width: 100, height: 50), fillColor: CGColor(red: 0, green: 0, blue: 1, alpha: 1) ) // Create a resizable textbox var textBox = ShapeMarkup( shape: .rectangle, frame: CGRect(x: 0, y: 0, width: 80, height: 80), attributedText: AttributedString("Star!"), autoresizing: [.flexibleWidth] ) textBox.attributedText = AttributedString("This text will cause the box to expand") // Create an arrow line let arrow = ShapeMarkup( shape: .line(start: .zero, control: CGPoint(x: 0.5, y: 0), end: CGPoint(x: 1, y: 0)), frame: CGRect(x: 0, y: 0, width: 200, height: 2), strokeColor: CGColor(red: 0, green: 0, blue: 0, alpha: 1), endLineMarker: .arrow ) ```
get featureSet(): FeatureSetSwift declarationvar featureSet: FeatureSet { get }The set of features used by this markup.
get renderFrame(): { x: number; y: number; width: number; height: number }Swift declarationvar renderFrame: CGRect { get }The unrotated frame that tightly fits the rendered contents of the element. This frame includes padding around `frame` to ensure it includes all the rendered aspects of the content. For example, this frame will include the strokes, and shadows of any contents.
get shapeScaled(): ShapeMarkup_ShapeSwift declarationvar shapeScaled: ShapeMarkup.Shape { get set }The type of the shape with values scaled to the current frame. Coordinate values are specified in points relative to the shape's `frame`. When you resize the shape, this property's values automatically update to reflect the new dimensions. Use `shape` if you need consistent relative proportions that don't change when resizing. ```swift var shape = ShapeMarkup( shape: .roundedRectangle(cornerRadius: 0.2), frame: CGRect(x: 0, y: 0, width: 100, height: 100) ) // shapeScaled returns .roundedRectangle(cornerRadius: 20.0) // 20 points shape.frame = CGRect(x: 0, y: 0, width: 200, height: 200) // shapeScaled now returns .roundedRectangle(cornerRadius: 40.0) // 40 points ```
set shapeScaled(value: ShapeMarkup_Shape)Swift declarationvar shapeScaled: ShapeMarkup.Shape { get set }The type of the shape with values scaled to the current frame. Coordinate values are specified in points relative to the shape's `frame`. When you resize the shape, this property's values automatically update to reflect the new dimensions. Use `shape` if you need consistent relative proportions that don't change when resizing. ```swift var shape = ShapeMarkup( shape: .roundedRectangle(cornerRadius: 0.2), frame: CGRect(x: 0, y: 0, width: 100, height: 100) ) // shapeScaled returns .roundedRectangle(cornerRadius: 20.0) // 20 points shape.frame = CGRect(x: 0, y: 0, width: 200, height: 200) // shapeScaled now returns .roundedRectangle(cornerRadius: 40.0) // 40 points ```
get strokeColor(): (_CoreGraphics_CGColor) | nullSwift declarationvar strokeColor: CGColor? { get set }The color used to stroke the shape’s path.
set strokeColor(value: (_CoreGraphics_CGColor) | null)Swift declarationvar strokeColor: CGColor? { get set }The color used to stroke the shape’s path.
get autoresizing(): MarkupAutoresizingSwift declarationvar autoresizing: MarkupAutoresizing { get set }Automatic sizing behaviors for this markup. Controls whether the markup automatically adjusts its dimensions to fit content changes. - Note: The layout mode (centered vs. top-anchored) is decided at init time and preserved across reassignment; setting `.flexibleHeight` here on a shape that didn't have `.flexibleHeight` at init will use the legacy top-anchored layout. New shapes should express the mode through `init(...autoresizing:)` instead.
set autoresizing(value: MarkupAutoresizing)Swift declarationvar autoresizing: MarkupAutoresizing { get set }Automatic sizing behaviors for this markup. Controls whether the markup automatically adjusts its dimensions to fit content changes. - Note: The layout mode (centered vs. top-anchored) is decided at init time and preserved across reassignment; setting `.flexibleHeight` here on a shape that didn't have `.flexibleHeight` at init will use the legacy top-anchored layout. New shapes should express the mode through `init(...autoresizing:)` instead.
static initConfigurationFrameRotation(configuration: ShapeConfiguration, frame: { x: number; y: number; width: number; height: number }, rotation?: number): ShapeMarkupSwift declarationinit(configuration: ShapeConfiguration, frame: CGRect, rotation: CGFloat = 0.0)Initializes and returns a new shape markup from the specified parameters. - Parameters: - configuration: The configuration of the shape. - frame: The frame of the shape. - rotation: The rotation in radians of the shape. Defaults to `0.0` (no rotation).
get endLineMarker(): ShapeMarkup_LineMarkerSwift declarationvar endLineMarker: ShapeMarkup.LineMarker { get set }The line marker used at the end of an open shape path. Line markers are only visible on open paths. Use `shape.supportsLineMarkers` to check whether the current shape supports line markers. Closed shapes like `.rectangle` and `.ellipse` ignore this property. Default is `.none`.
set endLineMarker(value: ShapeMarkup_LineMarker)Swift declarationvar endLineMarker: ShapeMarkup.LineMarker { get set }The line marker used at the end of an open shape path. Line markers are only visible on open paths. Use `shape.supportsLineMarkers` to check whether the current shape supports line markers. Closed shapes like `.rectangle` and `.ellipse` ignore this property. Default is `.none`.
get attributedText(): _Foundation_AttributedStringSwift declarationvar attributedText: AttributedString { get set }The attributed text displayed inside this shape. The attributed string supports: `.font`, `.foregroundColor`, `.underlineStyle`, `.strikethroughStyle` and writing direction and alignment from `.paragraphStyle`.
set attributedText(value: _Foundation_AttributedString)Swift declarationvar attributedText: AttributedString { get set }The attributed text displayed inside this shape. The attributed string supports: `.font`, `.foregroundColor`, `.underlineStyle`, `.strikethroughStyle` and writing direction and alignment from `.paragraphStyle`.
get startLineMarker(): ShapeMarkup_LineMarkerSwift declarationvar startLineMarker: ShapeMarkup.LineMarker { get set }The line marker used at the start of an open shape path. Line markers are only visible on open paths. Use `shape.supportsLineMarkers` to check whether the current shape supports line markers. Closed shapes like `.rectangle` and `.ellipse` ignore this property. Default is `.none`.
set startLineMarker(value: ShapeMarkup_LineMarker)Swift declarationvar startLineMarker: ShapeMarkup.LineMarker { get set }The line marker used at the start of an open shape path. Line markers are only visible on open paths. Use `shape.supportsLineMarkers` to check whether the current shape supports line markers. Closed shapes like `.rectangle` and `.ellipse` ignore this property. Default is `.none`.
get allowedInteractions(): MarkupInteractionsSwift declarationvar allowedInteractions: MarkupInteractions { get set }Interactions that people can perform on this markup. Use this to configure how people can interact with the markup, such as preventing resizing, rotation, or deletion. The default is `.all`, which allows all interactions. Set to `.readOnly` to prevent all modifications.
set allowedInteractions(value: MarkupInteractions)Swift declarationvar allowedInteractions: MarkupInteractions { get set }Interactions that people can perform on this markup. Use this to configure how people can interact with the markup, such as preventing resizing, rotation, or deletion. The default is `.all`, which allows all interactions. Set to `.readOnly` to prevent all modifications.
removeContentUnsupported(featureSet: FeatureSet): booleanSwift declarationmutating func removeContentUnsupported(by featureSet: FeatureSet) -> BoolRemoves all content not supported by the provided feature set. - Parameter featureSet: The feature set to limit this markup to. - Returns: True if this was successful and the feature set is now supported. If the returned value is `true` then `self.featureSet.isSubset(of: featureSet)` will be `true`.
get id(): MarkupID<ShapeMarkup>Swift declarationvar id: MarkupID<ShapeMarkup>Stable unique identity of the markup.
set id(value: MarkupID<ShapeMarkup>)Swift declarationvar id: MarkupID<ShapeMarkup>Stable unique identity of the markup.
get frame(): { x: number; y: number; width: number; height: number }Swift declarationvar frame: CGRect { get set }The element's unrotated frame. Together with `rotation` this defines the element's position in its parent. This won't necessarily contain all the contents of an element, rotation and styling may cause the element to extend beyond this frame. Use `renderFrame` for an unrotated frame that contains the entire element.
set frame(value: { x: number; y: number; width: number; height: number })Swift declarationvar frame: CGRect { get set }The element's unrotated frame. Together with `rotation` this defines the element's position in its parent. This won't necessarily contain all the contents of an element, rotation and styling may cause the element to extend beyond this frame. Use `renderFrame` for an unrotated frame that contains the entire element.
static initShapeFrameRotationFillColorStrokeColorLineWidthOpacityStartLineMarkerEndLineMarkerAttributedTextAllowedInteractionsAutoresizingId(shape: ShapeMarkup_Shape, frame: { x: number; y: number; width: number; height: number }, rotation?: number, fillColor?: (_CoreGraphics_CGColor) | null, strokeColor?: (_CoreGraphics_CGColor) | null, lineWidth?: number, opacity?: number, startLineMarker?: ShapeMarkup_LineMarker, endLineMarker?: ShapeMarkup_LineMarker, attributedText?: _Foundation_AttributedString, allowedInteractions?: MarkupInteractions, autoresizing?: MarkupAutoresizing, id?: MarkupID<ShapeMarkup>): ShapeMarkupSwift declarationinit(shape: ShapeMarkup.Shape, frame: CGRect, rotation: CGFloat = 0.0, fillColor: CGColor? = nil, strokeColor: CGColor? = nil, lineWidth: CGFloat = 1.0, opacity: CGFloat = 1.0, startLineMarker: ShapeMarkup.LineMarker = .none, endLineMarker: ShapeMarkup.LineMarker = .none, attributedText: AttributedString = Foundation.AttributedString(), allowedInteractions: MarkupInteractions = .all, autoresizing: MarkupAutoresizing = [], id: MarkupID<ShapeMarkup> = MarkupID())Initializes and returns a new shape markup from the specified parameters. - Parameters: - shape: The shape to create. - frame: The frame of the shape. - rotation: The rotation in radians of the shape. Defaults to `0.0` (no rotation). - fillColor: The fill color of the shape. Defaults to `nil` (no fill). - strokeColor: The stroke color of the shape's outline. Defaults to `nil` (no stroke). - lineWidth: The width of the shape's stroke. Defaults to `1.0`. - opacity: The opacity of the shape, ranging from `0.0` (fully transparent) to `1.0` (fully opaque). Defaults to `1.0`. - startLineMarker: The marker style for the start of the line. Defaults to `.none`. Only applicable for open shape paths. - endLineMarker: The marker style for the end of the line. Defaults to `.none`. Only applicable for open shape paths. - attributedText: The attributed text displayed inside this shape. Defaults to the empty string. - allowedInteractions: The flags controlling the interactions users can perform. Defaults to `.all`. - autoresizing: The flags controlling autoresize behavior. Defaults to `[]`. - id: The identity of the shape. Defaults to a unique id.
get shape(): ShapeMarkup_ShapeSwift declarationvar shape: ShapeMarkup.Shape { get set }The type of the shape. The coordinate values of the shape type are relative to the unit coordinate space. For example a corner radius of `0.1` is equivalent to a radius of 10% of the minimum dimension of the shape. Use `shapeScaled` for a shape type with scaled values relative to the shape's `frame`.
set shape(value: ShapeMarkup_Shape)Swift declarationvar shape: ShapeMarkup.Shape { get set }The type of the shape. The coordinate values of the shape type are relative to the unit coordinate space. For example a corner radius of `0.1` is equivalent to a radius of 10% of the minimum dimension of the shape. Use `shapeScaled` for a shape type with scaled values relative to the shape's `frame`.
get opacity(): numberSwift declarationvar opacity: CGFloat { get set }The opacity of the shape. Ranges from `0.0` (fully transparent) to `1.0` (fully opaque). Defaults to `1.0`.
set opacity(value: number)Swift declarationvar opacity: CGFloat { get set }The opacity of the shape. Ranges from `0.0` (fully transparent) to `1.0` (fully opaque). Defaults to `1.0`.
get rotation(): numberSwift declarationvar rotation: CGFloat { get set }The element's rotation around the center of its frame. Together with `frame` this defines the element's position in its parent.
set rotation(value: number)Swift declarationvar rotation: CGFloat { get set }The element's rotation around the center of its frame. Together with `frame` this defines the element's position in its parent.
get fillColor(): (_CoreGraphics_CGColor) | nullSwift declarationvar fillColor: CGColor? { get set }The color used to fill the shape’s path.
set fillColor(value: (_CoreGraphics_CGColor) | null)Swift declarationvar fillColor: CGColor? { get set }The color used to fill the shape’s path.
get lineWidth(): numberSwift declarationvar lineWidth: CGFloat { get set }The line width of the shape’s path.
set lineWidth(value: number)Swift declarationvar lineWidth: CGFloat { get set }The line width of the shape’s path.
No declarations were skipped in this snapshot.