First it said that
'UIApplicationDidEnterBackground' has been renamed to 'UIApplication.didEnterBackgroundNotification'
and when I dot it,it said
Type 'Notification.Name' (aka 'NSNotification.Name') has no member 'UIApplication'
func listenForBackgroundNotification() {
observer = NotificationCenter.default.addObserver(forName: Notification.Name.UIApplicationDidEnterBackground, object: nil, queue: OperationQueue.main) { [weak self] _ in
if let weakSelf = self {
if weakSelf.presentedViewController != nil {
weakSelf.dismiss(animated: true, completion: nil)
}
weakSelf.descriptionTextView.resignFirstResponder()
}
}
}