Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit 8868778

Browse files
authored
Merge pull request #1 from iosdevelopershq/swift-2.2
Swift 2.2
2 parents 14c3550 + 8a554b6 commit 8868778

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ xcuserdata
2626
## Obj-C/Swift specific
2727
*.hmap
2828
*.ipa
29+
.DS_Store

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode7.1
2+
osx_image: xcode7.3
33

44
script:
55
- xcodebuild -project CodeChallenge.xcodeproj -scheme CodeChallengeTests -destination 'platform=iOS Simulator,name=iPhone 6' test

CodeChallenge/Base/CodeChallengeType.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import Foundation
1515
*/
1616
protocol CodeChallengeType {
1717
/// The type for the input(s) for the challenge.
18-
typealias InputType
18+
associatedtype InputType
1919
/// The type that the entry's function will return.
20-
typealias OutputType
20+
associatedtype OutputType
2121

2222
/// The heading title for this challenge
2323
var title: String { get }
@@ -170,9 +170,9 @@ extension CodeChallengeType {
170170
for result in results {
171171
for output in result.outputs {
172172
if verifyOutput(output, forInput: result.input) {
173-
successes++
173+
successes += 1
174174
} else {
175-
failures++
175+
failures += 1
176176
}
177177
}
178178
}

CodeChallenge/Challenges/TwoSum/Entries/AlexPersian.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import Foundation
1010

1111
let alexPersianTwoSumEntry = CodeChallengeEntry<TwoSumChallenge>(name: "AlexPersian") { input in
12-
for (var i: Int = 0; i < input.numbers.count; i++) {
13-
for (var j: Int = 0; j < input.numbers.count; j++) {
12+
for i in 0..<input.numbers.count {
13+
for j in 0..<input.numbers.count {
1414
if ((input.numbers[i] + input.numbers[j]) == input.target) {
1515
return (i + 1, j + 1)
1616
}

CodeChallenge/Challenges/TwoSum/Entries/BugKrusha.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
let bugkrushaTwoSumEntry = CodeChallengeEntry<TwoSumChallenge>(name: "Jazbo") { input in
1212
for (index, num) in input.numbers.enumerate() {
13-
for var i = index + 1; i < input.numbers.count; i++ {
13+
for i in index + 1 ..< input.numbers.count {
1414
if calculate(input.numbers[i], numTwo: num, calculation: +) == input.target {
1515
return (index + 1, i + 1)
1616
}

0 commit comments

Comments
 (0)