added additional example
Easily to present different popups from any subview over fullscreen on SwiftUI.
Swift Package Manager:
https://github.com/Jnis/ZPopupPresenter.git
import ZPopupPresenter struct ContentView: View { let zPopupPresenterModel = ZPopupPresenterModel() // 1.1. shared model var body: some View { ZStack { MyView() .environmentObject(zPopupPresenterModel) // 1.2. inject model for subviews ZPopupPresenterView(model: zPopupPresenterModel) // 2. popups place } } }
showPopup
AnyView( ... )
close
struct MyView: View { @EnvironmentObject var zPopupPresenterModel: ZPopupPresenterModel // shared model var body: some View { VStack { Button("Show Popup", action: { zPopupPresenterModel.showPopup({ close in // 3. AnyView( DemoPopup1View(closeBlock: close) // 4. ) }) }) } } }
You can find more examples inside /Examples folder.
/Examples
MIT
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
ZPopupPresenter
Easily to present different popups from any subview over fullscreen on SwiftUI.
Features
Installing
Swift Package Manager:
Usage
showPopup
method of shared model and wrap your view withAnyView( ... )
close
closure to remove popupYou can find more examples inside
/Examples
folder.License
MIT