This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Bundle { | |
func decode<T: Decodable>(_ type: T.Type, from filename: String) -> T { | |
guard let json = url(forResource: filename, withExtension: nil) else { | |
fatalError("Failed to locate \(filename) in app bundle.") | |
} | |
guard let jsonData = try? Data(contentsOf: json) else { | |
fatalError("Failed to load \(filename) from app bundle.") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIApplication { | |
class func openAppSettings() { | |
guard let url = URL(string: self.openSettingsURLString) else { return } | |
self.shared.open(url, options: [:], completionHandler: nil) | |
} | |
class func openSubscriptionManagement() { | |
guard let url = URL(string: "itms://apps.apple.com/account/subscriptions") else { return } | |
self.shared.open(url, options: [:], completionHandler: nil) | |
} |