<!--
{
  "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/RawSpan/load(fromByteOffset:as:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s7RawSpanV4load14fromByteOffset2as_xSi_xms0E5OrderOts20ConvertibleFromBytesRzs17FixedWidthIntegerRzlF"
  },
  "title" : "load(fromByteOffset:as:_:)"
}
-->

# load(fromByteOffset:as:_:)

Returns a value constructed from the raw memory at the specified offset.

```
func load<T>(fromByteOffset offset: Int, as type: T.Type, _ byteOrder: ByteOrder) -> T where T : ConvertibleFromBytes, T : FixedWidthInteger
```

## Parameters

`offset`

The offset from the beginning of this span, in bytes.
`offset` must be nonnegative.

`type`

The type of the instance to create.

`byteOrder`

The order in which the bytes will be decoded.

## Return Value

A new value of type `T`, read from `offset`.

## Discussion

The range of bytes required to construct a value of type `T` starting at
`offset` must be completely within the span.
`offset` is not required to be aligned for `T`.

---

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)