Merge branch 'feature/atomic_analytics_streamlining' into 'develop'

add optional dictionary convenience function

See merge request BPHV_MIPS/mvm_core!107
This commit is contained in:
Pfeil, Scott Robert 2020-09-21 14:53:38 -04:00
commit d30a027b40

View File

@ -193,3 +193,13 @@ public extension Dictionary {
return previousObject
}
}
public extension Optional where Wrapped == Dictionary<AnyHashable, Any> {
func dictionaryAdding(key: AnyHashable, value: Any) -> Dictionary<AnyHashable, Any> {
var dictionary = self ?? [:]
dictionary[key] = value
return dictionary
}
}