Skip to content

Commit

Permalink
feat: support configuring webView.scrollView.bounce (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
HorusGoul authored Sep 23, 2023
1 parent d0a8949 commit 8108fd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Sources/Peregrine/WebFrame+Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extension WebFrame {
public let functions: RemoteFunctions?
public let observables: RemoteObservables?
public let pathHandlers: [String: PathHandler]?
public let webViewOptions: WebViewOptions

internal static let appScheme = "app"
internal static let rpcScheme = "peregrine"
Expand Down Expand Up @@ -42,12 +43,14 @@ extension WebFrame {
)!, // swiftlint:disable:this force_unwrapping
functions: RemoteFunctions? = nil,
observables: RemoteObservables? = nil,
pathHandlers: [String: PathHandler]? = nil
pathHandlers: [String: PathHandler]? = nil,
webViewOptions: WebViewOptions = WebViewOptions()
) {
self.baseURL = baseURL
self.functions = functions
self.observables = observables
self.pathHandlers = pathHandlers
self.webViewOptions = webViewOptions
}
}
}
2 changes: 1 addition & 1 deletion Sources/Peregrine/WebFrame.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public final class WebFrame: Frame {
}

webView.navigationDelegate = webViewNavigationDelegate
webView.scrollView.bounces = false
webView.scrollView.bounces = configuration.webViewOptions.scrollView.bounces
webView.scrollView.contentInsetAdjustmentBehavior = .never
webView.uiDelegate = webViewUIDelegate

Expand Down
7 changes: 7 additions & 0 deletions Sources/Peregrine/WebViewOptions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
internal struct WebViewScrollViewOptions {
var bounces = false
}

public struct WebViewOptions {
public let scrollView = WebViewScrollViewOptions()
}

0 comments on commit 8108fd5

Please sign in to comment.