Skip to content

Commit

Permalink
Fix Swift 5.9 error when converting integer to data (#56)
Browse files Browse the repository at this point in the history
* Fix Swift 5.9 error when converting integer to data
  • Loading branch information
filip-zielinski authored Oct 27, 2023
1 parent a418c21 commit 26cba9a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Framework/Source Files/Extensions/Int.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import Foundation

/// Extension for signed integers allowing conversion to Data with proper size.
internal extension UnsignedInteger {

/// Returns decoded data with proper size.
var decodedData: Data {
var mutableSelf = self
return Data(bytes: &mutableSelf, count: MemoryLayout<Self>.size)
return withUnsafeBytes(of: self) { Data($0) }
}
}

0 comments on commit 26cba9a

Please sign in to comment.