<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Shader/Argument",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI6ShaderV8ArgumentV"
  },
  "title" : "Shader.Argument"
}
-->

# Shader.Argument

A single uniform argument value to a shader function.

```
struct Argument
```

## Topics

### Creating argument values

[`boundingRect`](/documentation/SwiftUI/Shader/Argument/boundingRect)

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`).

[`color(_:)`](/documentation/SwiftUI/Shader/Argument/color(_:))

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.

[`colorArray(_:)`](/documentation/SwiftUI/Shader/Argument/colorArray(_:))

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.

[`data(_:)`](/documentation/SwiftUI/Shader/Argument/data(_:))

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.

[`float(_:)`](/documentation/SwiftUI/Shader/Argument/float(_:))

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

[`float2(_:)`](/documentation/SwiftUI/Shader/Argument/float2(_:))

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

[`float2(_:_:)`](/documentation/SwiftUI/Shader/Argument/float2(_:_:))

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

[`float3(_:_:_:)`](/documentation/SwiftUI/Shader/Argument/float3(_:_:_:))

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

[`float4(_:_:_:_:)`](/documentation/SwiftUI/Shader/Argument/float4(_:_:_:_:))

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

[`floatArray(_:)`](/documentation/SwiftUI/Shader/Argument/floatArray(_:))

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.

[`image(_:)`](/documentation/SwiftUI/Shader/Argument/image(_:))

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.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)