Skip to content

Commit

Permalink
Document PresentationStyle enumeration (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsanthanam committed Apr 13, 2024
1 parent 74c7a5c commit beac547
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
7 changes: 4 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"originHash" : "fe45a2d882851bdb91759a41c86703d3fa367079c5a0000f65a7346f37b70551",
"pins" : [
{
"identity" : "swift-docc-plugin",
Expand All @@ -23,10 +24,10 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/nicklockwood/SwiftFormat",
"state" : {
"revision" : "9e5d0d588ab6e271fe9887ec3dde21d544d4b080",
"version" : "0.53.5"
"revision" : "9df3b01f477163b33d5e63c5e2e5b9f946a49c56",
"version" : "0.53.6"
}
}
],
"version" : 2
"version" : 3
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let package = Package(
),
.package(
url: "https://github.com/nicklockwood/SwiftFormat",
exact: "0.53.5"
exact: "0.53.6"
)
],
targets: [
Expand Down
14 changes: 10 additions & 4 deletions Sources/SafariUI/SafariUI.docc/SafariView.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ You can present a `SafariView` using the built-in presentation view modifiers:

- ``SwiftUI/View/safari(isPresented:presentationStyle:onDismiss:safariView:)``
- ``SwiftUI/View/safari(isPresented:url:presentationStyle:onDismiss:)``
- ``SwiftUI/View/safari(item:onDismiss:safariView:)``
- ``SwiftUI/View/safari(item:id:onDismiss:safariView:)``
- ``SwiftUI/View/safari(url:onDismiss:)``
- ``SwiftUI/View/safari(item:presentationStyle:onDismiss:safariView:)``
- ``SwiftUI/View/safari(item:id:presentationStyle:onDismiss:safariView:)``
- ``SwiftUI/View/safari(url:presentationStyle:onDismiss:)``

You can also use sheet presentation, or any other presentation mechanism of your choice.
These modifiers use the standard presentation mechanism that you would otherwise use to present an `SFSafariViewController` in a UIKit application. To customize the behavior of the modifier, see the ``SafariView/PresentationStyle`` enumeration.

A `SafariView` is also a regular SwiftUI view, and can be presented through any other mechanism of your choice.

## Topics

Expand All @@ -39,6 +41,10 @@ You can also use sheet presentation, or any other presentation mechanism of your

- ``DismissButtonStyle``

### Presentation Options

- ``PresentationStyle``

### Connection Prewarming

- ``prewarmConnections(to:)``
Expand Down
6 changes: 3 additions & 3 deletions Sources/SafariUI/SafariUI.docc/View.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ SwiftUI view modifiers used to configure a ``SafariView`` or a ``WebAuthenticati

- ``SwiftUI/View/safari(isPresented:presentationStyle:onDismiss:safariView:)``
- ``SwiftUI/View/safari(isPresented:url:presentationStyle:onDismiss:)``
- ``SwiftUI/View/safari(item:onDismiss:safariView:)``
- ``SwiftUI/View/safari(item:id:onDismiss:safariView:)``
- ``SwiftUI/View/safari(url:onDismiss:)``
- ``SwiftUI/View/safari(item:presentationStyle:onDismiss:safariView:)``
- ``SwiftUI/View/safari(item:id:presentationStyle:onDismiss:safariView:)``
- ``SwiftUI/View/safari(isPresented:presentationStyle:onDismiss:safariView:)``

### SafarView Custom Activities

Expand Down
1 change: 0 additions & 1 deletion Sources/SafariView/Presentation/BoolPresentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public extension View {

}

@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
private struct IsPresentedModifier: ViewModifier {

// MARK: - Initializer
Expand Down
12 changes: 11 additions & 1 deletion Sources/SafariView/Presentation/PresentationStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
public extension SafariView {

enum PresentationStyle: Equatable, Hashable, Sendable, Codable {
/// The available presentation styles of a ``SafariView``
enum PresentationStyle: Equatable, Hashable, Sendable {

/// Standard Presentation
case standard

/// Form Sheet Presentation
case formSheet

/// Page Sheet Presentation
case pageSheet

/// Default Presentation
public static let `default`: PresentationStyle = .standard

}

}

0 comments on commit beac547

Please sign in to comment.