Skip to content

Commit 456a2d7

Browse files
committed
Update for Swift 2.2 (Xcode 7.3)
1 parent c7cd081 commit 456a2d7

File tree

11 files changed

+76
-74
lines changed

11 files changed

+76
-74
lines changed

SwiftTask.xcodeproj/project.pbxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
isa = PBXProject;
298298
attributes = {
299299
LastSwiftUpdateCheck = 0700;
300-
LastUpgradeCheck = 0700;
300+
LastUpgradeCheck = 0730;
301301
ORGANIZATIONNAME = "Yasuhiro Inami";
302302
TargetAttributes = {
303303
1F46DED3199EDF1000F97868 = {
@@ -502,6 +502,7 @@
502502
buildSettings = {
503503
APPLICATION_EXTENSION_API_ONLY = YES;
504504
CLANG_ENABLE_MODULES = YES;
505+
COMBINE_HIDPI_IMAGES = YES;
505506
DEFINES_MODULE = YES;
506507
DYLIB_COMPATIBILITY_VERSION = 1;
507508
DYLIB_CURRENT_VERSION = 1;
@@ -520,6 +521,7 @@
520521
buildSettings = {
521522
APPLICATION_EXTENSION_API_ONLY = YES;
522523
CLANG_ENABLE_MODULES = YES;
524+
COMBINE_HIDPI_IMAGES = YES;
523525
DEFINES_MODULE = YES;
524526
DYLIB_COMPATIBILITY_VERSION = 1;
525527
DYLIB_CURRENT_VERSION = 1;

SwiftTask.xcodeproj/xcshareddata/xcschemes/SwiftTask.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0730"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

SwiftTask/Cancellable.swift

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

1111
public protocol Cancellable
1212
{
13-
typealias _Error
13+
associatedtype _Error
1414

1515
//
1616
// NOTE:

SwiftTask/SwiftTask.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ extension Task
704704
task.success { (value: Value) -> Void in
705705

706706
lock.lock()
707-
completedCount++
707+
completedCount += 1
708708

709709
let progressTuple = BulkProgress(completedCount: completedCount, totalCount: totalCount)
710710
progress(progressTuple)
@@ -754,7 +754,7 @@ extension Task
754754
task.success { (value: Value) -> Void in
755755

756756
lock.lock()
757-
completedCount++
757+
completedCount += 1
758758

759759
if completedCount == 1 {
760760
fulfill(value)
@@ -766,7 +766,7 @@ extension Task
766766
}.failure { (errorInfo: ErrorInfo) -> Void in
767767

768768
lock.lock()
769-
rejectedCount++
769+
rejectedCount += 1
770770

771771
if rejectedCount == totalCount {
772772
let isAnyCancelled = (tasks.filter { task in task.state == .Cancelled }.count > 0)
@@ -803,7 +803,7 @@ extension Task
803803
task.then { (value: Value?, errorInfo: ErrorInfo?) -> Void in
804804

805805
lock.lock()
806-
completedCount++
806+
completedCount += 1
807807

808808
let progressTuple = BulkProgress(completedCount: completedCount, totalCount: totalCount)
809809
progress(progressTuple)

SwiftTask/_StateMachine.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ internal struct _Handlers<T>: SequenceType
262262

263263
internal mutating func remove(token: _HandlerToken) -> T?
264264
{
265-
for var i = 0; i < self.elements.count; i++ {
265+
for i in 0..<self.elements.count {
266266
if self.elements[i].key == token.key {
267267
return self.elements.removeAtIndex(i).value
268268
}
@@ -277,6 +277,6 @@ internal struct _Handlers<T>: SequenceType
277277

278278
internal func generate() -> AnyGenerator<T>
279279
{
280-
return anyGenerator(self.elements.map { $0.value }.generate())
280+
return AnyGenerator(self.elements.map { $0.value }.generate())
281281
}
282282
}

SwiftTaskTests/AlamofireTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AlamofireTests: _TestCase
1616

1717
func testFulfill()
1818
{
19-
let expect = self.expectationWithDescription(__FUNCTION__)
19+
let expect = self.expectationWithDescription(#function)
2020

2121
let task = Task<Progress, String, NSError> { progress, fulfill, reject, configure in
2222

@@ -46,7 +46,7 @@ class AlamofireTests: _TestCase
4646

4747
func testReject()
4848
{
49-
let expect = self.expectationWithDescription(__FUNCTION__)
49+
let expect = self.expectationWithDescription(#function)
5050

5151
let task = Task<Progress, String?, NSError> { progress, fulfill, reject, configure in
5252

@@ -86,7 +86,7 @@ class AlamofireTests: _TestCase
8686

8787
func testProgress()
8888
{
89-
let expect = self.expectationWithDescription(__FUNCTION__)
89+
let expect = self.expectationWithDescription(#function)
9090

9191
// define task
9292
let task = Task<Progress, String, NSError> { progress, fulfill, reject, configure in
@@ -129,7 +129,7 @@ class AlamofireTests: _TestCase
129129

130130
func testNSProgress()
131131
{
132-
let expect = self.expectationWithDescription(__FUNCTION__)
132+
let expect = self.expectationWithDescription(#function)
133133
let nsProgress = NSProgress(totalUnitCount: 100)
134134

135135
// define task
@@ -176,7 +176,7 @@ class AlamofireTests: _TestCase
176176
//
177177
func testCancel()
178178
{
179-
let expect = self.expectationWithDescription(__FUNCTION__)
179+
let expect = self.expectationWithDescription(#function)
180180

181181
let task = Task<Progress, String?, NSError> { progress, fulfill, reject, configure in
182182

SwiftTaskTests/BasicTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BasicTests: _TestCase
1616
{
1717
typealias Task = SwiftTask.Task<Float, String, ErrorString>
1818

19-
let expect = self.expectationWithDescription(__FUNCTION__)
19+
let expect = self.expectationWithDescription(#function)
2020

2121
// define task
2222
let task = Task { progress, fulfill, reject, configure in

SwiftTaskTests/MultipleErrorTypesTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class MultipleErrorTypesTests: _TestCase
6161

6262
func testMultipleErrorTypes_then()
6363
{
64-
let expect = self.expectationWithDescription(__FUNCTION__)
64+
let expect = self.expectationWithDescription(#function)
6565

6666
self._task1(ok: true)
6767
.then { value, errorInfo -> Task2 in
@@ -87,7 +87,7 @@ class MultipleErrorTypesTests: _TestCase
8787

8888
func testMultipleErrorTypes_success()
8989
{
90-
let expect = self.expectationWithDescription(__FUNCTION__)
90+
let expect = self.expectationWithDescription(#function)
9191

9292
self._task1(ok: true)
9393
.success { value -> Task2 in
@@ -113,7 +113,7 @@ class MultipleErrorTypesTests: _TestCase
113113

114114
func testMultipleErrorTypes_success_differentErrorType()
115115
{
116-
let expect = self.expectationWithDescription(__FUNCTION__)
116+
let expect = self.expectationWithDescription(#function)
117117

118118
self._task1(ok: true)
119119
.success { value -> Task2 in
@@ -151,7 +151,7 @@ class MultipleErrorTypesTests: _TestCase
151151

152152
func testMultipleErrorTypes_success_differentErrorType_conversion()
153153
{
154-
let expect = self.expectationWithDescription(__FUNCTION__)
154+
let expect = self.expectationWithDescription(#function)
155155

156156
self._task1(ok: true)
157157
.success { value -> Task<Void, MyEnum, String> in
@@ -191,7 +191,7 @@ class MultipleErrorTypesTests: _TestCase
191191

192192
func testMultipleErrorTypes_failure()
193193
{
194-
let expect = self.expectationWithDescription(__FUNCTION__)
194+
let expect = self.expectationWithDescription(#function)
195195

196196
self._task1(ok: false)
197197
.failure { errorInfo -> Task<Dummy, String /* must be task1's value type to recover */, Dummy> in

SwiftTaskTests/RemoveHandlerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class RemoveHandlerTests: _TestCase
1616
{
1717
typealias Task = SwiftTask.Task<Float, String, ErrorString>
1818

19-
let expect = self.expectationWithDescription(__FUNCTION__)
19+
let expect = self.expectationWithDescription(#function)
2020

2121
var latestProgressValue: Float?
2222
var canceller: AutoCanceller? = nil
@@ -60,7 +60,7 @@ class RemoveHandlerTests: _TestCase
6060
{
6161
typealias Task = SwiftTask.Task<Float, String, ErrorString>
6262

63-
let expect = self.expectationWithDescription(__FUNCTION__)
63+
let expect = self.expectationWithDescription(#function)
6464
var canceller: AutoCanceller? = nil
6565

6666
// define task

SwiftTaskTests/RetainCycleTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class RetainCycleTests: _TestCase
5454

5555
func testPlayer_completionAsArgument_notConfigured()
5656
{
57-
let expect = self.expectationWithDescription(__FUNCTION__)
57+
let expect = self.expectationWithDescription(#function)
5858

5959
//
6060
// retain cycle:
@@ -98,7 +98,7 @@ class RetainCycleTests: _TestCase
9898

9999
func testPlayer_completionAsArgument_configured()
100100
{
101-
let expect = self.expectationWithDescription(__FUNCTION__)
101+
let expect = self.expectationWithDescription(#function)
102102

103103
//
104104
// retain cycle:
@@ -144,7 +144,7 @@ class RetainCycleTests: _TestCase
144144

145145
func testPlayer_completionAsStoredProperty_notConfigured()
146146
{
147-
let expect = self.expectationWithDescription(__FUNCTION__)
147+
let expect = self.expectationWithDescription(#function)
148148

149149
//
150150
// retain cycle:
@@ -186,7 +186,7 @@ class RetainCycleTests: _TestCase
186186

187187
func testPlayer_completionAsStoredProperty_configured()
188188
{
189-
let expect = self.expectationWithDescription(__FUNCTION__)
189+
let expect = self.expectationWithDescription(#function)
190190

191191
//
192192
// retain cycle:

0 commit comments

Comments
 (0)