<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/MutableRawSpan/storeBytes(repeating:count:as:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s14MutableRawSpanV10storeBytes9repeating5count2as_yx_Sixms9ByteOrderOts15BitwiseCopyableRzs013ConvertibleToE0Rzs17FixedWidthIntegerRzlF"
  },
  "title" : "storeBytes(repeating:count:as:_:)"
}
-->

# storeBytes(repeating:count:as:_:)

Stores the given value’s bytes repeatedly into this span’s memory.

```
mutating func storeBytes<T>(repeating repeatedValue: T, count: Int, as type: T.Type, _ byteOrder: ByteOrder) where T : BitwiseCopyable, T : ConvertibleToBytes, T : FixedWidthInteger
```

## Parameters

`repeatedValue`

The value to store as raw bytes.

`count`

The number of copies of `repeatedValue` to store
into this span.

`type`

The type of the instance to store repeatedly.

`byteOrder`

The order in which the bytes will be encoded to the span.

## Discussion

There must be at least `count * MemoryLayout<T>.stride` bytes
available in the span.

---

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)