diff --git a/UpdateChecker/Source/Checker.swift b/UpdateChecker/Source/Checker.swift index 9bfbb60..8bd4ade 100644 --- a/UpdateChecker/Source/Checker.swift +++ b/UpdateChecker/Source/Checker.swift @@ -9,6 +9,7 @@ import Foundation let k_CheckDateInited = "k_CheckDateInited" + public typealias ResultsHandler = (Result) -> Void public struct Checker { diff --git a/UpdateChecker/Source/Managers/APIManager.swift b/UpdateChecker/Source/Managers/APIManager.swift index 46c3337..1bd0319 100644 --- a/UpdateChecker/Source/Managers/APIManager.swift +++ b/UpdateChecker/Source/Managers/APIManager.swift @@ -14,8 +14,6 @@ public struct APIManager { private struct Constants { /// Constant for the `bundleId` parameter in the iTunes Lookup API request. static let bundleID = "bundleId" - /// Constant for the `country` parameter in the iTunes Lookup API request. - static let country = "country" /// Constant for the `entity` parameter in the iTunes Lookup API reqeust. static let entity = "entity" } @@ -82,7 +80,8 @@ extension APIManager { DispatchQueue.main.async { handler?(.success(apiModel)) } - } catch { + } + catch { handler?(.failure(.appStoreJSONParsingFailure(underlyingError: error))) } } diff --git a/UpdateChecker/Source/Models/Model.swift b/UpdateChecker/Source/Models/Model.swift index fd49e42..42ad5de 100644 --- a/UpdateChecker/Source/Models/Model.swift +++ b/UpdateChecker/Source/Models/Model.swift @@ -34,11 +34,13 @@ public struct Model { /// - minimumOSVersion: The minimum version of iOS that the current version of the app requires. /// - releaseNotes: The releases notes from the latest version of the app. /// - version: The latest version of the app. - init(appID: Int, - currentVersionReleaseDate: String, - minimumOSVersion: String, - releaseNotes: String?, - version: String) { + init( + appID: Int, + currentVersionReleaseDate: String, + minimumOSVersion: String, + releaseNotes: String?, + version: String + ) { self.appID = appID self.currentVersionReleaseDate = currentVersionReleaseDate self.minimumOSVersion = minimumOSVersion diff --git a/UpdateChecker/Source/Siren.swift b/UpdateChecker/Source/Siren.swift index 3bb8221..6c2a0e5 100644 --- a/UpdateChecker/Source/Siren.swift +++ b/UpdateChecker/Source/Siren.swift @@ -8,28 +8,15 @@ import UIKit -/// The Siren Class. public final class Siren: NSObject { - /// Return results or errors obtained from performing a version check with Siren. public typealias ResultsHandler = (Result) -> Void + static let shared = Siren() - /// The Siren singleton. The main point of entry to the Siren library. - public static let shared = Siren() - - /// The manager that controls the App Store API that is - /// used to fetch the latest version of the app. - /// - /// Defaults to the US App Store. - public lazy var apiManager: APIManager = .default - - /// The current installed version of your app. + lazy var apiManager: APIManager = .default lazy var currentInstalledVersion: String? = Bundle.version() - /// The App Store's unique identifier for an app. private var appID: Int? private var configuration: UpdateConfiguration! - - /// The completion handler used to return the results or errors returned by Siren. private var resultsHandler: ResultsHandler? }