skip to Main Content

Ios swift – How to take programatically take screenshot of an app in iOS with UIAlertController as the top controller?

extension UIViewController { static func takeScreenshot() -> UIImage? { guard let topController = UIApplication.getTopController() else { return nil } if let view = topController.view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale) defer { UIGraphicsEndImageContext() } if let context = UIGraphicsGetCurrentContext() { view.layer.render(in: context)…

VIEW QUESTION

Ios swift – Schedule local notifications on only weekdays and between 8am to 5pm in Swift

I'm trying to schedule local notifications on only weekdays, between the 8am to 5pm. Need to trigger a local notification on given time interval. func scheduleNotifications(timeInterval: Int) { let notificationCenter = UNUserNotificationCenter.current() notificationCenter.removeAllDeliveredNotifications() notificationCenter.removeAllPendingNotificationRequests() let startHour = 8 let totalHours…

VIEW QUESTION
Back To Top
Search