좀 늦었지만 WWDC22 'What's new in WKWebView' 라는 세션을 보고 iOS 16에서 사용할 수 있는 WKWebView 신규 기능에 대해서 알아볼게요.
# Web content interaction
## Fullscreen support
Javascript의 webkitRequestFullscreen 기능을 쓸 수 있게 되었습니다.
(특정 element를 전체화면으로 확대시키는 기능입니다.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findInteraction은 webView 만의 기능이 아닙니다. TextField에서도 사용할 수 있는데요. TextField에 showingReplace를 true로 설정하면, 아래 같은 Replace Panel도 사용할 수 있게 됩니다.
WKWebView는 웹뷰이기 때문에 showingReplace를 true로 설정해도 Replace Panel을 사용할 수 없는 것 같아요.
# Content blocking
WKContentRuleListStore를 사용해서 content blocking을 할 수 있어요.
(이미지, 동영상 등 특정 콘텐츠 load를 막는 것을 content blocking이라고 합니다.)
이제 정규표현식으로 content blocking 할 URL을 지정할 수 있게 되었습니다.
예를 들어서, 아래처럼 if-frame-url 필드를 설정하면 wikipedia 관련 모든 하위 URL에서 content blocking이 됩니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters