Skip to content

Commit 9a5e2b7

Browse files
CalebRasphilium
andauthored
Apply suggestions from code review.
Co-authored-by: Philip Ridgeway <[email protected]>
1 parent e982486 commit 9a5e2b7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Scripts/DowloadPortalItemData.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ let portalItems: Set<PortalItem> = {
219219
// Omit the decoding errors from samples that don't have dependencies.
220220
let sampleDependencies = sampleJSONs
221221
.compactMap { try? parseJSON(at: $0) }
222-
return Set(sampleDependencies.flatMap(\.offlineData))
222+
return Set(sampleDependencies.lazy.flatMap(\.offlineData))
223223
} catch {
224224
print("error: Error decoding Samples dependencies: \(error.localizedDescription)")
225225
exit(1)
@@ -245,11 +245,11 @@ var downloadedItems = previousDownloadedItems
245245
// Asynchronously downloads portal items.
246246
let dispatchGroup = DispatchGroup()
247247

248-
portalItems.forEach { portalItem in
248+
for portalItem in portalItems {
249249
// Checks to see if an item is already downloaded.
250-
guard !downloadedItems.keys.contains(portalItem.identifier) else {
250+
guard downloadedItems[portalItem.identifier] == nil else {
251251
print("note: Item already downloaded: \(portalItem.identifier)")
252-
return
252+
continue
253253
}
254254

255255
let destinationURL = downloadDirectoryURL.appendingPathComponent(portalItem.identifier, isDirectory: true)

0 commit comments

Comments
 (0)