One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

Shader.Argument

struct · iOS 17.0+ · SDK 27.1

struct Argument

A single uniform argument value to a shader function.

Members (13)

static · iOS 17.0+

colorArray

TypeScript
static colorArray(array: Array<Color>): Shader_Argument
Swift declaration
static func colorArray(_ array: [Color]) -> Shader.Argument

Returns an argument value defined by the provided array of color values. When passed to an MSL function it will convert to a `device const half4 *ptr, int count` pair of parameters.

static · iOS 17.0+

floatArray

TypeScript
static floatArray(array: Array<number>): Shader_Argument
Swift declaration
static func floatArray(_ array: [Float]) -> Shader.Argument

Returns an argument value defined by the provided array of floating point numbers. When passed to an MSL function it will convert to a `device const float *ptr, int count` pair of parameters.

get · iOS 17.0+

boundingRect

TypeScript
static get boundingRect(): Shader_Argument
Swift declaration
static var boundingRect: Shader.Argument { get }

Returns an argument value representing the bounding rect of the shape or view that the shader is attached to, as `float4(x, y, width, height)`. This value is undefined for shaders that do not have a natural bounding rect (e.g. filter effects drawn into `GraphicsContext`).

static · iOS 17.0+

data

TypeScript
static data(data: ArrayBuffer): Shader_Argument
Swift declaration
static func data(_ data: Data) -> Shader.Argument

Returns an argument value defined by the provided data value. When passed to an MSL function it will convert to a `device const void *ptr, int size_in_bytes` pair of parameters.

static · iOS 17.0+

color

TypeScript
static color(color: Color): Shader_Argument
Swift declaration
static func color(_ color: Color) -> Shader.Argument

Returns an argument value representing `color`. When passed to a MSL function it will convert to a `half4` value, as a premultiplied color in the target color space.

static · iOS 17.0+

float

TypeScript
static float(x: number): Shader_Argument
Swift declaration
@export(implementation) static func float<T>(_ x: T) -> Shader.Argument where T : BinaryFloatingPoint

Returns an argument value representing the MSL value `float(x)`.

static · iOS 17.0+

image

TypeScript
static image(image: Image): Shader_Argument
Swift declaration
static func image(_ image: Image) -> Shader.Argument

Returns an argument value defined by the provided image. When passed to an MSL function it will convert to a `texture2d<half>` value. Currently only one image parameter is supported per `Shader` instance.

static · iOS 17.0+

float2

TypeScript
static float2(size: { width: number; height: number }): Shader_Argument
Swift declaration
@export(implementation) static func float2(_ size: CGSize) -> Shader.Argument

Returns an argument value representing the MSL value `float2(size.width, size.height)`.

static · iOS 17.0+

float2

TypeScript
static float251054(point: { x: number; y: number }): Shader_Argument
Swift declaration
@export(implementation) static func float2(_ point: CGPoint) -> Shader.Argument

Returns an argument value representing the MSL value `float2(point.x, point.y)`.

static · iOS 17.0+

float2

TypeScript
static float252054(vector: { dx: number; dy: number }): Shader_Argument
Swift declaration
@export(implementation) static func float2(_ vector: CGVector) -> Shader.Argument

Returns an argument value representing the MSL value `float2(vector.dx, vector.dy)`.

static · iOS 17.0+

float2

TypeScript
static float277807(x: number, y: number): Shader_Argument
Swift declaration
@export(implementation) static func float2<T>(_ x: T, _ y: T) -> Shader.Argument where T : BinaryFloatingPoint

Returns an argument value representing the MSL value `float2(x, y)`.

static · iOS 17.0+

float3

TypeScript
static float3(x: number, y: number, z: number): Shader_Argument
Swift declaration
@export(implementation) static func float3<T>(_ x: T, _ y: T, _ z: T) -> Shader.Argument where T : BinaryFloatingPoint

Returns an argument value representing the MSL value `float3(x, y, z)`.

static · iOS 17.0+

float4

TypeScript
static float4(x: number, y: number, z: number, w: number): Shader_Argument
Swift declaration
@export(implementation) static func float4<T>(_ x: T, _ y: T, _ z: T, _ w: T) -> Shader.Argument where T : BinaryFloatingPoint

Returns an argument value representing the MSL value `float4(x, y, z, w)`.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →