Remove most uses of AppDelegate.appDelegate on iOS.

This commit is contained in:
Brent Simmons
2025-02-01 13:28:49 -08:00
parent 2fed6d3cb3
commit 900cbabe71
10 changed files with 65 additions and 24 deletions

View File

@@ -10,11 +10,13 @@ import UIKit
import RSCore
import os.log
typealias ErrorHandlerBlock = (Error) -> Void
struct ErrorHandler {
private static var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Application")
public static func present(_ viewController: UIViewController) -> (Error) -> Void {
public static func present(_ viewController: UIViewController) -> ErrorHandlerBlock {
return { [weak viewController] error in
if UIApplication.shared.applicationState == .active {
viewController?.presentError(error)
@@ -27,5 +29,4 @@ struct ErrorHandler {
public static func log(_ error: Error) {
os_log(.error, log: self.log, "%@", error.localizedDescription)
}
}