damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

RelayModelCache.swift (513B)


      1 //
      2 //  RelayModels.swift
      3 //  damus
      4 //
      5 //  Created by Bryan Montz on 6/10/23.
      6 //
      7 
      8 import Foundation
      9 
     10 final class RelayModelCache: ObservableObject {
     11     private var models = [RelayURL: RelayModel]()
     12     
     13     func model(withURL url: RelayURL) -> RelayModel? {
     14         models[url]
     15     }
     16 
     17     func model(with_relay_id url_string: RelayURL) -> RelayModel? {
     18         return model(withURL: url_string)
     19     }
     20 
     21     func insert(model: RelayModel) {
     22         models[model.url] = model
     23         objectWillChange.send()
     24     }
     25 }