Use guard statement to avoid forced unwrapping and return early
ayoy opened this issue · 0 comments
ayoy commented
func wiresCrossings(wires: [[Point]]) -> Set<Point> {
guard let firstWire = wires.first else {
return []
}
let head = Set(firstWire)
return wires.dropFirst().reduce(head) { $0.intersection($1) }
}