Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/2.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
vmartinelli committed Jan 15, 2016
2 parents 75aa929 + d6a663b commit f2a0f54
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 21 deletions.
7 changes: 5 additions & 2 deletions AlecrimAsyncKit.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "AlecrimAsyncKit"
s.version = "2.0.1"
s.version = "2.0.2"
s.summary = "Bringing async and await to Swift world with some flavouring."
s.homepage = "https://github.com/Alecrim/AlecrimAsyncKit"

Expand All @@ -10,12 +10,15 @@ Pod::Spec.new do |s|
s.author = { "Vanderlei Martinelli" => "[email protected]" }
s.social_media_url = "https://twitter.com/vmartinelli"

s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.ios.deployment_target = "8.0"
s.watchos.deployment_target = "2.0"
s.tvos.deployment_target = "9.0"

s.source = { :git => "https://github.com/Alecrim/AlecrimAsyncKit.git", :tag => s.version }

s.source_files = "Source/**/*.swift"

s.requires_arc = true

end
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Vanderlei Martinelli <[email protected]>
Copyright (c) 2015, 2016 Vanderlei Martinelli <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ do {
// ...

// now we need the value
let value = await(task)
let value = try await(task)
print("The result is \(value)")
}
catch let error {
Expand Down
8 changes: 4 additions & 4 deletions Source/AlecrimAsyncKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator watchos watchsimulator";
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator";
SWIFT_INSTALL_OBJC_HEADER = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VALID_ARCHS = "x86_64 arm64 armv7 armv7s armv7k";
Expand Down Expand Up @@ -364,7 +364,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator watchos watchsimulator";
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator";
SWIFT_INSTALL_OBJC_HEADER = NO;
VALID_ARCHS = "x86_64 arm64 armv7 armv7s armv7k";
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -379,7 +379,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 167;
CURRENT_PROJECT_VERSION = 175;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -401,7 +401,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 167;
CURRENT_PROJECT_VERSION = 175;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down
4 changes: 1 addition & 3 deletions Source/AlecrimAsyncKit/AlecrimAsyncKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

#import <TargetConditionals.h>

#if TARGET_OS_WATCH
#import <WatchKit/WatchKit.h>
#elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR
#import <UIKit/UIKit.h>
#elif TARGET_OS_MAC
#import <Cocoa/Cocoa.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2015 Alecrim. All rights reserved.
//

#if !os(tvOS)

import Foundation
import EventKit

Expand Down Expand Up @@ -56,3 +58,5 @@ public final class EventStorePermissionTaskCondition: TaskCondition {
}

}

#endif
26 changes: 18 additions & 8 deletions Source/AlecrimAsyncKit/Core/Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,31 @@ public final class Task<V>: BaseTask<V>, InitializableTaskType, FailableTaskType
}

public override func cancel() {
//
if let cancellationHandler = self.cancellationHandler {
self.cancellationHandler = nil
cancellationHandler()
}

self.willAccessValue()
defer {
self.didAccessValue()
super.cancel()
self.finishOperation()

//
do {
self.willAccessValue()
defer {
self.didAccessValue()
}

guard self.value == nil && self.error == nil else { return }

self.error = NSError.userCancelledError()
}

guard self.value == nil && self.error == nil else { return }
//
let hasStarted = self.hasStarted
super.cancel()

self.error = NSError.userCancelledError()
if hasStarted {
self.finishOperation()
}
}

// MARK: -
Expand Down
2 changes: 1 addition & 1 deletion Source/AlecrimAsyncKit/Core/TaskOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public class TaskOperation: NSOperation, TaskType {

// MARK : -

private var hasStarted = false
internal private(set) var hasStarted = false
public override final func start() {
self.hasStarted = true

Expand Down
2 changes: 1 addition & 1 deletion Source/AlecrimAsyncKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.1</string>
<string>2.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit f2a0f54

Please sign in to comment.