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
This commit is part of merge request !102. Comments created here will be created in the context of that merge request.
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()
}
}
......@@ -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")
......
......@@ -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 {
......
......@@ -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: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment