diff --git a/damus/Nostr/Profiles.swift b/damus/Nostr/Profiles.swift new file mode 100644 index 00000000..2aa4ae63 --- /dev/null +++ b/damus/Nostr/Profiles.swift @@ -0,0 +1,26 @@ +// +// Profiles.swift +// damus +// +// Created by William Casarin on 2022-04-17. +// + +import Foundation + + +class Profiles: ObservableObject { + @Published var profiles: [String: TimestampedProfile] = [:] + + func add(id: String, profile: TimestampedProfile) { + profiles[id] = profile + objectWillChange.send() + } + + func lookup(id: String) -> Profile? { + return profiles[id]?.profile + } + + func lookup_with_timestamp(id: String) -> TimestampedProfile? { + return profiles[id] + } +}