]> git.r.bdr.sh - rbdr/map/blob - Map/Extensions/Binding+unwrap.swift
Initial commit
[rbdr/map] / Map / Extensions / Binding+unwrap.swift
1 import SwiftUI
2
3 extension 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 }