Skip to content

Commit 3fe357f

Browse files
Kelvin LauKelvin Lau
Kelvin Lau
authored and
Kelvin Lau
committed
Removed an argument label for the append method in an effort to keep consistent with native collection types. Changed a method name to be more Swift like.
1 parent 2b61c06 commit 3fe357f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Fixed Size Array/FixedSizeArray.playground/Contents.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ struct FixedSizeArray<T> {
2323
return array[index]
2424
}
2525

26-
mutating func append(newElement: T) {
26+
mutating func append(_ newElement: T) {
2727
assert(count < maxSize)
2828
array[count] = newElement
2929
count += 1
3030
}
3131

32-
mutating func removeAtIndex(index: Int) -> T {
32+
mutating func removeAt(index: Int) -> T {
3333
assert(index >= 0)
3434
assert(index < count)
3535
count -= 1
@@ -48,9 +48,9 @@ struct FixedSizeArray<T> {
4848
}
4949

5050
var array = FixedSizeArray(maxSize: 5, defaultValue: 0)
51-
array.append(newElement: 4)
52-
array.append(newElement: 2)
51+
array.append(4)
52+
array.append(2)
5353
array[1]
54-
array.removeAtIndex(index: 0)
54+
array.removeAt(index: 0)
5555
array.removeAll()
5656

Fixed Size Array/FixedSizeArray.playground/timeline.xctimeline

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
version = "3.0">
44
<TimelineItems>
55
<LoggerValueHistoryTimelineItem
6-
documentLocation = "#CharacterRangeLen=5&amp;CharacterRangeLoc=1228&amp;EndingColumnNumber=6&amp;EndingLineNumber=52&amp;StartingColumnNumber=1&amp;StartingLineNumber=52&amp;Timestamp=499271741.074357"
6+
documentLocation = "#CharacterRangeLen=5&amp;CharacterRangeLoc=1213&amp;EndingColumnNumber=6&amp;EndingLineNumber=52&amp;StartingColumnNumber=1&amp;StartingLineNumber=52&amp;Timestamp=499691083.961245"
77
selectedRepresentationIndex = "0"
88
shouldTrackSuperviewWidth = "NO">
99
</LoggerValueHistoryTimelineItem>
1010
<LoggerValueHistoryTimelineItem
11-
documentLocation = "#CharacterRangeLen=5&amp;CharacterRangeLoc=1295&amp;EndingColumnNumber=6&amp;EndingLineNumber=54&amp;StartingColumnNumber=1&amp;StartingLineNumber=54&amp;Timestamp=499271760.916283"
11+
documentLocation = "#CharacterRangeLen=5&amp;CharacterRangeLoc=1263&amp;EndingColumnNumber=6&amp;EndingLineNumber=54&amp;StartingColumnNumber=1&amp;StartingLineNumber=54&amp;Timestamp=499691083.961359"
1212
selectedRepresentationIndex = "0"
1313
shouldTrackSuperviewWidth = "NO">
1414
</LoggerValueHistoryTimelineItem>

0 commit comments

Comments
 (0)