For iPhone5 (10.2) simulator this function:
static func fromByteArray<T>(_ value: [UInt8], _: T.Type) -> T {
return value.withUnsafeBytes {
$0.baseAddress!.load(as: T.self)
}
}
crashes at $0.baseAddress!.load(as: T.self)
with this error:
fatal error: load from misaligned raw pointer
Does somebody know the solution?
I'm using this code:
https://stackoverflow.com/a/26954091/1979882
EDIT it works for iPhone5s but not iPhone5