From c77bb6ceaff466b19338dba9c694b2d0a7b0077c Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Fri, 22 May 2020 13:08:00 -0400 Subject: [PATCH] Update Format Workflow (#127) * Update Format Workflow * Update IdentifiedArrayTests.swift --- .github/workflows/format.yml | 2 +- .../SwiftUI/IdentifiedArray.swift | 3 ++- .../IdentifiedArrayTests.swift | 16 +++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 73dbcadc9f..e0f3e8d7e4 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -15,7 +15,7 @@ jobs: run: brew install swift-format - name: Format run: make format - - uses: stefanzweifel/git-auto-commit-action@v4.1.6 + - uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Run swift-format branch: 'master' diff --git a/Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift b/Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift index e3ca93ec3f..983995575c 100644 --- a/Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift +++ b/Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift @@ -238,7 +238,8 @@ where Element: Identifiable, ID == Element.ID { self.init([], id: \.id) } - public mutating func replaceSubrange(_ subrange: R, with newElements: C) where C : Collection, R : RangeExpression, Element == C.Element, Index == R.Bound { + public mutating func replaceSubrange(_ subrange: R, with newElements: C) + where C: Collection, R: RangeExpression, Element == C.Element, Index == R.Bound { let replacingIds = self.ids[subrange] let newIds = newElements.map { $0.id } ids.replaceSubrange(subrange, with: newIds) diff --git a/Tests/ComposableArchitectureTests/IdentifiedArrayTests.swift b/Tests/ComposableArchitectureTests/IdentifiedArrayTests.swift index d0e6916ee4..ca58a37094 100644 --- a/Tests/ComposableArchitectureTests/IdentifiedArrayTests.swift +++ b/Tests/ComposableArchitectureTests/IdentifiedArrayTests.swift @@ -133,14 +133,20 @@ final class IdentifiedArrayTests: XCTestCase { User(id: 2, name: "Blob Jr."), ] - array.replaceSubrange(0...1, with: [ - User(id: 4, name: "Flob IV"), - User(id: 5, name: "Flob V") - ]) + array.replaceSubrange( + 0...1, + with: [ + User(id: 4, name: "Flob IV"), + User(id: 5, name: "Flob V"), + ] + ) XCTAssertEqual( array, - [User(id: 4, name: "Flob IV"), User(id: 5, name: "Flob V"), User(id: 1, name: "Blob"), User(id: 2, name: "Blob Jr.")] + [ + User(id: 4, name: "Flob IV"), User(id: 5, name: "Flob V"), User(id: 1, name: "Blob"), + User(id: 2, name: "Blob Jr."), + ] ) } }