Я включаю приближение в приложении, и когда пользователь долго «нажимает» на сенсор, и экран становится темным.
//MARK:- Activate Proximity Sensor
func activateProximitySensor() {
let device = UIDevice.current
device.isProximityMonitoringEnabled = true
NotificationCenter.default.addObserver(self, selector: #selector(proximityStateDidChange), name:UIDevice.proximityStateDidChangeNotification, object: device)
}
@objc func proximityStateDidChange(notification: NSNotification) {
if viewModel.dataSourceArrayCarousel.count > 0 {
currentIndexPath = IndexPath(row: self.currentPage, section: 0)
let model = viewModel.getModelFotCellAtIndexPathForCarousel(index: currentIndexPath.row)
let cell = collectionView!.cellForItem(at: currentIndexPath)
revealCard(model: model, cell: cell as! MyCardCell, indexPath: currentIndexPath)
} }
Есть предложения о том, как управлять такими ситуациями?