Open iamimsh opened 2 years ago
Don't know if we have the same problem, but when trying to present Lightbox from a .pageSheet
modalPresentationStyle (the default style now in iOS 13) I get a transparent screen that blocks anything from happening.
My solution (workaround) was to just start an empty view controller on .fullScreen
and then present lightbox from there
Here's a helper class, maybe it helps:
class FullScreenImageViewController: UIViewController {
private var controller: LightboxController?
private var hasDisplayed = false
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .black
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
guard let controller = controller else {
return
}
if hasDisplayed {
dismiss(animated: false, completion: nil)
} else {
hasDisplayed = true
controller.modalPresentationStyle = .fullScreen
controller.dynamicBackground = true
present(controller, animated: true)
}
}
func configure(image: UIImage) {
controller = LightboxController(images: [.init(image: image)])
}
func configure(imageURL: URL) {
controller = LightboxController(images: [.init(imageURL: imageURL)])
}
}
let fullScreenImageScene = FullScreenImageViewController()
fullScreenImageScene.modalPresentationStyle = .fullScreen
fullScreenImageScene.configure(image: myImage)
present(fullScreenImageScene, animated: false)
I've updated to the latest version, I saw in previous version that this issue was resolved. However, it isn't solved yet. App freezes when presenting LightBoxController.