diff --git a/App/Commands/Install.swift b/App/Commands/Install.swift index 5d3591e..5532532 100644 --- a/App/Commands/Install.swift +++ b/App/Commands/Install.swift @@ -13,7 +13,7 @@ struct InstallCommand: CommandProtocol { func run(_ options: Options) -> Result<(), MASError> { // Try to download applications with given identifiers and collect results - let downloadResults = options.appIds.flatMap { (appId) -> MASError? in + let downloadResults = options.appIds.compactMap { (appId) -> MASError? in if let product = installedApp(appId) , !options.forceInstall { printWarning("\(product.appName) is already installed") return nil diff --git a/App/Commands/Lucky.swift b/App/Commands/Lucky.swift index b2bc314..c139019 100644 --- a/App/Commands/Lucky.swift +++ b/App/Commands/Lucky.swift @@ -32,7 +32,7 @@ struct LuckyCommand: CommandProtocol { fileprivate func install(_ appId: UInt64, options: Options) -> Result<(), MASError> { // Try to download applications with given identifiers and collect results - let downloadResults = [appId].flatMap { (appId) -> MASError? in + let downloadResults = [appId].compactMap { (appId) -> MASError? in if let product = installedApp(appId) , !options.forceInstall { printWarning("\(product.appName) is already installed") return nil diff --git a/App/Commands/Upgrade.swift b/App/Commands/Upgrade.swift index 7c3693d..7507043 100644 --- a/App/Commands/Upgrade.swift +++ b/App/Commands/Upgrade.swift @@ -23,7 +23,7 @@ struct UpgradeCommand: CommandProtocol { let appIds: [UInt64] - appIds = apps.flatMap { + appIds = apps.compactMap { if let appId = UInt64($0) { return appId } @@ -35,7 +35,7 @@ struct UpgradeCommand: CommandProtocol { // check each of those for updates - updates = appIds.flatMap { + updates = appIds.compactMap { updateController?.availableUpdate(withItemIdentifier: $0) } @@ -56,7 +56,7 @@ struct UpgradeCommand: CommandProtocol { print("Upgrading \(updates.count) outdated application\(updates.count > 1 ? "s" : ""):") print(updates.map({ "\($0.title) (\($0.bundleVersion))" }).joined(separator: ", ")) - let updateResults = updates.flatMap { + let updateResults = updates.compactMap { download($0.itemIdentifier.uint64Value) }