Skip to content

Commit e0a3b63

Browse files
committed
Migrates Breadth First Search tests project to Swift 3 syntax
1 parent c8ce274 commit e0a3b63

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Breadth-First Search/Tests/Graph.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Node: CustomStringConvertible, Equatable {
3939
}
4040

4141
public func remove(edge: Edge) {
42-
neighbors.removeAtIndex(neighbors.indexOf { $0 === edge }!)
42+
neighbors.remove(at: neighbors.index { $0 === edge }!)
4343
}
4444
}
4545

@@ -56,13 +56,13 @@ public class Graph: CustomStringConvertible, Equatable {
5656
self.nodes = []
5757
}
5858

59-
public func addNode(label: String) -> Node {
59+
public func addNode(_ label: String) -> Node {
6060
let node = Node(label: label)
6161
nodes.append(node)
6262
return node
6363
}
6464

65-
public func addEdge(source: Node, neighbor: Node) {
65+
public func addEdge(_ source: Node, neighbor: Node) {
6666
let edge = Edge(neighbor: neighbor)
6767
source.neighbors.append(edge)
6868
}
@@ -78,7 +78,7 @@ public class Graph: CustomStringConvertible, Equatable {
7878
return description
7979
}
8080

81-
public func findNodeWithLabel(label: String) -> Node {
81+
public func findNodeWithLabel(_ label: String) -> Node {
8282
return nodes.filter { $0.label == label }.first!
8383
}
8484

Breadth-First Search/Tests/Queue.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct Queue<T> {
1313
return array.count
1414
}
1515

16-
public mutating func enqueue(element: T) {
16+
public mutating func enqueue(_ element: T) {
1717
array.append(element)
1818
}
1919

Breadth-First Search/Tests/Tests.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
TargetAttributes = {
9595
7B2BBC7F1C779D720067B71D = {
9696
CreatedOnToolsVersion = 7.2;
97+
LastSwiftMigration = 0820;
9798
};
9899
};
99100
};
@@ -230,6 +231,7 @@
230231
PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests;
231232
PRODUCT_NAME = "$(TARGET_NAME)";
232233
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
234+
SWIFT_VERSION = 3.0;
233235
};
234236
name = Debug;
235237
};
@@ -242,6 +244,7 @@
242244
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
243245
PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests;
244246
PRODUCT_NAME = "$(TARGET_NAME)";
247+
SWIFT_VERSION = 3.0;
245248
};
246249
name = Release;
247250
};

0 commit comments

Comments
 (0)