Skip to content

Instantly share code, notes, and snippets.

@mortenbekditlevsen
Created July 26, 2018 12:17
Show Gist options
  • Save mortenbekditlevsen/1cd81bfd00636b71dbf73c365ae67617 to your computer and use it in GitHub Desktop.
Save mortenbekditlevsen/1cd81bfd00636b71dbf73c365ae67617 to your computer and use it in GitHub Desktop.
public extension DatabaseReference {
func setValue<T>(_ value: T) throws where T: Encodable {
let encoder = StructureEncoder()
self.setValue(try encoder.encode(value))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment