Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

2.1.0

Compare
Choose a tag to compare
@mickael-menu mickael-menu released this 29 Jul 12:37
· 12 commits to develop since this release
5fa961c

Take a look at the migration guide

Added

  • Support for Swift Package Manager (contributed by @stevenzeck).
  • EPUB navigator:
    • The EPUB navigator is now able to navigate to a Locator using its text context. This is useful for search results or highlights missing precise locations.
    • New EPUBNavigatorViewController.evaluateJavaScript() API to run a JavaScript on the currently visible HTML resource.
    • New userSettings property for EPUBNavigatorViewController.Configuration to set the default user settings values (contributed by @ettore).
    • You can provide custom editing actions for the text selection menu (contributed by @cbaltzer).
      1. Create a custom action with, for example: EditingAction(title: "Highlight", action: #selector(highlight:))
      2. Then, implement the selector in one of your classes in the responder chain. Typically, in the UIViewController wrapping the navigator view controller.
      class EPUBViewController: UIViewController {
          init(publication: Publication) {
              var config = EPUBNavigatorViewController.Configuration()
              config.editingActions.append(EditingAction(title: "Highlight", action: #selector(highlight)))
              let navigator = EPUBNavigatorViewController(publication: publication, config: config)
          }
      
          @objc func highlight(_ sender: Any) {}
      }
  • New SelectableNavigator protocol for navigators supporting user selection.
    • Get or clear the current selection.
    • Implement navigator(_:canPerformAction:for:) to validate each editing action for the current selection. For example, to make sure the selected text is not too large for a definition look up.
    • Implement navigator(_:shouldShowMenuForSelection:) to override the default edit menu (UIMenuController) with a custom selection pop-up.
  • (alpha) A new navigator for audiobooks.
    • The navigator is chromeless, so you will need to provide your own user interface.

Deprecated

  • Removed navigator(_:userContentController:didReceive:) which is actually not needed since you can provide your own WKScriptMessageHandler to WKUserContentController.

Fixed

  • Fixed receiving EPUBNavigatorDelegate.navigator(_:setupUserScripts:) for the first web view.
  • r2-testapp-swift#343 Fixed hiding "Share" editing action (contributed by @rocxteady).