init
TypeScriptstatic initNormalizedRect(normalizedRect: { x: number; y: number; width: number; height: number }): NormalizedRectSwift declarationinit(normalizedRect: CGRect)Creates a rectangle from the specified Core Graphics rectangle.
struct · iOS 18.0+ · SDK 27.1
struct NormalizedRectA rectangle with normalized coordinates in the range [0, 1].
static initNormalizedRect(normalizedRect: { x: number; y: number; width: number; height: number }): NormalizedRectSwift declarationinit(normalizedRect: CGRect)Creates a rectangle from the specified Core Graphics rectangle.
get cgRect(): { x: number; y: number; width: number; height: number }Swift declarationlet cgRect: CGRectThe normalized rectangle as a CGRect.
static initImageRectInNormalizedTo(imageRect: { x: number; y: number; width: number; height: number }, imageSize: { width: number; height: number }, regionOfInterest: NormalizedRect): NormalizedRectSwift declarationinit(imageRect: CGRect, in imageSize: CGSize, normalizedTo regionOfInterest: NormalizedRect)Creates a rectangle normalized to a region of interest in an image from a rectangle in an image coordinate space. - Parameters: - imageRect: A rectangle in the image coordinate space. - imageSize: The size of the image.
static initImageRectIn(imageRect: { x: number; y: number; width: number; height: number }, imageSize: { width: number; height: number }): NormalizedRectSwift declarationinit(imageRect: CGRect, in imageSize: CGSize)Creates a normalized rectangle from a rectangle in an image coordinate space. - Parameters: - imageRect: A rectangle in the image coordinate space. - imageSize: The size of the image.
get description(): stringSwift declarationvar description: String { get }A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.
verticallyFlipped(): NormalizedRectSwift declarationfunc verticallyFlipped() -> NormalizedRectReturns a `NormalizedRect` with the origin flipped between the top and bottom of the image.
toImageCoordinatesFromImageSizeOrigin(regionOfInterest: NormalizedRect, imageSize: { width: number; height: number }, origin?: CoordinateOrigin): { x: number; y: number; width: number; height: number }Swift declarationfunc toImageCoordinates(from regionOfInterest: NormalizedRect, imageSize: CGSize, origin: CoordinateOrigin = .lowerLeft) -> CGRectConverts a rectangle normalized to a region within an image into full image coordinates. - Parameters: - imageSize: The size of the image. - regionOfInterest: The region within an image the `NormalizedPoint` is normalized to.
toImageCoordinatesOrigin(imageSize: { width: number; height: number }, origin?: CoordinateOrigin): { x: number; y: number; width: number; height: number }Swift declarationfunc toImageCoordinates(_ imageSize: CGSize, origin: CoordinateOrigin = .lowerLeft) -> CGRectConverts a rectangle in normalized coordinates into image coordinates. - Parameters: - imageSize: The size of the image.
static initXYWidthHeight(x: number, y: number, width: number, height: number): NormalizedRectSwift declarationinit(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat)Creates a rectangle with the specified coordinates. - Parameters: - x: The x-coordinate of the rectangle's lower-left corner. - y: The y-coordinate of the rectangle's lower-left corner.. - width: The width of the rectangle - height: The height of the rectangle
get width(): numberSwift declarationvar width: CGFloat { get }The width of the rectangle
get height(): numberSwift declarationvar height: CGFloat { get }The height of the rectangle
get origin(): { x: number; y: number }Swift declarationvar origin: CGPoint { get }The lower-left hand corner of the rectangle.
static get fullImage(): NormalizedRectSwift declarationstatic var fullImage: NormalizedRect { get }A normalized rectangle with origin at [0,0] and a width and height of 1.0.
No declarations were skipped in this snapshot.