/Orion-iOS-Test-Task

WKWebView page navigation & zoom

Primary LanguageSwift

Orion iOS test task

Use UIKit and WebKit in Swift to implement web page navigation, page zoom, and app state restoration features.

Minimum deployment target: iOS 13.0

Tasks

  • WKWebView and bottom toolbar back/forward(/refresh) navigation buttons
  • Start view with centered start button which load a URL in WKWebView full screen
    • Top progress bar appear on loading a URL, fade out with animation on finishing loading
  • Page zoom gestures
  • Back/forward buttons navigation:
    • Through WKWebView.backForwardList and between start view and WKWebView
    • Corresponding enabled states of back/forward(/refresh) buttons
  • Screen edge pan gestures navigation:
    • Through WKWebView.backForwardList and between start view and WKWebView
    • Corresponding enabled states of back/forward(/refresh) buttons
  • Save/restore WKWebView navigation history between app launches
    • Implemented all methods listed in the two articles About the UI preservation process and About the UI restoration process (demonstrated in the two diagrams below).
    • Specified restorationIdentifier values of ViewController, the root UINavigationController, ViewController.view, ViewController.progressBar, and ViewController.webView.
    • Specified restorationClass values of ViewController.
    • Defined a Swift structure BrowserState that stores two properties webViewInteractionState and fullWebViewVisibleState for preserving and restoring ViewController.webView.interactionState (browsing history) and ViewController.fullWebViewVisibleState (webView visible state and back/forward button enabled states).
    • Store and load BrowserState records in the local file system with the help of FileManager.
    • State (browsing history) restoration does not work right now.
UI Preservation UI Restoration
Apple doc: UI preservation process Apple doc: UI restoration process

Package Dependencies

Demo Video Clips

Load WKWebView:

First load Refresh
wkwebview.mov
refresh_button.mov

WKWebView back/forward navigations:

Buttons Gestures
wkwebview_back_forward_buttons.mov
wkwebview_back_forward_gestures.mov

Back/forward navigations between WKWebView and start view

Buttons Gestures
start_view_back_forward_buttons.mov
start_view_back_forward_gestures.mov