     }
     
     public func delete(peerWithId peerId: String) {
-        UserDefaults.standard.removeObject(forKey: peer.id)
-    }
-}
-
-
+        UserDefaults.standard.removeObject(forKey: peerId)
+    }
+}
+
+

            UserDefaults.standard.set(savedPeerIds, forKey: savedPeerIdsDefaultsKey)
        }
        
        return peer as T
    }
    
    public func update(peerWithId peerId: String, withPeerData data: [String: Any]) {
        var clinkPeer = peer
        
        clinkPeer.data = data
        
        UserDefaults.standard.set(clinkPeer.toDict(), forKey: clinkPeer.id)
    }
    
    public func getPeer<T: ClinkPeer>(withId peerId: String) -> T? {
        guard let peerDict = UserDefaults.standard.dictionary(forKey: peerId) else { return nil }
        
        return Clink.Peer(dict: peerDict)
        
    }
    
    public func getKnownPeers<T: ClinkPeer>() -> [T] {


extension Clink: ClinkPeerManager {
    public func createPeer<T: ClinkPeer>(withId peerId: String) -> T {
        let peer = T(id: peerId, peerData: [:])
        
        UserDefaults.standard.set(peer.toDict(), forKey: peer.id)
        
