13 lines
272 B
Swift
13 lines
272 B
Swift
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
|
|
}
|
|
}
|
|
}
|
|
}
|