Skip to content

Commit 26cba9a

Browse files
Fix Swift 5.9 error when converting integer to data (#56)
* Fix Swift 5.9 error when converting integer to data
1 parent a418c21 commit 26cba9a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Framework/Source Files/Extensions/Int.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import Foundation
77

88
/// Extension for signed integers allowing conversion to Data with proper size.
99
internal extension UnsignedInteger {
10-
10+
1111
/// Returns decoded data with proper size.
1212
var decodedData: Data {
13-
var mutableSelf = self
14-
return Data(bytes: &mutableSelf, count: MemoryLayout<Self>.size)
13+
return withUnsafeBytes(of: self) { Data($0) }
1514
}
1615
}

0 commit comments

Comments
 (0)