add two-way translation between existing Profile class and new PersistedProfile CoreData class

This commit is contained in:
Bryan Montz
2023-05-12 07:19:43 -05:00
parent 76c57af548
commit 7027b7016c
2 changed files with 24 additions and 0 deletions

View File

@@ -23,6 +23,18 @@ class Profile: Codable {
self.nip05 = nip05
}
convenience init(persisted_profile: PersistedProfile) {
self.init(name: persisted_profile.name,
display_name: persisted_profile.display_name,
about: persisted_profile.about,
picture: persisted_profile.picture,
banner: persisted_profile.banner,
website: persisted_profile.website,
lud06: persisted_profile.lud06,
lud16: persisted_profile.lud16,
nip05: persisted_profile.nip05)
}
private func str(_ str: String) -> String? {
return get_val(str)
}