diff --git a/Package.swift b/Package.swift index 61986fb..2f1c9c2 100644 --- a/Package.swift +++ b/Package.swift @@ -18,7 +18,6 @@ let package = Package( name: "Updates", dependencies: [], path: "Updates/Classes", - exclude: ["UI"], resources: [.copy("../../Example/Pods/Target Support Files/Updates/PrivacyInfo.xcprivacy")] ) ] diff --git a/Updates/Classes/Core/Updates.swift b/Updates/Classes/Core/Updates.swift index 114a608..bea6394 100644 --- a/Updates/Classes/Core/Updates.swift +++ b/Updates/Classes/Core/Updates.swift @@ -49,7 +49,7 @@ public class Updates { /// - appStoreId: The app store identifier specified as a String. /// - Returns: The URL required to launch the App Store page for the specified app, /// provided a valid identifier is provided. - static func appStoreURL(for appStoreId: String) -> URL? { + public static func appStoreURL(for appStoreId: String) -> URL? { Updates.appStoreId = appStoreId return appStoreURL } @@ -78,7 +78,7 @@ public class Updates { public static var notifying: NotificationMode = .once - public static var minimumOSVersion: String? + public static var minimumOSVersion: String? = Bundle.main.infoDictionary?["MinimumOSVersion"] as? String public static var minimumOptionalAppVersion: String? @@ -187,8 +187,18 @@ public class Updates { releaseNotes: releaseNotes, updateType: updateType, updatingMode: updatingMode, - latestVersion: versionString + latestVersion: newVersionString ) } } + +#if canImport(UIKit) +import UIKit + +public extension Updates { + static func checkForUpdates(completion: @escaping (UpdatesResult) -> Void) { + Updates.checkForUpdates(currentOSVersion: UIDevice.current.systemVersion, completion: completion) + } +} +#endif diff --git a/Updates/Classes/UI/Updates+UIDevice.swift b/Updates/Classes/UI/Updates+UIDevice.swift deleted file mode 100644 index 28466c2..0000000 --- a/Updates/Classes/UI/Updates+UIDevice.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// Updates+UIDevice.swift -// Updates -// -// Created by Ross Butler on 8/8/19. -// - -import Foundation -import UIKit - -public extension Updates { - - static func checkForUpdates(completion: @escaping (UpdatesResult) -> Void) { - Updates.checkForUpdates(currentOSVersion: UIDevice.current.systemVersion, completion: completion) - } - -} diff --git a/Updates/Classes/UI/UpdatesUI.swift b/Updates/Classes/UI/UpdatesUI.swift index f3f4ca7..8590003 100644 --- a/Updates/Classes/UI/UpdatesUI.swift +++ b/Updates/Classes/UI/UpdatesUI.swift @@ -5,9 +5,11 @@ // Created by Ross Butler on 12/27/18. // +#if canImport(UIKit) import Foundation import StoreKit import SafariServices +import Updates public class UpdatesUI: NSObject { @@ -248,3 +250,4 @@ private extension UpdatesUI { } } +#endif