Sesame-iOS/Sesame/API/Extensions/UInt8+Extensions.swift

13 lines
272 B
Swift
Raw Normal View History

2023-12-20 09:25:53 +01:00
import Foundation
extension Array where Element == UInt8 {
func convert<T>(to _: T.Type) -> T {
withUnsafeBufferPointer {
$0.baseAddress!.withMemoryRebound(to: T.self, capacity: 1) {
$0.pointee
}
}
}
}