From 2aa090746c55303925b960cd2e1dd38f2b9e865a Mon Sep 17 00:00:00 2001 From: David Christiandy <1299411+dvdchr@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:09:55 +0700 Subject: [PATCH] Simplify code --- .../Post/PrepublishingAutoSharingView.swift | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Post/PrepublishingAutoSharingView.swift b/WordPress/Classes/ViewRelated/Post/PrepublishingAutoSharingView.swift index 93f1150a7de9..d357a707b7ca 100644 --- a/WordPress/Classes/ViewRelated/Post/PrepublishingAutoSharingView.swift +++ b/WordPress/Classes/ViewRelated/Post/PrepublishingAutoSharingView.swift @@ -94,9 +94,7 @@ struct PrepublishingAutoSharingViewModel { /// Whether the icon for this service should be opaque or transparent. /// If at least one account is enabled, an opaque version should be shown. var usesOpaqueIcon: Bool { - connections.reduce(false) { partialResult, connection in - return partialResult || connection.enabled - } + connections.reduce(false) { $0 || $1.enabled } } var enabledConnections: [Connection] { @@ -117,15 +115,11 @@ struct PrepublishingAutoSharingViewModel { // MARK: Computed Properties var enabledConnectionsCount: Int { - services.reduce(0) { partialResult, service in - return partialResult + service.enabledConnections.count - } + services.reduce(0) { $0 + $1.enabledConnections.count } } var totalConnectionsCount: Int { - services.reduce(0) { partialResult, service in - return partialResult + service.connections.count - } + services.reduce(0) { $0 + $1.connections.count } } var showsWarning: Bool {