Skip to content

Instantly share code, notes, and snippets.

@nalexn
Created December 21, 2019 13:06
Show Gist options
  • Save nalexn/bc9924e9326337fc037aea6f775a769d to your computer and use it in GitHub Desktop.
Save nalexn/bc9924e9326337fc037aea6f775a769d to your computer and use it in GitHub Desktop.
struct CustomView: View {
@EnvironmentObject var appState: Deduplicated<AppState, Snapshot>
var body: some View {
Text("Value: \(appState.value)")
}
}
let view = CustomView()
.environmentObject(appState
.deduplicated { Snapshot(value: $0.value) })
extension CustomView {
struct Snapshot {
let value: Int
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment