<!--
{
  "availability" : [
    "iOS: 12.2.0 -",
    "iPadOS: 12.2.0 -",
    "macCatalyst: 12.2.0 -",
    "macOS: 10.14.4 -",
    "tvOS: 12.2.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/MutableRawSpan/storeBytes(of:toByteOffset:as:)-1afju",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s14MutableRawSpanV10storeBytes2of12toByteOffset2asyx_Sixmts15BitwiseCopyableRzs013ConvertibleToE0RzlF"
  },
  "title" : "storeBytes(of:toByteOffset:as:)"
}
-->

# storeBytes(of:toByteOffset:as:)

Stores the given value’s bytes to the specified offset into
the span’s memory.

```
mutating func storeBytes<T>(of value: T, toByteOffset offset: Int, as type: T.Type) where T : BitwiseCopyable, T : ConvertibleToBytes
```

## Parameters

`value`

The value to store as raw bytes.

`offset`

The offset in bytes into the span’s memory at which to begin
writing the bytes from the value.

`type`

The type of the instance to store.

## Discussion

The range of bytes required to store a value of type `T` starting at
byte offset `offset` must be completely within 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)