Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Examples/TicTacToe/Sources/Core/GameCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ extension Array where Element == [Player?] {

func hasWin(_ player: Player) -> Bool {
let winConditions = [
[0,1,2], [3,4,5], [6,7,8],
[0,3,6], [1,4,7], [2,5,8],
[0,4,8], [6,4,2]
[0, 1, 2], [3, 4, 5], [6, 7, 8],
[0, 3, 6], [1, 4, 7], [2, 5, 8],
[0, 4, 8], [6, 4, 2],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still don't have the format GitHub action quite working as I'd expect...

]

for condition in winConditions {
let matchCount = condition
.map { self[$0%3][$0/3] }
let matchCount =
condition
.map { self[$0 % 3][$0 / 3] }
.filter { $0 == player }
.count

Expand Down
6 changes: 3 additions & 3 deletions Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ where ID: Hashable {
get {
self.dictionary[id]
}
_modify {
yield &self.dictionary[id]
if self.dictionary[id] == nil {
set {
self.dictionary[id] = newValue
if newValue == nil {
self.ids.removeAll(where: { $0 == id })
}
}
Expand Down