Skip to content

Commit bcb10ae

Browse files
authored
Fix Xcode previews crash (#31)
* Fix Xcode previews crash * Format
1 parent be42d85 commit bcb10ae

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Examples/TicTacToe/Sources/Core/GameCore.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ extension Array where Element == [Player?] {
8787

8888
func hasWin(_ player: Player) -> Bool {
8989
let winConditions = [
90-
[0,1,2], [3,4,5], [6,7,8],
91-
[0,3,6], [1,4,7], [2,5,8],
92-
[0,4,8], [6,4,2]
90+
[0, 1, 2], [3, 4, 5], [6, 7, 8],
91+
[0, 3, 6], [1, 4, 7], [2, 5, 8],
92+
[0, 4, 8], [6, 4, 2],
9393
]
9494

9595
for condition in winConditions {
96-
let matchCount = condition
97-
.map { self[$0%3][$0/3] }
96+
let matchCount =
97+
condition
98+
.map { self[$0 % 3][$0 / 3] }
9899
.filter { $0 == player }
99100
.count
100101

Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ where ID: Hashable {
9696
get {
9797
self.dictionary[id]
9898
}
99-
_modify {
100-
yield &self.dictionary[id]
101-
if self.dictionary[id] == nil {
99+
set {
100+
self.dictionary[id] = newValue
101+
if newValue == nil {
102102
self.ids.removeAll(where: { $0 == id })
103103
}
104104
}

0 commit comments

Comments
 (0)