ContiguousBytes
protocol · iOS 8.0+ · SDK 27.1
protocol ContiguousBytes : ~Copyable, ~EscapableA protocol that declares the type offers direct access to the underlying raw bytes in a contiguous manner. This protocol predates the introduction of the `RawSpan` type in the standard library. Types that conform to this protocol will generally provide a property (often called `bytes`) that produces a `RawSpan`, which is easier to use than the closure-based APIs in this protocol. Therefore, new code should generally be written to use `RawSpan` rather than `ContiguousBytes`. Existing functions that use `ContiguousBytes` to accept raw bytes can be generalized to also support directly passing a `RawSpan` or `Span<UInt8>` by suppressing the implicit `Copyable` and `Escapable` requirements: func encrypt<Bytes: ContiguousBytes>(_ bytes: Bytes) -> [UInt8] where Bytes: ~Copyable, Bytes: ~Escapable { return bytes.withBytes { rawSpan in ... } }
Members (0)
This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.
Skipped declarations
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
ContiguousBytes.withBytes(_:)
The iOS SDK compiler rejected this binding: cannot convert value of type 'RawSpan' to expected element type 'Any'