we have several SwiftUI screens that are presented as sheet. all of then can be dismissed by clicking a button.
so basically all of them have these 2 in common:
@Environment(\.presentationMode) var presentationMode
func dismiss() {
presentationMode.wrappedValue.dismiss()
}
how can i declare them only once and just reuse them only in specific views? i cannot use inheritance since they are stucts, extensions cannot contain state (except using a holder struct) and would add these to all instances of the same view type.
