-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathOSIABSystemBrowserOptions.swift
More file actions
39 lines (36 loc) · 1.94 KB
/
OSIABSystemBrowserOptions.swift
File metadata and controls
39 lines (36 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import SafariServices
/// Structure that holds the value that a SystemBrowser (especifically `OSIABSafariViewControllerRouterAdapter`) can use for its visual presentation.
public class OSIABSystemBrowserOptions: OSIABOptions {
/// The dismiss style to present.
private let dismissStyle: OSIABDismissStyle
/// Indicates if the bars should collapse when scrolling.
let enableBarsCollapsing: Bool
/// Indicates if the readers mode should be enabled if present.
let enableReadersMode: Bool
/// Constructor method.
/// - Parameters:
/// - dismissStyle: The dismiss style to present. `defaultValue` is provided in case of no value.
/// - viewStyle: The view style to present. `defaultValue` is provided in case of no value.
/// - animationEffect: The animation effect for the presentation appearance and dismissal. `defaultValue` is provided in case of no value.
/// - enableBarsCollapsing: Indicates if the bars should collapse when scrolling. `true` is provided in case of no value.
/// - enableReadersMode: Indicates if the readers mode should be enabled if present. `false` is provided in case of no value.
public init(
dismissStyle: OSIABDismissStyle = .defaultValue,
viewStyle: OSIABViewStyle = .defaultValue,
animationEffect: OSIABAnimationEffect = .defaultValue,
enableBarsCollapsing: Bool = true,
enableReadersMode: Bool = false
) {
self.dismissStyle = dismissStyle
self.enableBarsCollapsing = enableBarsCollapsing
self.enableReadersMode = enableReadersMode
super.init(viewStyle: viewStyle, animationEffect: animationEffect)
}
}
// MARK: - SFSafariViewController extensions
extension OSIABSystemBrowserOptions {
/// The `SFSafariViewController`'s `dismissStyle` equivalent value.
var dismissButtonStyle: SFSafariViewController.DismissButtonStyle {
self.dismissStyle.toSFSafariViewControllerDismissButtonStyle()
}
}