@@ -25,6 +25,7 @@ public struct WebView {
2525 private var allowsScrollViewBounces = true
2626 private var allowsOpaqueDrawing = true
2727 private var pageScaleFactor : CGFloat = 1.0
28+ private var contentInsetAdjustmentBehavior = ContentInsetAdjustmentBehavior . automatic
2829 private var isRefreshable = false
2930
3031 /// Creates new WebView.
@@ -120,6 +121,21 @@ public struct WebView {
120121 return modified
121122 }
122123
124+ /// Sets the behavior for determining the adjusted content offsets.
125+ /// - Parameter behavior: The behavior for determining the adjusted content offsets.
126+ /// - Returns: WebView that applies the content inset adgustment behavior.
127+ ///
128+ /// This modifier specifies how the safe area insets are used to modify the content area of the scroll view.
129+ /// The default value of this property is `ContentInsetAdjustmentBehavior.automatic`.
130+ ///
131+ /// If you want to use a WebView in full screen on iOS and iPadOS,
132+ /// you should specify `ContentInsetAdjustmentBehavior.never` and also apply `SwiftUI.View.ignoresSafeArea()`.
133+ public func contentInsetAdjustmentBehavior( _ behavior: ContentInsetAdjustmentBehavior ) -> Self {
134+ var modified = self
135+ modified. contentInsetAdjustmentBehavior = behavior
136+ return modified
137+ }
138+
123139 /// Marks this view as refreshable.
124140 /// - Returns: WebView that reloads page contents when users perform an action to refresh.
125141 ///
@@ -143,6 +159,7 @@ public struct WebView {
143159 webView. allowsScrollViewBounces = allowsScrollViewBounces
144160 webView. allowsOpaqueDrawing = allowsOpaqueDrawing
145161 webView. pageScaleFactor = pageScaleFactor
162+ webView. contentInsetAdjustmentBehavior = contentInsetAdjustmentBehavior
146163 webView. isRefreshable = isRefreshable
147164 }
148165
0 commit comments