Skip to content

Update for Swift 2.2 (Xcode 7.3) #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion SwiftTask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Yasuhiro Inami";
TargetAttributes = {
1F46DED3199EDF1000F97868 = {
Expand Down Expand Up @@ -502,6 +502,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -520,6 +521,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion SwiftTask/Cancellable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

public protocol Cancellable
{
typealias _Error
associatedtype _Error

//
// NOTE:
Expand Down
8 changes: 4 additions & 4 deletions SwiftTask/SwiftTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ extension Task
task.success { (value: Value) -> Void in

lock.lock()
completedCount++
completedCount += 1

let progressTuple = BulkProgress(completedCount: completedCount, totalCount: totalCount)
progress(progressTuple)
Expand Down Expand Up @@ -754,7 +754,7 @@ extension Task
task.success { (value: Value) -> Void in

lock.lock()
completedCount++
completedCount += 1

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

lock.lock()
rejectedCount++
rejectedCount += 1

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

lock.lock()
completedCount++
completedCount += 1

let progressTuple = BulkProgress(completedCount: completedCount, totalCount: totalCount)
progress(progressTuple)
Expand Down
4 changes: 2 additions & 2 deletions SwiftTask/_StateMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ internal struct _Handlers<T>: SequenceType

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

internal func generate() -> AnyGenerator<T>
{
return anyGenerator(self.elements.map { $0.value }.generate())
return AnyGenerator(self.elements.map { $0.value }.generate())
}
}
10 changes: 5 additions & 5 deletions SwiftTaskTests/AlamofireTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AlamofireTests: _TestCase

func testFulfill()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

Expand Down Expand Up @@ -46,7 +46,7 @@ class AlamofireTests: _TestCase

func testReject()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

Expand Down Expand Up @@ -86,7 +86,7 @@ class AlamofireTests: _TestCase

func testProgress()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

func testNSProgress()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)
let nsProgress = NSProgress(totalUnitCount: 100)

// define task
Expand Down Expand Up @@ -176,7 +176,7 @@ class AlamofireTests: _TestCase
//
func testCancel()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

Expand Down
2 changes: 1 addition & 1 deletion SwiftTaskTests/BasicTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BasicTests: _TestCase
{
typealias Task = SwiftTask.Task<Float, String, ErrorString>

let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

// define task
let task = Task { progress, fulfill, reject, configure in
Expand Down
10 changes: 5 additions & 5 deletions SwiftTaskTests/MultipleErrorTypesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MultipleErrorTypesTests: _TestCase

func testMultipleErrorTypes_then()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

func testMultipleErrorTypes_success()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

func testMultipleErrorTypes_success_differentErrorType()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

self._task1(ok: true)
.success { value -> Task2 in
Expand Down Expand Up @@ -151,7 +151,7 @@ class MultipleErrorTypesTests: _TestCase

func testMultipleErrorTypes_success_differentErrorType_conversion()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

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

func testMultipleErrorTypes_failure()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

self._task1(ok: false)
.failure { errorInfo -> Task<Dummy, String /* must be task1's value type to recover */, Dummy> in
Expand Down
4 changes: 2 additions & 2 deletions SwiftTaskTests/RemoveHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RemoveHandlerTests: _TestCase
{
typealias Task = SwiftTask.Task<Float, String, ErrorString>

let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

var latestProgressValue: Float?
var canceller: AutoCanceller? = nil
Expand Down Expand Up @@ -60,7 +60,7 @@ class RemoveHandlerTests: _TestCase
{
typealias Task = SwiftTask.Task<Float, String, ErrorString>

let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)
var canceller: AutoCanceller? = nil

// define task
Expand Down
8 changes: 4 additions & 4 deletions SwiftTaskTests/RetainCycleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RetainCycleTests: _TestCase

func testPlayer_completionAsArgument_notConfigured()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

//
// retain cycle:
Expand Down Expand Up @@ -98,7 +98,7 @@ class RetainCycleTests: _TestCase

func testPlayer_completionAsArgument_configured()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

//
// retain cycle:
Expand Down Expand Up @@ -144,7 +144,7 @@ class RetainCycleTests: _TestCase

func testPlayer_completionAsStoredProperty_notConfigured()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

//
// retain cycle:
Expand Down Expand Up @@ -186,7 +186,7 @@ class RetainCycleTests: _TestCase

func testPlayer_completionAsStoredProperty_configured()
{
let expect = self.expectationWithDescription(__FUNCTION__)
let expect = self.expectationWithDescription(#function)

//
// retain cycle:
Expand Down
Loading