Extension of the restricted vocabulary protocol
I am trying to get a specific type of dictionary to conform to the protocol.
typealias FirebaseDictionary = Dictionary<String, FirebaseValue>
I would like to comply with the protocol FirebaseValue
protocol FirebaseValue {
// stuff here
}
I tried this
extension FirebaseDictionary: FirebaseValue {
}
but I got an error Constrained extension must be declared on the unspecialized generic type 'Dictionary' with constraints specified by a 'where' clause
. So now I have this
extension Dictionary where Key == String, Value == FirebaseValue {
}
but I can't seem to figure out the correct syntax to make this conform to the protocol, if at all possible. If not possible, is there any other way to achieve the same effect? I'm trying to only allow certain types in a property and it's easy to distinguish what type they are when reading.
This question has been asked but did not provide a definitive answer and it may have changed independently.
source to share