<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/SlidingWindowTransformer",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents24SlidingWindowTransformerV"
  },
  "title" : "SlidingWindowTransformer"
}
-->

# SlidingWindowTransformer

A temporal transformer that groups input elements.

```
struct SlidingWindowTransformer<Input> where Input : Sendable
```

## Topics

### Creating a transformer

[`init(stride: Int, length: Int)`](/documentation/CreateMLComponents/SlidingWindowTransformer/init(stride:length:))

Creates a window temporal transformer.

### Getting the properties

[`let length: Int`](/documentation/CreateMLComponents/SlidingWindowTransformer/length)

The length of a window.

[`let stride: Int`](/documentation/CreateMLComponents/SlidingWindowTransformer/stride)

The number of elements between the start of two consecutive windows.

### Performing the transformation

[`func applied<S>(to: S, eventHandler: EventHandler?) throws -> SlidingWindowTransformer<Input>.WindowSequence`](/documentation/CreateMLComponents/SlidingWindowTransformer/applied(to:eventHandler:))

Extracts a window sequence from the input sequence

[`struct WindowSequence`](/documentation/CreateMLComponents/SlidingWindowTransformer/WindowSequence)

An async sequence of windows.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Decodable`](/documentation/Swift/Decodable)

[`Encodable`](/documentation/Swift/Encodable)

[`TemporalTransformer`](/documentation/CreateMLComponents/TemporalTransformer)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)