From 7c1394e8a42c767ebe89c8b638aa9bf87376f865 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Fri, 30 Sep 2022 11:34:30 +0200 Subject: [PATCH] Refactor --- .../Sources/AppCore/SharedUI/Data+hexString.swift | 4 ++-- .../xx-messenger/Sources/ContactFeature/ContactView.swift | 2 +- .../Sources/ContactLookupFeature/ContactLookupView.swift | 2 +- .../xx-messenger/Sources/MyContactFeature/MyContactView.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Examples/xx-messenger/Sources/AppCore/SharedUI/Data+hexString.swift b/Examples/xx-messenger/Sources/AppCore/SharedUI/Data+hexString.swift index 05755e40..e8010b95 100644 --- a/Examples/xx-messenger/Sources/AppCore/SharedUI/Data+hexString.swift +++ b/Examples/xx-messenger/Sources/AppCore/SharedUI/Data+hexString.swift @@ -1,7 +1,7 @@ import Foundation extension Data { - public var hexString: String { - map { String(format: "%02hhx ", $0) }.joined() + public func hexString(bytesSeparator: String = " ") -> String { + map { String(format: "%02hhx\(bytesSeparator)", $0) }.joined() } } diff --git a/Examples/xx-messenger/Sources/ContactFeature/ContactView.swift b/Examples/xx-messenger/Sources/ContactFeature/ContactView.swift index 5bfe475b..daa84903 100644 --- a/Examples/xx-messenger/Sources/ContactFeature/ContactView.swift +++ b/Examples/xx-messenger/Sources/ContactFeature/ContactView.swift @@ -111,7 +111,7 @@ public struct ContactView: View { if let dbContact = viewStore.dbContact { Section { - Label(dbContact.id.hexString, systemImage: "number") + Label(dbContact.id.hexString(), systemImage: "number") .font(.footnote.monospaced()) Label(dbContact.username ?? "", systemImage: "person") Label(dbContact.email ?? "", systemImage: "envelope") diff --git a/Examples/xx-messenger/Sources/ContactLookupFeature/ContactLookupView.swift b/Examples/xx-messenger/Sources/ContactLookupFeature/ContactLookupView.swift index d4a759d5..6ce83eda 100644 --- a/Examples/xx-messenger/Sources/ContactLookupFeature/ContactLookupView.swift +++ b/Examples/xx-messenger/Sources/ContactLookupFeature/ContactLookupView.swift @@ -25,7 +25,7 @@ public struct ContactLookupView: View { WithViewStore(store, observe: ViewState.init) { viewStore in Form { Section { - Label(viewStore.id.hexString, systemImage: "number") + Label(viewStore.id.hexString(), systemImage: "number") .font(.footnote.monospaced()) Button { diff --git a/Examples/xx-messenger/Sources/MyContactFeature/MyContactView.swift b/Examples/xx-messenger/Sources/MyContactFeature/MyContactView.swift index eca55d62..d32a6f68 100644 --- a/Examples/xx-messenger/Sources/MyContactFeature/MyContactView.swift +++ b/Examples/xx-messenger/Sources/MyContactFeature/MyContactView.swift @@ -51,7 +51,7 @@ public struct MyContactView: View { WithViewStore(store, observe: ViewState.init) { viewStore in Form { Section { - Text(viewStore.contact?.id.hexString ?? "") + Text(viewStore.contact?.id.hexString() ?? "") .font(.footnote.monospaced()) .textSelection(.enabled) } header: { -- GitLab