Skip to content

Commit

Permalink
Merge pull request #3 from mejiagarcia/main
Browse files Browse the repository at this point in the history
Add keys and values properties
  • Loading branch information
iThink32 authored Oct 8, 2023
2 parents 6d30207 + cefbc6b commit d2c2c16
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ThreadSafeDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ class ThreadSafeDictionary<V: Hashable,T>: Collection {
private var dictionary: [V: T]
private let concurrentQueue = DispatchQueue(label: "Dictionary Barrier Queue",
attributes: .concurrent)

var keys: Dictionary<V, T>.Keys {
self.concurrentQueue.sync {
return self.dictionary.keys
}
}

var values: Dictionary<V, T>.Values {
self.concurrentQueue.sync {
return self.dictionary.values
}
}

var startIndex: Dictionary<V, T>.Index {
self.concurrentQueue.sync {
return self.dictionary.startIndex
Expand Down

0 comments on commit d2c2c16

Please sign in to comment.