Skip to content

Commit

Permalink
Configure interactive dismissal of the Lock popup
Browse files Browse the repository at this point in the history
On iPad, with a presentation style of .formSheet, the LockViewController
could be dismissed by simply tapping outside the bounds of the modal,
without regard for the `closable` [1] option.

Setting `isModalInPresentation` [2] based on `closable` allows controlling
whether or not UIKit should prevent the interactive dismissal of the popup.

[1] https://auth0.com/docs/libraries/lock-swift/lock-swift-configuration-options#closable
[2] https://developer.apple.com/documentation/uikit/uiviewcontroller/3229894-ismodalinpresentation
  • Loading branch information
agirault authored Dec 1, 2020
1 parent 88f9f93 commit f9da748
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Lock/LockViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class LockViewController: UIViewController {
lock.observerStore.controller = self
if self.lock.style.modalPopup && UIDevice.current.userInterfaceIdiom == .pad {
self.modalPresentationStyle = .formSheet
self.isModalInPresentation = !lock.options.closable
self.preferredContentSize = CGSize(width: 375, height: 667)
} else {
self.modalPresentationStyle = .fullScreen
Expand Down

0 comments on commit f9da748

Please sign in to comment.