Periphery to detect dead code (#2227)

This commit is contained in:
Mauro
2023-12-12 11:17:15 +01:00
committed by GitHub
parent deb109f157
commit b9a6ebe03a
15 changed files with 121 additions and 112 deletions
@@ -31,17 +31,6 @@ extension View {
})
return alert(item.wrappedValue?.title ?? "", isPresented: binding, presenting: item.wrappedValue, actions: actions, message: message)
}
func alert<Item, Actions>(item: Binding<Item?>, @ViewBuilder actions: (Item) -> Actions) -> some View where Item: AlertProtocol, Actions: View {
let binding = Binding<Bool>(get: {
item.wrappedValue != nil
}, set: { newValue in
if !newValue {
item.wrappedValue = nil
}
})
return alert(item.wrappedValue?.title ?? "", isPresented: binding, presenting: item.wrappedValue, actions: actions)
}
}
/// A type that describes an alert to be shown to the user.