Post

Replies

Boosts

Views

Activity

Reply to App crash on iOS16 when presenting a QLPreviewController.
@darkpaw I have added the code below, Kindly check   // MARK: - QLPreview delegate and datasource methods     func numberOfPreviewItems(in controller: QLPreviewController) -> Int {   return 1  }     func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {   let url = URL(fileURLWithPath: selectedAttachmentPath ?? "")   return url as QLPreviewItem  }     // MARK: - custom methods  fileprivate func presentDownloadedAttachment() {   let previewController = QLPreviewController()   previewController.dataSource = self   self.present(previewController, animated: false, completion: {    previewController.updateNavigationBarTintColor()   })  } extension QLPreviewController {     func updateNavigationBarTintColor() {       if let firstChild = self.children[0] as? UINavigationController {         let navigationBar = firstChild.navigationBar    // The bar must be set isTranslucent = false for the tint colours to work    navigationBar.isTranslucent = false    navigationBar.barTintColor = AppTheme.primary.color    navigationBar.tintColor = AppTheme.primary.color         if let toolbar = firstChild.toolbar {     // The toolbar must be set isTranslucent = false for the tint colours to work     toolbar.isTranslucent = false     navigationBar.barTintColor = AppTheme.primary.color     toolbar.tintColor = AppTheme.primary.color    }   }  } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22