]> git.r.bdr.sh - rbdr/map/blame_incremental - Map/Extensions/Binding+unwrap.swift
Initial commit
[rbdr/map] / Map / Extensions / Binding+unwrap.swift
... / ...
CommitLineData
1import SwiftUI
2
3extension Binding {
4 init(_ source: Binding<Value?>, _ defaultValue: Value) {
5 // Ensure a non-nil value in `source`.
6 if source.wrappedValue == nil {
7 source.wrappedValue = defaultValue
8 }
9 // Unsafe unwrap because *we* know it's non-nil now.
10 self.init(source)!
11 }
12}