Files
2021-01-21 16:28:38 +01:00

33 lines
633 B
Swift

//
// PopoverModifier.swift
// Recipes
//
// Created by Paul Kraft on 05.01.21.
//
import SwiftUI
struct PopoverModifier<Item: Identifiable, Destination: View>: ViewModifier {
// MARK: Stored Properties
private let item: Binding<Item?>
private let destination: (Item) -> Destination
// MARK: Initialization
init(item: Binding<Item?>,
@ViewBuilder content: @escaping (Item) -> Destination) {
self.item = item
self.destination = content
}
// MARK: Methods
func body(content: Content) -> some View {
content.popover(item: item, content: destination)
}
}