Skip to content
Snippets Groups Projects
Commit 7c1394e8 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Refactor

parent 4843a17f
No related branches found
No related tags found
2 merge requests!112Restore contacts from backup,!102Release 1.0.0
import Foundation import Foundation
extension Data { extension Data {
public var hexString: String { public func hexString(bytesSeparator: String = " ") -> String {
map { String(format: "%02hhx ", $0) }.joined() map { String(format: "%02hhx\(bytesSeparator)", $0) }.joined()
} }
} }
...@@ -111,7 +111,7 @@ public struct ContactView: View { ...@@ -111,7 +111,7 @@ public struct ContactView: View {
if let dbContact = viewStore.dbContact { if let dbContact = viewStore.dbContact {
Section { Section {
Label(dbContact.id.hexString, systemImage: "number") Label(dbContact.id.hexString(), systemImage: "number")
.font(.footnote.monospaced()) .font(.footnote.monospaced())
Label(dbContact.username ?? "", systemImage: "person") Label(dbContact.username ?? "", systemImage: "person")
Label(dbContact.email ?? "", systemImage: "envelope") Label(dbContact.email ?? "", systemImage: "envelope")
......
...@@ -25,7 +25,7 @@ public struct ContactLookupView: View { ...@@ -25,7 +25,7 @@ public struct ContactLookupView: View {
WithViewStore(store, observe: ViewState.init) { viewStore in WithViewStore(store, observe: ViewState.init) { viewStore in
Form { Form {
Section { Section {
Label(viewStore.id.hexString, systemImage: "number") Label(viewStore.id.hexString(), systemImage: "number")
.font(.footnote.monospaced()) .font(.footnote.monospaced())
Button { Button {
......
...@@ -51,7 +51,7 @@ public struct MyContactView: View { ...@@ -51,7 +51,7 @@ public struct MyContactView: View {
WithViewStore(store, observe: ViewState.init) { viewStore in WithViewStore(store, observe: ViewState.init) { viewStore in
Form { Form {
Section { Section {
Text(viewStore.contact?.id.hexString ?? "") Text(viewStore.contact?.id.hexString() ?? "")
.font(.footnote.monospaced()) .font(.footnote.monospaced())
.textSelection(.enabled) .textSelection(.enabled)
} header: { } header: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment