File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 66public struct Array2D < T> {
77 public let columns : Int
88 public let rows : Int
9- private var array : [ T ]
9+ fileprivate var array : [ T ]
1010
1111 public init ( columns: Int , rows: Int , initialValue: T ) {
1212 self . columns = columns
1313 self . rows = rows
14- array = . init( count: rows*columns, repeatedValue : initialValue )
14+ array = . init( repeatElement ( initialValue , count: rows*columns) )
1515 }
1616
1717 public subscript( column: Int , row: Int ) -> T {
Original file line number Diff line number Diff line change 66public struct Array2D < T> {
77 public let columns : Int
88 public let rows : Int
9- private var array : [ T ]
9+ fileprivate var array : [ T ]
1010
1111 public init ( columns: Int , rows: Int , initialValue: T ) {
1212 self . columns = columns
1313 self . rows = rows
14- array = . init( count : rows*columns , repeatedValue : initialValue )
14+ array = . init( repeating : initialValue , count : rows*columns )
1515 }
1616
1717 public subscript( column: Int , row: Int ) -> T {
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class Array2DTest: XCTestCase {
4343 }
4444
4545 func testPerformanceOnSmallArray( ) {
46- self . measureBlock {
46+ self . measure {
4747 self . printArrayWith ( columns: 2 , rows: 2 , inititalValue: 1 )
4848 }
4949 }
@@ -54,7 +54,7 @@ class Array2DTest: XCTestCase {
5454 // }
5555 // }
5656
57- private func printArrayWith( columns columns: Int , rows: Int , inititalValue: Int ) {
57+ fileprivate func printArrayWith( columns: Int , rows: Int , inititalValue: Int ) {
5858 let array = Array2D ( columns: columns, rows: rows, initialValue: 4 )
5959 for r in 0 ..< array. rows {
6060 for c in 0 ..< array. columns {
Original file line number Diff line number Diff line change 8888 TargetAttributes = {
8989 7B2BBC7F1C779D720067B71D = {
9090 CreatedOnToolsVersion = 7.2;
91+ LastSwiftMigration = 0800;
9192 };
9293 };
9394 };
220221 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
221222 PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests;
222223 PRODUCT_NAME = "$(TARGET_NAME)";
224+ SWIFT_VERSION = 3.0;
223225 };
224226 name = Debug;
225227 };
231233 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
232234 PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests;
233235 PRODUCT_NAME = "$(TARGET_NAME)";
236+ SWIFT_VERSION = 3.0;
234237 };
235238 name = Release;
236239 };
You can’t perform that action at this time.
0 commit comments