Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring the presentation style of modal views, enabling fullScreenCover where available while maintaining backward compatibility with existing sheet-based behavior.
Changes:
- Introduces
ModalViewPresentationStyleand aView.modalViewPresentationStyle(_:)helper, plus associated environment plumbing. - Refactors
ModalPresenterinto platform/OS-version–aware modifiers, and updatesModalLinkto honor the configured presentation style by routing tosheetorfullScreenCoveron supported platforms. - Updates documentation in
README.mdto describe styling options and fixes a minor grammatical issue.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Sources/ModalView/ModalViewPresentationStyle.swift | Defines the ModalViewPresentationStyle enum and environment-based API to let views choose between sheet and fullScreenCover, with a default and compatibility fallback. |
| Sources/ModalView/ModalView.swift | Adapts ModalPresenter to use distinct modifiers for pre‑ and post‑iOS 14, extends the modal pipeline to carry a ModalViewPresentationStyle, and updates ModalLink to read the style from the environment and present accordingly. |
| README.md | Documents the available presentation styles and clarifies wording in the usage section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @available(iOS 14, tvOS 14, watchOS 7, *) | ||
| @available(macOS, unavailable) | ||
| private struct ModalPresenterIOS14: ViewModifier { | ||
| @ObservedObject private var modalView = Pipe() | ||
|
|
||
| public var body: some View { | ||
| func body(content: Content) -> some View { | ||
| content | ||
| .environmentObject(modalView) | ||
| .sheet(item: $modalView.content, content: { $0.view }) | ||
| .sheet(item: $modalView.sheetContent, content: { $0.view }) | ||
| .fullScreenCover(item: $modalView.fullScreenCoverContent, content: { $0.view }) |
There was a problem hiding this comment.
The new ModalPresenterIOS14 modifier and ModalViewPresentationStyle environment-based switching between .sheet and .fullScreenCover are not covered by tests, even though ModalPresenter and ModalLink already have snapshot tests; adding tests that validate the behavior when the presentation style is changed (and that legacy platforms still fall back to .sheet) would help prevent regressions.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.