Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support configuring webView.scrollView.bounce #6

Merged
merged 5 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}
Loading