Skip to content

Commit

Permalink
Refactor FXIOS-10205 [Swiftlint] Resolve 2 implicitly_unwrapped_optio…
Browse files Browse the repository at this point in the history
…nal violations in WKEngineWebView (#23801)

* Resolve warnings in WKEngineWebView

* Fix mock implementation of WKEngineWebView

---------

Co-authored-by: Marceau Tonelli <[email protected]>
  • Loading branch information
tonell-m and tonelli-m authored Dec 17, 2024
1 parent 7864eec commit 24fdd76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class WKEngineSession: NSObject,
}

func scrollToTop() {
webView.engineScrollView.setContentOffset(CGPoint.zero, animated: true)
webView.engineScrollView?.setContentOffset(CGPoint.zero, animated: true)
}

func findInPage(text: String, function: FindInPageFunction) {
Expand Down
4 changes: 2 additions & 2 deletions BrowserKit/Sources/WebEngine/WKWebview/WKEngineWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protocol WKEngineWebView: UIView {
var interactionState: Any? { get set }
var url: URL? { get }
var title: String? { get }
var engineScrollView: WKScrollView! { get }
var engineScrollView: WKScrollView? { get }
var engineConfiguration: WKEngineConfiguration { get }
var hasOnlySecureContent: Bool { get }

Expand Down Expand Up @@ -132,7 +132,7 @@ extension WKEngineWebView {
// TODO: FXIOS-7896 #17641 Handle WKEngineWebView ThemeApplicable
// TODO: FXIOS-7897 #17642 Handle WKEngineWebView AccessoryViewProvider
class DefaultWKEngineWebView: WKWebView, WKEngineWebView, MenuHelperWebViewInterface {
var engineScrollView: WKScrollView!
var engineScrollView: WKScrollView?
var engineConfiguration: WKEngineConfiguration
weak var delegate: WKEngineWebViewDelegate?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MockWKEngineWebView: UIView, WKEngineWebView {

var engineConfiguration: WKEngineConfiguration
var interactionState: Any?
var engineScrollView: WKScrollView! = MockEngineScrollView()
var engineScrollView: WKScrollView? = MockEngineScrollView()
var url: URL?
var title: String?
var hasOnlySecureContent = false
Expand Down

0 comments on commit 24fdd76

Please sign in to comment.