From 26cba9a7d837f7cdd19b9ae5ff19daa0fda00bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Zieli=C5=84ski?= Date: Fri, 27 Oct 2023 15:49:09 +0200 Subject: [PATCH] Fix Swift 5.9 error when converting integer to data (#56) * Fix Swift 5.9 error when converting integer to data --- Framework/Source Files/Extensions/Int.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Framework/Source Files/Extensions/Int.swift b/Framework/Source Files/Extensions/Int.swift index e23f52d..4e836d2 100644 --- a/Framework/Source Files/Extensions/Int.swift +++ b/Framework/Source Files/Extensions/Int.swift @@ -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.size) + return withUnsafeBytes(of: self) { Data($0) } } }