Update Package.swift
👨🏻💻 Feel free to subscribe to channel SwiftUI dev in telegram.
Demo project with tutorial how to customize alerts or popovers in SwiftUI based on this article.
Before starting highly recommended to read SwiftUI Custom Environment Values.
To use PopoverPresenter with a project targeting iOS 13, simply copy folder Source into your project.
Source
To integrate PopoverPresenter into your project using SwiftPM add the following to your Package.swift:
Package.swift
dependencies: [ .package(url: "https://github.com/c-villain/PopoverPresenter", from: "0.1.0"), ],
import PopoverPresenter
@StateObject var popoverPresenter = PopoverPresenter()
.environment(\.popoverPresenterKey, popoverPresenter) .customPopover(item: $popoverPresenter.activePopover) { popover in switch popover { default: popoverPresenter.currentPopover } }
@Environment(\.popoverPresenterKey) var popoverPresenter
popoverPresenter.currentPopover = AnyView(Text("This is alert!")) popoverPresenter.activePopover = .any
You may look iOS example in package for guide steps above.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
PopoverPresenter
👨🏻💻 Feel free to subscribe to channel SwiftUI dev in telegram.
Demo project with tutorial how to customize alerts or popovers in SwiftUI based on this article.
Before starting highly recommended to read SwiftUI Custom Environment Values.
Installation
To use PopoverPresenter with a project targeting iOS 13, simply copy folder
Source
into your project.Swift Package Manager
To integrate PopoverPresenter into your project using SwiftPM add the following to your
Package.swift
:Quick start
You may look iOS example in package for guide steps above.