Compare commits

...

2 Commits

Author SHA1 Message Date
Max Howell
f0a719af1f Travis fixes 2016-07-26 20:08:36 -07:00
Max Howell
2074d1f931 The minimal changes to 2.x to work with Swift 2.0 2015-08-16 19:06:04 -07:00
66 changed files with 625 additions and 512 deletions

View File

@ -1,20 +1,24 @@
language: objective-c
xcode_project: PromiseKit.xcodeproj
before_install:
- brew update
- brew install carthage
install: carthage bootstrap --verbose
xcode_scheme: [PMKiOS, PMKOSX]
xcode_sdk: [iphonesimulator8.3, macosx10.10]
osx_image: beta-xcode6.3
xcode_scheme: PMKOSX
xcode_sdk: macosx10.11
osx_image: xcode7.2
install:
- gem install travis-xcodebuild
- carthage bootstrap --platform Mac
script:
- travis-xcodebuild
matrix:
exclude:
- xcode_scheme: PMKOSX
xcode_sdk: iphonesimulator8.3
- xcode_scheme: PMKiOS
xcode_sdk: macosx10.10
xcode_sdk: iphonesimulator9.2
branches:
only:
- master
- swift-2.2-minimal-changes
- swift-2.0-minimal-changes
- legacy-1.x

View File

@ -1,3 +1,3 @@
github "AliSoftware/OHHTTPStubs"
github "mxcl/Stubbilino"
github "kif-framework/KIF"
github "AliSoftware/OHHTTPStubs" == 5.1.0
github "robb/Stubbilino" == 0.2.1
github "kif-framework/KIF" == 3.4.2

View File

@ -1,6 +1,8 @@
import AVFoundation.AVAudioSession
import Foundation
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `AVAudioSession` category:
@ -10,7 +12,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension AVAudioSession {
public func requestRecordPermission() -> Promise<Bool> {

View File

@ -1,5 +1,7 @@
import Accounts
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `ACAccountStore` category:
@ -9,7 +11,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension ACAccountStore {
public func renewCredentialsForAccount(account: ACAccount) -> Promise<ACAccountCredentialRenewResult> {
@ -32,10 +36,10 @@ extension ACAccountStore {
}
public func saveAccount(account: ACAccount) -> Promise<Void> {
return Promise<Bool> { saveAccount(account, withCompletionHandler: $0.resolve) }.asVoid()
return Promise { saveAccount(account, withCompletionHandler: $0.resolve) }.asVoid()
}
public func removeAccount(account: ACAccount) -> Promise<Void> {
return Promise<Bool> { removeAccount(account, withCompletionHandler: $0.resolve) }.asVoid()
return Promise { removeAccount(account, withCompletionHandler: $0.resolve) }.asVoid()
}
}

View File

@ -1,7 +1,9 @@
import AddressBook
import CoreFoundation
import Foundation.NSError
#if !COCOAPODS
import PromiseKit
#endif
/**
Requests access to the address book.
@ -13,7 +15,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
@return A promise that fulfills with the ABAuthorizationStatus.
*/
@ -32,7 +36,9 @@ public func ABAddressBookRequestAccess() -> Promise<ABAuthorizationStatus> {
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
@return A promise that fulfills with the ABAddressBook instance if access was granted.
*/

View File

@ -1,6 +1,8 @@
import AssetsLibrary
import Foundation.NSData
#if !COCOAPODS
import PromiseKit
#endif
import UIKit.UIViewController
/**
@ -11,7 +13,9 @@ import UIKit.UIViewController
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIViewController {
/**

View File

@ -1,5 +1,7 @@
import CloudKit
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `CKContainer` category:
@ -25,14 +27,14 @@ extension CKContainer {
}
public func discoverAllContactUserInfos() -> Promise<[CKDiscoveredUserInfo]> {
return Promise<[AnyObject]> { self.discoverAllContactUserInfosWithCompletionHandler($0.resolve) }.then(on: zalgo) { $0 as! [CKDiscoveredUserInfo] }
return Promise<[CKDiscoveredUserInfo]> { self.discoverAllContactUserInfosWithCompletionHandler($0.resolve) }
}
public func discoverUserInfo(# email: String) -> Promise<CKDiscoveredUserInfo> {
public func discoverUserInfo(email email: String) -> Promise<CKDiscoveredUserInfo> {
return Promise { discoverUserInfoWithEmailAddress(email, completionHandler: $0.resolve) }
}
public func discoverUserInfo(# recordID: CKRecordID) -> Promise<CKDiscoveredUserInfo> {
public func discoverUserInfo(recordID recordID: CKRecordID) -> Promise<CKDiscoveredUserInfo> {
return Promise { discoverUserInfoWithUserRecordID(recordID, completionHandler: $0.resolve) }
}

View File

@ -1,5 +1,7 @@
import CloudKit.CKDatabase
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `CKDatabase` category:
@ -25,11 +27,11 @@ extension CKDatabase {
}
public func fetchAllRecordZones() -> Promise<[CKRecordZone]> {
return Promise<[AnyObject]> { fetchAllRecordZonesWithCompletionHandler($0.resolve) }.then(on: zalgo) { $0 as! [CKRecordZone] }
return Promise { fetchAllRecordZonesWithCompletionHandler($0.resolve) }
}
public func fetchAllSubscriptions() -> Promise<[CKSubscription]> {
return Promise<[AnyObject]> { fetchAllSubscriptionsWithCompletionHandler($0.resolve) }.then(on: zalgo) { $0 as! [CKSubscription] }
return Promise { fetchAllSubscriptionsWithCompletionHandler($0.resolve) }
}
public func save(record: CKRecord) -> Promise<CKRecord> {
@ -57,13 +59,13 @@ extension CKDatabase {
}
public func performQuery(query: CKQuery, inZoneWithID zoneID: CKRecordZoneID? = nil) -> Promise<[CKRecord]> {
return Promise<[AnyObject]> { performQuery(query, inZoneWithID: zoneID, completionHandler: $0.resolve) }.then(on: zalgo) { $0 as! [CKRecord] }
return Promise { performQuery(query, inZoneWithID: zoneID, completionHandler: $0.resolve) }
}
public func performQuery(query: CKQuery, inZoneWithID zoneID: CKRecordZoneID? = nil) -> Promise<CKRecord?> {
return Promise { sealant in
performQuery(query, inZoneWithID: zoneID) { records, error in
sealant.resolve((records as? [CKRecord])?.first, error)
sealant.resolve(records?.first, error)
}
}
}

View File

@ -1,5 +1,7 @@
import CoreLocation.CLGeocoder
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `CLGeocoder` category:
@ -9,13 +11,15 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension CLGeocoder {
public func reverseGeocodeLocation(location: CLLocation) -> Promise<CLPlacemark> {
return CLPromise { sealant in
reverseGeocodeLocation(location) { placemarks, error in
sealant.resolve((placemarks as? [CLPlacemark])?.first, error)
sealant.resolve(placemarks?.first, error)
}
}
}
@ -23,7 +27,7 @@ extension CLGeocoder {
public func geocode(addressDictionary: [String: String]) -> Promise<CLPlacemark> {
return CLPromise { sealant in
geocodeAddressDictionary(addressDictionary) { placemarks, error in
sealant.resolve((placemarks as? [CLPlacemark])?.first, error)
sealant.resolve(placemarks?.first, error)
}
}
}
@ -31,7 +35,7 @@ extension CLGeocoder {
public func geocode(addressString: String) -> Promise<CLPlacemark> {
return CLPromise { sealant in
geocodeAddressString(addressString) { placemarks, error in
sealant.resolve((placemarks as? [CLPlacemark])?.first, error)
sealant.resolve(placemarks?.first, error)
}
}
}
@ -39,7 +43,7 @@ extension CLGeocoder {
public func geocode(addressString: String, region: CLRegion?) -> Promise<[CLPlacemark]> {
return CLPromise { sealant in
geocodeAddressString(addressString, inRegion: region) { placemarks, error in
sealant.resolve((placemarks as? [CLPlacemark]), error)
sealant.resolve(placemarks, error)
}
}
}

View File

@ -1,5 +1,7 @@
import CoreLocation.CLLocationManager
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `CLLocationManager` category:
@ -9,7 +11,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension CLLocationManager {
@ -27,7 +31,7 @@ extension CLLocationManager {
want to force one or the other, change this parameter from its default
value.
*/
public class func promise(requestAuthorizationType: RequestAuthorizationType = .Automatic) -> Promise<CLLocation> {
public class func promise(requestAuthorizationType requestAuthorizationType: RequestAuthorizationType = .Automatic) -> Promise<CLLocation> {
return promise(requestAuthorizationType: requestAuthorizationType).then(on: zalgo) {
(locations: [CLLocation]) -> CLLocation in
return locations.last!
@ -37,11 +41,11 @@ extension CLLocationManager {
/**
@return A new promise that fulfills with the first batch of location objects a CLLocationManager instance provides.
*/
public class func promise(requestAuthorizationType: RequestAuthorizationType = .Automatic) -> Promise<[CLLocation]> {
public class func promise(requestAuthorizationType requestAuthorizationType: RequestAuthorizationType = .Automatic) -> Promise<[CLLocation]> {
return promise(yield: auther(requestAuthorizationType))
}
private class func promise(yield: (CLLocationManager) -> Void = { _ in }) -> Promise<[CLLocation]> {
private class func promise(yield yield: (CLLocationManager) -> Void = { _ in }) -> Promise<[CLLocation]> {
let manager = LocationManager()
manager.delegate = manager
yield(manager)
@ -71,20 +75,26 @@ extension CLLocationManager {
private class LocationManager: CLLocationManager, CLLocationManagerDelegate {
let (promise, fulfill, reject) = Promise<[CLLocation]>.defer()
let (promise, fulfill, reject) = Promise<[CLLocation]>.defer_()
@objc func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
#if os(iOS)
@objc func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
fulfill(locations)
}
#else
@objc func locationManager(manager: CLLocationManager, didUpdateLocations locations: [AnyObject]) {
fulfill(locations as! [CLLocation])
}
#endif
@objc func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
@objc func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
reject(error)
}
}
#if os(iOS)
private class AuthorizationCatcher: CLLocationManager, CLLocationManagerDelegate {
let (promise, fulfill, _) = Promise<CLAuthorizationStatus>.defer()
let (promise, fulfill, _) = Promise<CLAuthorizationStatus>.defer_()
var retainCycle: AnyObject?
init(auther: (CLLocationManager)->()) {
@ -99,7 +109,7 @@ private class AuthorizationCatcher: CLLocationManager, CLLocationManagerDelegate
}
}
@objc private func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
@objc private func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
if status != .NotDetermined {
fulfill(status)
retainCycle = nil

View File

@ -1,5 +1,7 @@
import Foundation.NSFileManager
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `NSFileManager` category:
@ -14,38 +16,52 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension NSFileManager {
func removeItemAtPath(path: String) -> Promise<String> {
func removeItem(path path: String) -> Promise<String> {
return dispatch_promise() {
var error: NSError?
self.removeItemAtPath(path, error:&error)
return (path, error)
do {
try self.removeItemAtPath(path)
return (path, nil)
} catch {
return (nil, error as NSError)
}
}
}
func copyItem(# from: String, to: String) -> Promise<String> {
func copyItem(from from: String, to: String) -> Promise<String> {
return dispatch_promise() {
var error: NSError?
self.copyItemAtPath(from, toPath:to, error:&error)
return (to, error)
do {
try self.copyItemAtPath(from, toPath:to)
return (to, nil)
} catch {
return (nil, error as NSError)
}
}
}
func moveItem(# from: String, to: String) -> Promise<String> {
func moveItem(from from: String, to: String) -> Promise<String> {
return dispatch_promise() {
var error: NSError?
self.moveItemAtPath(from, toPath: to, error: &error)
return (to, error)
do {
try self.moveItemAtPath(from, toPath: to)
return (to, nil)
} catch {
return (nil, error as NSError)
}
}
}
func createDirectoryAtPath(path: String, withIntermediateDirectories with: Bool = true, attributes: [NSObject : AnyObject]? = nil) -> Promise<String> {
func createDirectory(path path: String, withIntermediateDirectories with: Bool = true, attributes: [String : AnyObject]? = nil) -> Promise<String> {
return dispatch_promise() {
var error: NSError?
self.createDirectoryAtPath(path, withIntermediateDirectories: with, attributes: attributes, error: &error)
return (path, error)
do {
try self.createDirectoryAtPath(path, withIntermediateDirectories: with, attributes: attributes)
return (path, nil)
} catch {
return (nil, error as NSError)
}
}
}
}

View File

@ -1,5 +1,7 @@
import Foundation.NSNotification
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `NSNotificationCenter` category:
@ -14,7 +16,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension NSNotificationCenter {
public class func once(name: String) -> Promise<[NSObject: AnyObject]> {

View File

@ -1,5 +1,7 @@
import Foundation
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `NSObject` category:
@ -14,7 +16,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension NSObject {
/**
@ -25,8 +29,8 @@ extension NSObject {
@see Apples KVO documentation.
*/
public func observe<T>(keyPath: String) -> Promise<T> {
let (promise, fulfill, reject) = Promise<T>.defer()
KVOProxy(observee: self, keyPath: keyPath) { obj in
let (promise, fulfill, reject) = Promise<T>.defer_()
let proxy = KVOProxy(observee: self, keyPath: keyPath) { obj in
if let obj = obj as? T {
fulfill(obj)
} else {
@ -34,6 +38,7 @@ extension NSObject {
reject(NSError(domain: PMKErrorDomain, code: PMKInvalidUsageError, userInfo: info))
}
}
proxy.retainCycle = proxy
return promise
}
}
@ -45,19 +50,18 @@ private class KVOProxy: NSObject {
init(observee: NSObject, keyPath: String, resolve: (AnyObject?) -> Void) {
fulfill = resolve
super.init()
retainCycle = self
observee.addObserver(self, forKeyPath: keyPath, options: NSKeyValueObservingOptions.New, context: pointer)
}
override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
private override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
if context == pointer {
fulfill(change[NSKeyValueChangeNewKey])
object.removeObserver(self, forKeyPath: keyPath)
fulfill(change?[NSKeyValueChangeNewKey])
object?.removeObserver(self, forKeyPath: keyPath!)
retainCycle = nil
}
}
private lazy var pointer: UnsafeMutablePointer<KVOProxy> = {
return UnsafeMutablePointer<KVOProxy>(Unmanaged<KVOProxy>.passUnretained(self).toOpaque())
private lazy var pointer: UnsafeMutablePointer<Void> = {
return UnsafeMutablePointer<Void>(Unmanaged<KVOProxy>.passUnretained(self).toOpaque())
}()
}

View File

@ -1,5 +1,7 @@
import Foundation
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `NSTask` category:
@ -14,7 +16,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension NSTask {
/**
@ -62,13 +66,14 @@ extension NSTask {
dispatch_async(dispatch_get_global_queue(0, 0)) {
self.waitUntilExit()
let stdout = self.standardOutput.fileHandleForReading.readDataToEndOfFile()
let stderr = self.standardError.fileHandleForReading.readDataToEndOfFile()
let stdout = self.standardOutput!.fileHandleForReading.readDataToEndOfFile()
let stderr = self.standardError!.fileHandleForReading.readDataToEndOfFile()
if self.terminationReason == .Exit && self.terminationStatus == 0 {
fulfill(stdout, stderr, Int(self.terminationStatus))
let a = Int(self.terminationStatus)
fulfill(stdout, stderr, a)
} else {
let cmd = " ".join([self.launchPath] + (self.arguments as! [String]))
let cmd = ([self.launchPath!] + (self.arguments ?? [])).joinWithSeparator(" ")
reject(generateError("Failed executing: `\(cmd)`.", stdout, stderr, self))
}
}
@ -94,14 +99,14 @@ extension NSTask {
//TODO get file system encoding from LANG as it may not be UTF8
private func generateError(description: String, stdout: NSData, stderr: NSData, task: NSTask) -> NSError {
let info: [NSObject: AnyObject] = [
NSLocalizedDescriptionKey: description,
PMKTaskErrorLaunchPathKey: task.launchPath,
PMKTaskErrorArgumentsKey: task.arguments,
PMKTaskErrorStandardOutputKey: stdout,
PMKTaskErrorStandardErrorKey: stderr,
PMKTaskErrorExitStatusKey: Int(task.terminationStatus),
]
private func generateError(description: String, _ stdout: NSData, _ stderr: NSData, _ task: NSTask) -> NSError {
var info = [NSObject: AnyObject]()
info[NSLocalizedDescriptionKey] = description
info[PMKTaskErrorLaunchPathKey] = task.launchPath
info[PMKTaskErrorArgumentsKey] = task.arguments
info[PMKTaskErrorStandardOutputKey] = stdout
info[PMKTaskErrorStandardErrorKey] = stderr
info[PMKTaskErrorExitStatusKey] = Int(task.terminationStatus)
return NSError(domain: PMKErrorDomain, code: PMKTaskError, userInfo: info)
}

View File

@ -1,5 +1,7 @@
import Foundation
#if !COCOAPODS
import PromiseKit
#endif
import OMGHTTPURLRQ
/**
@ -15,7 +17,9 @@ import OMGHTTPURLRQ
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension NSURLConnection {
public class func GET(url: String) -> Promise<NSData> {
@ -147,14 +151,11 @@ extension NSURLConnection {
public class func promise(rq: NSURLRequest) -> Promise<UIImage> {
return fetch(rq).then(on: waldo) { data, _ in
if let img = UIImage(data: data) {
if let img = UIImage(CGImage:img.CGImage, scale:img.scale, orientation:img.imageOrientation) {
return Promise(img)
}
guard let img = UIImage(data: data), cgimg = img.CGImage else {
let info = [NSLocalizedDescriptionKey: "The server returned invalid image data"]
return Promise(NSError(domain: NSURLErrorDomain, code: NSURLErrorBadServerResponse, userInfo: info))
}
let info = [NSLocalizedDescriptionKey: "The server returned invalid image data"]
return Promise(NSError(domain: NSURLErrorDomain, code: NSURLErrorBadServerResponse, userInfo: info))
return Promise(UIImage(CGImage: cgimg, scale: img.scale, orientation: img.imageOrientation))
}
}
}
@ -192,21 +193,21 @@ private func fetch(var request: NSURLRequest) -> Promise<(NSData, NSURLResponse)
info[NSURLErrorFailingURLErrorKey] = request.URL
info[NSURLErrorFailingURLStringErrorKey] = request.URL?.absoluteString
info[PMKURLErrorFailingDataKey] = data
if data != nil {
if let data = data {
info[PMKURLErrorFailingStringKey] = NSString(data: data, encoding: rsp?.stringEncoding ?? NSUTF8StringEncoding)
}
info[PMKURLErrorFailingURLResponseKey] = rsp
prereject(NSError(domain: error.domain, code: error.code, userInfo: info))
}
if err != nil {
if let err = err {
reject(err)
} else if let response = rsp as? NSHTTPURLResponse where response.statusCode < 200 || response.statusCode >= 300 {
reject(NSError(domain: NSURLErrorDomain, code: NSURLErrorBadServerResponse, userInfo: [
NSLocalizedDescriptionKey: "The server returned a bad HTTP response code"
]))
} else {
fulfill(data, rsp)
fulfill(data!, rsp!)
}
}
}

View File

@ -1,5 +1,7 @@
import Foundation
#if !COCOAPODS
import PromiseKit
#endif
/**
@return A promise that resolves when the provided object deallocates
@ -12,7 +14,7 @@ public func after(life object: NSObject) -> Promise<Void> {
var reaper = objc_getAssociatedObject(object, &handle) as? GrimReaper
if reaper == nil {
reaper = GrimReaper()
objc_setAssociatedObject(object, &handle, reaper, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN_NONATOMIC))
objc_setAssociatedObject(object, &handle, reaper, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
return reaper!.promise
}
@ -23,5 +25,5 @@ private class GrimReaper: NSObject {
deinit {
fulfill()
}
let (promise, fulfill, _) = Promise<Void>.defer()
let (promise, fulfill, _) = Promise<Void>.defer_()
}

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import MapKit
/**
@ -9,7 +11,9 @@ import MapKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension MKDirections {
/**

View File

@ -1,5 +1,7 @@
import MapKit
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `MKMapSnapshotter` category:
@ -9,7 +11,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension MKMapSnapshotter {
/**

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import MessageUI.MFMailComposeViewController
import UIKit.UIViewController
@ -10,7 +12,9 @@ import UIKit.UIViewController
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIViewController {
public func promiseViewController(vc: MFMailComposeViewController, animated: Bool = true, completion:(() -> Void)? = nil) -> Promise<MFMailComposeResult> {
@ -27,20 +31,20 @@ extension UIViewController {
private class PMKMailComposeViewControllerDelegate: NSObject, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate {
let (promise, fulfill, reject) = Promise<MFMailComposeResult>.defer()
let (promise, fulfill, reject) = Promise<MFMailComposeResult>.defer_()
var retainCycle: NSObject?
@objc func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!) {
if error != nil {
@objc func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
if let error = error {
reject(error)
} else {
switch result.value {
case MFMailComposeResultFailed.value:
switch result.rawValue {
case MFMailComposeResultFailed.rawValue:
var info = [NSObject: AnyObject]()
info[NSLocalizedDescriptionKey] = "The attempt to save or send the message was unsuccessful."
info[NSUnderlyingErrorKey] = NSNumber(unsignedInt: result.value)
info[NSUnderlyingErrorKey] = NSNumber(unsignedInt: result.rawValue)
reject(NSError(domain: PMKErrorDomain, code: PMKOperationFailed, userInfo: info))
case MFMailComposeResultCancelled.value:
case MFMailComposeResultCancelled.rawValue:
reject(NSError.cancelledError())
default:
fulfill(result)

View File

@ -1,6 +1,8 @@
import Foundation
import MessageUI.MFMessageComposeViewController
#if !COCOAPODS
import PromiseKit
#endif
import UIKit.UIViewController
/**
@ -11,7 +13,9 @@ import UIKit.UIViewController
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIViewController {
public func promiseViewController(vc: MFMessageComposeViewController, animated: Bool = true, completion:(() -> Void)? = nil) -> Promise<Void> {
@ -28,20 +32,20 @@ extension UIViewController {
private class PMKMessageComposeViewControllerDelegate: NSObject, MFMessageComposeViewControllerDelegate, UINavigationControllerDelegate {
let (promise, fulfill, reject) = Promise<Void>.defer()
let (promise, fulfill, reject) = Promise<Void>.defer_()
var retainCycle: NSObject?
@objc func messageComposeViewController(controller: MFMessageComposeViewController!, didFinishWithResult result: MessageComposeResult) {
@objc func messageComposeViewController(controller: MFMessageComposeViewController, didFinishWithResult result: MessageComposeResult) {
switch result.value {
case MessageComposeResultSent.value:
switch result.rawValue {
case MessageComposeResultSent.rawValue:
fulfill()
case MessageComposeResultFailed.value:
case MessageComposeResultFailed.rawValue:
var info = [NSObject: AnyObject]()
info[NSLocalizedDescriptionKey] = "The attempt to save or send the message was unsuccessful."
info[NSUnderlyingErrorKey] = NSNumber(unsignedInt: result.value)
info[NSUnderlyingErrorKey] = NSNumber(unsignedInt: result.rawValue)
reject(NSError(domain: PMKErrorDomain, code: PMKOperationFailed, userInfo: info))
case MessageComposeResultCancelled.value:
case MessageComposeResultCancelled.rawValue:
reject(NSError.cancelledError())
default:
fatalError("Swift Sucks")

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import Photos.PHPhotoLibrary
/**
@ -9,7 +11,9 @@ import Photos.PHPhotoLibrary
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension PHPhotoLibrary {
public class func requestAuthorization() -> Promise<PHAuthorizationStatus> {

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import Social.SLComposeViewController
import UIKit.UIViewController
@ -10,7 +12,9 @@ import UIKit.UIViewController
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIViewController {
public func promiseViewController(vc: SLComposeViewController, animated: Bool = true, completion: (() -> Void)? = nil) -> Promise<Void> {

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import Social
/**
@ -9,7 +11,9 @@ import Social
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension SLRequest {
public func promise() -> Promise<NSData> {

View File

@ -1,5 +1,7 @@
import StoreKit
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `SKRequest` category:
@ -9,7 +11,9 @@ import PromiseKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension SKRequest {
public func promise() -> Promise<SKProductsResponse> {
@ -23,15 +27,22 @@ extension SKRequest {
private class SKDelegate: NSObject, SKProductsRequestDelegate {
let (promise, fulfill, reject) = Promise<SKProductsResponse>.defer()
let (promise, fulfill, reject) = Promise<SKProductsResponse>.defer_()
var retainCycle: SKDelegate?
@objc func request(request: SKRequest!, didFailWithError error: NSError!) {
#if os(iOS)
@objc func request(request: SKRequest, didFailWithError error: NSError) {
reject(error)
retainCycle = nil
}
#else
@objc func request(request: SKRequest, didFailWithError error: NSError?) {
reject(error!)
retainCycle = nil
}
#endif
@objc func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {
@objc func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) {
fulfill(response)
retainCycle = nil
}

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import UIKit.UIActionSheet
/**
@ -14,7 +16,9 @@ import UIKit.UIActionSheet
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIActionSheet {
public func promiseInView(view: UIView) -> Promise<Int> {
@ -32,7 +36,7 @@ extension UIActionSheet {
}
private class PMKActionSheetDelegate: NSObject, UIActionSheetDelegate {
let (promise, fulfill, reject) = Promise<Int>.defer()
let (promise, fulfill, reject) = Promise<Int>.defer_()
var retainCycle: NSObject?
@objc func actionSheet(actionSheet: UIActionSheet, didDismissWithButtonIndex buttonIndex: Int) {

View File

@ -1,5 +1,7 @@
import Foundation
#if !COCOAPODS
import PromiseKit
#endif
import UIKit.UIAlertView
/**
@ -15,7 +17,9 @@ import UIKit.UIAlertView
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIAlertView {
public func promise() -> Promise<Int> {
@ -33,7 +37,7 @@ extension UIAlertView {
}
private class PMKAlertViewDelegate: NSObject, UIAlertViewDelegate {
let (promise, fulfill, reject) = Promise<Int>.defer()
let (promise, fulfill, reject) = Promise<Int>.defer_()
var retainCycle: NSObject?
@objc func alertView(alertView: UIAlertView, didDismissWithButtonIndex buttonIndex: Int) {

View File

@ -1,4 +1,6 @@
#if !COCOAPODS
import PromiseKit
#endif
import UIKit.UIView
/**
@ -14,7 +16,9 @@ import UIKit.UIView
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIView {
/**

View File

@ -1,5 +1,7 @@
import Foundation.NSError
#if !COCOAPODS
import PromiseKit
#endif
import UIKit
/**
@ -15,7 +17,9 @@ import UIKit
And then in your sources:
import PromiseKit
#if !COCOAPODS
import PromiseKit
#endif
*/
extension UIViewController {
public func promiseViewController<T>(vc: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil) -> Promise<T> {
@ -32,7 +36,7 @@ extension UIViewController {
}
public func promiseViewController<T>(nc: UINavigationController, animated: Bool = true, completion:(()->Void)? = nil) -> Promise<T> {
if let vc = nc.viewControllers.first as? UIViewController {
if let vc = nc.viewControllers.first {
let p: Promise<T> = promise(vc)
if p.pending {
presentViewController(nc, animated: animated, completion: completion)
@ -82,7 +86,7 @@ private func promise<T>(vc: UIViewController) -> Promise<T> {
return Promise(error: "The provided UIViewController does not conform to the Promisable protocol.", code: PMKInvalidUsageError)
} else if let promise = vc.valueForKeyPath("promise") as? Promise<T> {
return promise
} else if let promise: AnyObject = vc.valueForKeyPath("promise") {
} else if let _: AnyObject = vc.valueForKeyPath("promise") {
return Promise(error: "The provided UIViewControllers promise has unexpected type specialization.", code: PMKInvalidUsageError)
} else {
return Promise(error: "The provided UIViewControllers promise property returned nil", code: PMKInvalidUsageError)
@ -92,7 +96,7 @@ private func promise<T>(vc: UIViewController) -> Promise<T> {
// internal scope because used by ALAssetsLibrary extension
@objc class UIImagePickerControllerProxy: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
let (promise, fulfill, reject) = Promise<[NSObject : AnyObject]>.defer()
let (promise, fulfill, reject) = Promise<[NSObject : AnyObject]>.defer_()
var retainCycle: AnyObject?
required override init() {
@ -100,7 +104,7 @@ private func promise<T>(vc: UIViewController) -> Promise<T> {
retainCycle = self
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
fulfill(info)
retainCycle = nil
}

View File

@ -78,33 +78,48 @@
6302AD401AEF55A4001F0069 /* Promise.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6302AD3F1AEF55A4001F0069 /* Promise.test.swift */; };
6306C6BB1AF6CA8500392D37 /* NSObject+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6306C6BA1AF6CA8500392D37 /* NSObject+Promise.swift */; };
6306C6BC1AF6CA8500392D37 /* NSObject+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6306C6BA1AF6CA8500392D37 /* NSObject+Promise.swift */; };
63075EBE1AD0EDB3002C46A0 /* after.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EBD1AD0EDB3002C46A0 /* after.swift */; };
63075EBF1AD0EDB3002C46A0 /* after.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EBD1AD0EDB3002C46A0 /* after.swift */; };
63075EC11AD0F097002C46A0 /* when.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EC01AD0F097002C46A0 /* when.swift */; };
63075EC21AD0F097002C46A0 /* when.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EC01AD0F097002C46A0 /* when.swift */; };
63075EC51AD10471002C46A0 /* race.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EC41AD10471002C46A0 /* race.swift */; };
63075EC61AD10471002C46A0 /* race.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EC41AD10471002C46A0 /* race.swift */; };
630F25F91AF17A8F00BE27FD /* PMKPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 630F25F81AF17A8F00BE27FD /* PMKPromise.m */; };
630F25FA1AF17BFE00BE27FD /* PMKPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 630F25F81AF17A8F00BE27FD /* PMKPromise.m */; };
63196ABF1AFD8EE300555BCD /* Promise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63196ABE1AFD8B7100555BCD /* Promise.h */; settings = {ATTRIBUTES = (Public, ); }; };
63196AC01AFD8EF600555BCD /* Promise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63196ABE1AFD8B7100555BCD /* Promise.h */; settings = {ATTRIBUTES = (Public, ); }; };
63196AC11AFD8F1300555BCD /* AnyPromise+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 63314AE01AEDDD0B0071B6F5 /* AnyPromise+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
63196AC21AFD8F1600555BCD /* AnyPromise+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 63314AE01AEDDD0B0071B6F5 /* AnyPromise+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
63196AC51AFD936300555BCD /* dispatch_promise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63196AC31AFD936300555BCD /* dispatch_promise.m */; };
63196AC61AFD936300555BCD /* dispatch_promise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63196AC31AFD936300555BCD /* dispatch_promise.m */; };
63196AC71AFD936300555BCD /* dispatch_promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63196AC41AFD936300555BCD /* dispatch_promise.swift */; };
63196AC81AFD936300555BCD /* dispatch_promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63196AC41AFD936300555BCD /* dispatch_promise.swift */; };
63196AC91AFD9F6E00555BCD /* after.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A60E1F1AFD795B00C4E692 /* after.m */; };
631A51BC1B29E7E90018606D /* bridging.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631A51BB1B29E7E90018606D /* bridging.test.swift */; };
631FEA7F1AF28E4900ED9646 /* PMKPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 631FEA7E1AF28E4900ED9646 /* PMKPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
631FEA801AF28E4900ED9646 /* PMKPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 631FEA7E1AF28E4900ED9646 /* PMKPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
63314ADA1AEDDC070071B6F5 /* hang.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD71AEDDC070071B6F5 /* hang.m */; };
6326651C1D482D3E0018F06F /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63F803BF1AB87A9500E4DEE1 /* Promise.swift */; };
6326651D1D482D3E0018F06F /* Promise+Properties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639A12701AB9F941002E5C24 /* Promise+Properties.swift */; };
6326651E1D482D3E0018F06F /* ErrorUnhandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D0D7A1ADDB11400CC0406 /* ErrorUnhandler.swift */; };
6326651F1D482D3E0018F06F /* Sealant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B6FE481ABB613500E1F4C2 /* Sealant.swift */; };
632665201D482D3E0018F06F /* State.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63BF9DCF1AB9E4850049EA39 /* State.swift */; };
632665211D482D3E0018F06F /* AnyPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63A1576A1ABB32EB0002A421 /* AnyPromise.swift */; };
632665221D482D3E0018F06F /* AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A157711ABB59D00002A421 /* AnyPromise.m */; };
632665231D482D3E0018F06F /* after.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A60E1F1AFD795B00C4E692 /* after.m */; };
632665241D482D3E0018F06F /* after.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EBD1AD0EDB3002C46A0 /* after.swift */; };
632665251D482D3E0018F06F /* dispatch_promise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63196AC31AFD936300555BCD /* dispatch_promise.m */; };
632665261D482D3E0018F06F /* dispatch_promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63196AC41AFD936300555BCD /* dispatch_promise.swift */; };
632665271D482D3E0018F06F /* hang.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD71AEDDC070071B6F5 /* hang.m */; };
632665281D482D3E0018F06F /* join.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD81AEDDC070071B6F5 /* join.m */; };
632665291D482D3E0018F06F /* race.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EC41AD10471002C46A0 /* race.swift */; };
6326652A1D482D3E0018F06F /* when.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD91AEDDC070071B6F5 /* when.m */; };
6326652B1D482D3E0018F06F /* when.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63075EC01AD0F097002C46A0 /* when.swift */; };
6326652C1D482D3E0018F06F /* PMKPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 630F25F81AF17A8F00BE27FD /* PMKPromise.m */; };
6326652D1D482D3E0018F06F /* NSJSONFromData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B4F8AF1AD19EDB0036A41A /* NSJSONFromData.swift */; };
6326652E1D482D540018F06F /* AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63D953C71AEDA3B1004981FF /* AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
6326652F1D482D540018F06F /* PromiseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 63A157701ABB59490002A421 /* PromiseKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
632665301D482D540018F06F /* Umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 63F803A81AB87A8200E4DEE1 /* Umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
632665311D482D540018F06F /* NSError+Cancellation.h in Headers */ = {isa = PBXBuildFile; fileRef = 633810641B02EC7A00CCD263 /* NSError+Cancellation.h */; settings = {ATTRIBUTES = (Public, ); }; };
632665321D482D540018F06F /* Promise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63196ABE1AFD8B7100555BCD /* Promise.h */; settings = {ATTRIBUTES = (Public, ); }; };
632665331D482D540018F06F /* PMKPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 631FEA7E1AF28E4900ED9646 /* PMKPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
632665341D482D540018F06F /* AnyPromise+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 63314AE01AEDDD0B0071B6F5 /* AnyPromise+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
63314ADB1AEDDC070071B6F5 /* hang.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD71AEDDC070071B6F5 /* hang.m */; };
63314ADC1AEDDC070071B6F5 /* join.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD81AEDDC070071B6F5 /* join.m */; };
63314ADD1AEDDC070071B6F5 /* join.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD81AEDDC070071B6F5 /* join.m */; };
63314ADE1AEDDC070071B6F5 /* when.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD91AEDDC070071B6F5 /* when.m */; };
63314ADF1AEDDC070071B6F5 /* when.m in Sources */ = {isa = PBXBuildFile; fileRef = 63314AD91AEDDC070071B6F5 /* when.m */; };
633810651B02EC7A00CCD263 /* NSError+Cancellation.h in Headers */ = {isa = PBXBuildFile; fileRef = 633810641B02EC7A00CCD263 /* NSError+Cancellation.h */; settings = {ATTRIBUTES = (Public, ); }; };
63348F4E1D4802CB000E8B52 /* KIF.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 635421DF1B38C53E00401F9B /* KIF.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
63348F4F1D4802D4000E8B52 /* OMGHTTPURLRQ.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63CA14C71AEA9E7400223904 /* OMGHTTPURLRQ.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
63348F501D4802DE000E8B52 /* OHHTTPStubs.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63CA14C61AEA9E7400223904 /* OHHTTPStubs.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
633810661B02EC7A00CCD263 /* NSError+Cancellation.h in Headers */ = {isa = PBXBuildFile; fileRef = 633810641B02EC7A00CCD263 /* NSError+Cancellation.h */; settings = {ATTRIBUTES = (Public, ); }; };
634E98AA1AF916AA00094594 /* Stubbilino.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 634E98A91AF916AA00094594 /* Stubbilino.framework */; };
634E98AE1AF916BD00094594 /* Stubbilino.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 634E98AC1AF916BD00094594 /* Stubbilino.framework */; };
@ -115,14 +130,11 @@
635421E01B38C53E00401F9B /* KIF.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 635421DF1B38C53E00401F9B /* KIF.framework */; };
635D0D731ADD7CE700CC0406 /* PMKPromise.test.m in Sources */ = {isa = PBXBuildFile; fileRef = 635D0D711ADD7CAE00CC0406 /* PMKPromise.test.m */; };
635D0D761ADDA2EA00CC0406 /* AnyPromise.test.m in Sources */ = {isa = PBXBuildFile; fileRef = 635D0D741ADDA2C100CC0406 /* AnyPromise.test.m */; };
635D0D7B1ADDB11400CC0406 /* ErrorUnhandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D0D7A1ADDB11400CC0406 /* ErrorUnhandler.swift */; };
635D0D7C1ADDB11400CC0406 /* ErrorUnhandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D0D7A1ADDB11400CC0406 /* ErrorUnhandler.swift */; };
6362D8B41AF8831200E9E0A2 /* SLComposeViewController+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6302ACC21AEF42F2001F0069 /* SLComposeViewController+Promise.swift */; };
636A44EE1AEC0F6700639777 /* TestSocial.m in Sources */ = {isa = PBXBuildFile; fileRef = 637BF6111AEAC62400997C8B /* TestSocial.m */; };
63772C9C1AF09B8A00ED2F59 /* ErrorUnhandler.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63772C9B1AF09B8A00ED2F59 /* ErrorUnhandler.test.swift */; };
6388E19C1AD310F80074D85B /* NSJSONFromData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B4F8AF1AD19EDB0036A41A /* NSJSONFromData.swift */; };
6388E19D1AD311000074D85B /* NSJSONFromData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B4F8AF1AD19EDB0036A41A /* NSJSONFromData.swift */; };
6388E1A81AD315F90074D85B /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F803A31AB87A8200E4DEE1 /* PromiseKit.framework */; };
6388E1AF1AD316690074D85B /* when.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6388E1AE1AD316690074D85B /* when.test.swift */; };
6388E1B21AD316CB0074D85B /* race.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6388E1B01AD316CB0074D85B /* race.test.swift */; };
6388E1B31AD316CB0074D85B /* zalgo.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6388E1B11AD316CB0074D85B /* zalgo.test.swift */; };
@ -137,7 +149,6 @@
638DFF631AFAEB4700465598 /* TestNSObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638DFF5E1AFAEB4700465598 /* TestNSObject.swift */; };
638DFF641AFAEB4700465598 /* TestNSURLConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638DFF5F1AFAEB4700465598 /* TestNSURLConnection.swift */; };
638DFF651AFAEB4700465598 /* TestNSURLConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638DFF5F1AFAEB4700465598 /* TestNSURLConnection.swift */; };
638E0EDB1AEF16530052E28F /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F803A31AB87A8200E4DEE1 /* PromiseKit.framework */; };
638E0F111AEF171E0052E28F /* TestAccounts.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DF16F41AEAC46E00BE97DD /* TestAccounts.m */; };
638E0F121AEF171E0052E28F /* TestAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF16F51AEAC46E00BE97DD /* TestAccounts.swift */; };
638E0F131AEF171E0052E28F /* TestAVFoundation.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DF16F61AEAC46E00BE97DD /* TestAVFoundation.m */; };
@ -159,19 +170,12 @@
638E0F311AEF1B740052E28F /* OHHTTPStubs.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63CA14C61AEA9E7400223904 /* OHHTTPStubs.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
638E0F321AEF1B750052E28F /* OMGHTTPURLRQ.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63CA14C71AEA9E7400223904 /* OMGHTTPURLRQ.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
63985D211AF91C8D00F62764 /* UIViewController+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 6302ACD81AEF42F2001F0069 /* UIViewController+AnyPromise.m */; };
639A12711AB9F941002E5C24 /* Promise+Properties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639A12701AB9F941002E5C24 /* Promise+Properties.swift */; };
639A12721AB9F997002E5C24 /* Promise+Properties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639A12701AB9F941002E5C24 /* Promise+Properties.swift */; };
63A1576B1ABB32EB0002A421 /* AnyPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63A1576A1ABB32EB0002A421 /* AnyPromise.swift */; };
63A1576C1ABB34250002A421 /* AnyPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63A1576A1ABB32EB0002A421 /* AnyPromise.swift */; };
63A157721ABB59D00002A421 /* AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A157711ABB59D00002A421 /* AnyPromise.m */; };
63A157731ABB59D00002A421 /* AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A157711ABB59D00002A421 /* AnyPromise.m */; };
63A157741ABB59D80002A421 /* PromiseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 63A157701ABB59490002A421 /* PromiseKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
63A157751ABB59DC0002A421 /* PromiseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 63A157701ABB59490002A421 /* PromiseKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
63A5389A1B741F0A002BB8E6 /* AnyPromise.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63A538991B741F0A002BB8E6 /* AnyPromise.test.swift */; };
63A60E201AFD795B00C4E692 /* after.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A60E1F1AFD795B00C4E692 /* after.m */; };
63B6FE491ABB613500E1F4C2 /* Sealant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B6FE481ABB613500E1F4C2 /* Sealant.swift */; };
63B6FE4A1ABB613500E1F4C2 /* Sealant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B6FE481ABB613500E1F4C2 /* Sealant.swift */; };
63BF9DD01AB9E4850049EA39 /* State.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63BF9DCF1AB9E4850049EA39 /* State.swift */; };
63BF9DD11AB9E5C60049EA39 /* State.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63BF9DCF1AB9E4850049EA39 /* State.swift */; };
63CA144D1AE9FBD000223904 /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F803CC1AB89A0F00E4DEE1 /* PromiseKit.framework */; };
63CA144E1AE9FBD000223904 /* OHHTTPStubs.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630AC2ED1AE6AC0400A212AD /* OHHTTPStubs.framework */; };
@ -187,12 +191,10 @@
63CA14861AEA930C00223904 /* 2.3.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63BCB8C41AD3279C000AF3D0 /* 2.3.2.swift */; };
63CA14871AEA930C00223904 /* 2.3.3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63BCB8C51AD3279C000AF3D0 /* 2.3.3.swift */; };
63CA14881AEA930C00223904 /* 2.3.4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63BCB8C61AD3279C000AF3D0 /* 2.3.4.swift */; };
63CA14991AEA9CBF00223904 /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F803A31AB87A8200E4DEE1 /* PromiseKit.framework */; };
63CF406A1B29FD1400F0F5FC /* afterlife.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D73BE11B20B48F00843146 /* afterlife.swift */; };
63D73BE21B20B48F00843146 /* afterlife.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D73BE11B20B48F00843146 /* afterlife.swift */; };
63D88E691AEB09CE00615362 /* TestSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 637BF6121AEAC62400997C8B /* TestSocial.swift */; };
63D953C91AEDA3B1004981FF /* AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63D953C71AEDA3B1004981FF /* AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
63D953CA1AEDA4D0004981FF /* AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63D953C71AEDA3B1004981FF /* AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
63DF17051AEAC46E00BE97DD /* TestAccounts.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DF16F41AEAC46E00BE97DD /* TestAccounts.m */; };
63DF17071AEAC46E00BE97DD /* TestAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF16F51AEAC46E00BE97DD /* TestAccounts.swift */; };
63DF170D1AEAC46E00BE97DD /* TestCloudKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DF16F81AEAC46E00BE97DD /* TestCloudKit.m */; };
@ -215,8 +217,6 @@
63E2997C1AFDCE5600921143 /* TestUIViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E299781AFDCE5600921143 /* TestUIViewController.m */; };
63E2997F1AFDF28100921143 /* TestSLComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E2997D1AFDF28100921143 /* TestSLComposeViewController.m */; };
63E299811AFDF28100921143 /* TestSLComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E2997E1AFDF28100921143 /* TestSLComposeViewController.swift */; };
63F803A91AB87A8200E4DEE1 /* Umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 63F803A81AB87A8200E4DEE1 /* Umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
63F803C01AB87A9500E4DEE1 /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63F803BF1AB87A9500E4DEE1 /* Promise.swift */; };
63F803C41AB89A0F00E4DEE1 /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63F803BF1AB87A9500E4DEE1 /* Promise.swift */; };
63F803C71AB89A0F00E4DEE1 /* Umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 63F803A81AB87A8200E4DEE1 /* Umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
@ -236,13 +236,6 @@
remoteGlobalIDString = 638CDF021AEE734B0023A543;
remoteInfo = PMKTestHost;
};
638E0EDC1AEF16530052E28F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 63F8039A1AB87A8200E4DEE1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 63F803A21AB87A8200E4DEE1;
remoteInfo = PMKiOS;
};
63CA144A1AE9FBD000223904 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 63F8039A1AB87A8200E4DEE1 /* Project object */;
@ -250,13 +243,6 @@
remoteGlobalIDString = 63F803C21AB89A0F00E4DEE1;
remoteInfo = PMKOSX;
};
63CA149A1AEA9CBF00223904 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 63F8039A1AB87A8200E4DEE1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 63F803A21AB87A8200E4DEE1;
remoteInfo = PMKiOS;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@ -266,6 +252,9 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
63348F501D4802DE000E8B52 /* OHHTTPStubs.framework in CopyFiles */,
63348F4F1D4802D4000E8B52 /* OMGHTTPURLRQ.framework in CopyFiles */,
63348F4E1D4802CB000E8B52 /* KIF.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -371,6 +360,7 @@
63196AC41AFD936300555BCD /* dispatch_promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = dispatch_promise.swift; path = Sources/dispatch_promise.swift; sourceTree = "<group>"; };
631A51BB1B29E7E90018606D /* bridging.test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = bridging.test.swift; sourceTree = "<group>"; };
631FEA7E1AF28E4900ED9646 /* PMKPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PMKPromise.h; path = Sources/PMKPromise.h; sourceTree = "<group>"; };
632665141D482D010018F06F /* PromiseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PromiseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63314AD71AEDDC070071B6F5 /* hang.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = hang.m; path = Sources/hang.m; sourceTree = "<group>"; };
63314AD81AEDDC070071B6F5 /* join.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = join.m; path = Sources/join.m; sourceTree = "<group>"; };
63314AD91AEDDC070071B6F5 /* when.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = when.m; path = Sources/when.m; sourceTree = "<group>"; };
@ -456,7 +446,6 @@
63E299781AFDCE5600921143 /* TestUIViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestUIViewController.m; path = Categories/TestUIViewController.m; sourceTree = "<group>"; };
63E2997D1AFDF28100921143 /* TestSLComposeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestSLComposeViewController.m; path = Categories/TestSLComposeViewController.m; sourceTree = "<group>"; };
63E2997E1AFDF28100921143 /* TestSLComposeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TestSLComposeViewController.swift; path = Categories/TestSLComposeViewController.swift; sourceTree = "<group>"; };
63F803A31AB87A8200E4DEE1 /* PromiseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PromiseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63F803A71AB87A8200E4DEE1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Sources/Info.plist; sourceTree = "<group>"; };
63F803A81AB87A8200E4DEE1 /* Umbrella.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Umbrella.h; path = Sources/Umbrella.h; sourceTree = SOURCE_ROOT; };
63F803BF1AB87A9500E4DEE1 /* Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Promise.swift; path = Sources/Promise.swift; sourceTree = "<group>"; };
@ -465,6 +454,13 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
632665101D482D010018F06F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
63533B301AE57A9300C10972 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -477,7 +473,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6388E1A81AD315F90074D85B /* PromiseKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -485,7 +480,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
638E0EDB1AEF16530052E28F /* PromiseKit.framework in Frameworks */,
638E0F2E1AEF1A0A0052E28F /* OHHTTPStubs.framework in Frameworks */,
638E0F2F1AEF1A0A0052E28F /* OMGHTTPURLRQ.framework in Frameworks */,
634E98AA1AF916AA00094594 /* Stubbilino.framework in Frameworks */,
@ -507,7 +501,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
63CA14991AEA9CBF00223904 /* PromiseKit.framework in Frameworks */,
635421E01B38C53E00401F9B /* KIF.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -838,7 +831,6 @@
638E0ED51AEF16530052E28F /* PMKiOSCategoryTests.xctest */,
63CA14931AEA9CBE00223904 /* PMKiOSCategoryHostedTests.xctest */,
638CDF031AEE734B0023A543 /* PMKTestHost.app */,
63F803A31AB87A8200E4DEE1 /* PromiseKit.framework */,
63CA14C61AEA9E7400223904 /* OHHTTPStubs.framework */,
63CA14C71AEA9E7400223904 /* OMGHTTPURLRQ.framework */,
634E98A91AF916AA00094594 /* Stubbilino.framework */,
@ -918,6 +910,7 @@
63CA14C51AEA9E1500223904 /* iOS */,
63CA14C41AEA9E0C00223904 /* OS X */,
63F803A71AB87A8200E4DEE1 /* Info.plist */,
632665141D482D010018F06F /* PromiseKit.framework */,
);
name = "…";
sourceTree = "<group>";
@ -925,17 +918,17 @@
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
63F803A01AB87A8200E4DEE1 /* Headers */ = {
632665111D482D010018F06F /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
63D953CA1AEDA4D0004981FF /* AnyPromise.h in Headers */,
633810651B02EC7A00CCD263 /* NSError+Cancellation.h in Headers */,
631FEA7F1AF28E4900ED9646 /* PMKPromise.h in Headers */,
63196ABF1AFD8EE300555BCD /* Promise.h in Headers */,
63A157751ABB59DC0002A421 /* PromiseKit.h in Headers */,
63F803A91AB87A8200E4DEE1 /* Umbrella.h in Headers */,
63196AC21AFD8F1600555BCD /* AnyPromise+Private.h in Headers */,
6326652E1D482D540018F06F /* AnyPromise.h in Headers */,
632665301D482D540018F06F /* Umbrella.h in Headers */,
632665311D482D540018F06F /* NSError+Cancellation.h in Headers */,
632665331D482D540018F06F /* PMKPromise.h in Headers */,
632665321D482D540018F06F /* Promise.h in Headers */,
6326652F1D482D540018F06F /* PromiseKit.h in Headers */,
632665341D482D540018F06F /* AnyPromise+Private.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -956,6 +949,24 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
632665131D482D010018F06F /* PMKiOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 632665191D482D010018F06F /* Build configuration list for PBXNativeTarget "PMKiOS" */;
buildPhases = (
6326650F1D482D010018F06F /* Sources */,
632665101D482D010018F06F /* Frameworks */,
632665111D482D010018F06F /* Headers */,
632665121D482D010018F06F /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = PMKiOS;
productName = PMKiOS;
productReference = 632665141D482D010018F06F /* PromiseKit.framework */;
productType = "com.apple.product-type.framework";
};
63533B321AE57A9300C10972 /* PMKAPlusTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63533B3C1AE57A9300C10972 /* Build configuration list for PBXNativeTarget "PMKAPlusTests" */;
@ -1018,7 +1029,6 @@
buildRules = (
);
dependencies = (
638E0EDD1AEF16530052E28F /* PBXTargetDependency */,
);
name = PMKiOSCategoryTests;
productName = PMKiOSCategoryTests;
@ -1055,7 +1065,6 @@
buildRules = (
);
dependencies = (
63CA149B1AEA9CBF00223904 /* PBXTargetDependency */,
638CDF291AEE74290023A543 /* PBXTargetDependency */,
);
name = PMKiOSCategoryHostedTests;
@ -1063,22 +1072,6 @@
productReference = 63CA14931AEA9CBE00223904 /* PMKiOSCategoryHostedTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
63F803A21AB87A8200E4DEE1 /* PMKiOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63F803B91AB87A8200E4DEE1 /* Build configuration list for PBXNativeTarget "PMKiOS" */;
buildPhases = (
63F8039E1AB87A8200E4DEE1 /* Sources */,
63F803A01AB87A8200E4DEE1 /* Headers */,
);
buildRules = (
);
dependencies = (
);
name = PMKiOS;
productName = PromisesXP;
productReference = 63F803A31AB87A8200E4DEE1 /* PromiseKit.framework */;
productType = "com.apple.product-type.framework";
};
63F803C21AB89A0F00E4DEE1 /* PMKOSX */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63F803C91AB89A0F00E4DEE1 /* Build configuration list for PBXNativeTarget "PMKOSX" */;
@ -1105,6 +1098,9 @@
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Max Howell";
TargetAttributes = {
632665131D482D010018F06F = {
CreatedOnToolsVersion = 7.2.1;
};
63533B321AE57A9300C10972 = {
CreatedOnToolsVersion = 6.3;
};
@ -1121,9 +1117,6 @@
CreatedOnToolsVersion = 6.3;
TestTargetID = 638CDF021AEE734B0023A543;
};
63F803A21AB87A8200E4DEE1 = {
CreatedOnToolsVersion = 6.2;
};
};
};
buildConfigurationList = 63F8039D1AB87A8200E4DEE1 /* Build configuration list for PBXProject "PromiseKit" */;
@ -1139,7 +1132,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
63F803A21AB87A8200E4DEE1 /* PMKiOS */,
632665131D482D010018F06F /* PMKiOS */,
63F803C21AB89A0F00E4DEE1 /* PMKOSX */,
6388E1A11AD315F90074D85B /* PMKTests */,
63533B321AE57A9300C10972 /* PMKAPlusTests */,
@ -1152,6 +1145,13 @@
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
632665121D482D010018F06F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
638CDF011AEE734B0023A543 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -1205,6 +1205,31 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6326650F1D482D010018F06F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6326651C1D482D3E0018F06F /* Promise.swift in Sources */,
6326651D1D482D3E0018F06F /* Promise+Properties.swift in Sources */,
6326651E1D482D3E0018F06F /* ErrorUnhandler.swift in Sources */,
6326651F1D482D3E0018F06F /* Sealant.swift in Sources */,
632665201D482D3E0018F06F /* State.swift in Sources */,
632665211D482D3E0018F06F /* AnyPromise.swift in Sources */,
632665221D482D3E0018F06F /* AnyPromise.m in Sources */,
632665231D482D3E0018F06F /* after.m in Sources */,
632665241D482D3E0018F06F /* after.swift in Sources */,
632665251D482D3E0018F06F /* dispatch_promise.m in Sources */,
632665261D482D3E0018F06F /* dispatch_promise.swift in Sources */,
632665271D482D3E0018F06F /* hang.m in Sources */,
632665281D482D3E0018F06F /* join.m in Sources */,
632665291D482D3E0018F06F /* race.swift in Sources */,
6326652A1D482D3E0018F06F /* when.m in Sources */,
6326652B1D482D3E0018F06F /* when.swift in Sources */,
6326652C1D482D3E0018F06F /* PMKPromise.m in Sources */,
6326652D1D482D3E0018F06F /* NSJSONFromData.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63533B2F1AE57A9300C10972 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -1390,31 +1415,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
63F8039E1AB87A8200E4DEE1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63A60E201AFD795B00C4E692 /* after.m in Sources */,
63075EBE1AD0EDB3002C46A0 /* after.swift in Sources */,
63A157721ABB59D00002A421 /* AnyPromise.m in Sources */,
63A1576B1ABB32EB0002A421 /* AnyPromise.swift in Sources */,
63196AC51AFD936300555BCD /* dispatch_promise.m in Sources */,
63196AC71AFD936300555BCD /* dispatch_promise.swift in Sources */,
635D0D7B1ADDB11400CC0406 /* ErrorUnhandler.swift in Sources */,
63314ADA1AEDDC070071B6F5 /* hang.m in Sources */,
63314ADC1AEDDC070071B6F5 /* join.m in Sources */,
630F25F91AF17A8F00BE27FD /* PMKPromise.m in Sources */,
63F803C01AB87A9500E4DEE1 /* Promise.swift in Sources */,
639A12711AB9F941002E5C24 /* Promise+Properties.swift in Sources */,
6388E19C1AD310F80074D85B /* NSJSONFromData.swift in Sources */,
63075EC51AD10471002C46A0 /* race.swift in Sources */,
63B6FE491ABB613500E1F4C2 /* Sealant.swift in Sources */,
63BF9DD01AB9E4850049EA39 /* State.swift in Sources */,
63314ADE1AEDDC070071B6F5 /* when.m in Sources */,
63075EC11AD0F097002C46A0 /* when.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63F803C31AB89A0F00E4DEE1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -1453,24 +1453,50 @@
target = 638CDF021AEE734B0023A543 /* PMKTestHost */;
targetProxy = 638CDF281AEE74290023A543 /* PBXContainerItemProxy */;
};
638E0EDD1AEF16530052E28F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 63F803A21AB87A8200E4DEE1 /* PMKiOS */;
targetProxy = 638E0EDC1AEF16530052E28F /* PBXContainerItemProxy */;
};
63CA14491AE9FBD000223904 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 63F803C21AB89A0F00E4DEE1 /* PMKOSX */;
targetProxy = 63CA144A1AE9FBD000223904 /* PBXContainerItemProxy */;
};
63CA149B1AEA9CBF00223904 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 63F803A21AB87A8200E4DEE1 /* PMKiOS */;
targetProxy = 63CA149A1AEA9CBF00223904 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
6326651A1D482D010018F06F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Sources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Sources/PMK.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit;
PRODUCT_NAME = PromiseKit;
};
name = Debug;
};
6326651B1D482D010018F06F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Sources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Sources/PMK.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit;
PRODUCT_NAME = PromiseKit;
};
name = Release;
};
63533B3D1AE57A9300C10972 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -1831,55 +1857,16 @@
};
name = Release;
};
63F803BA1AB87A8200E4DEE1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Sources/PMK.modulemap;
PRODUCT_NAME = PromiseKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
63F803BB1AB87A8200E4DEE1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Sources/PMK.modulemap;
PRODUCT_NAME = PromiseKit;
SKIP_INSTALL = YES;
};
name = Release;
};
63F803CA1AB89A0F00E4DEE1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Sources/PMK.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit;
PRODUCT_NAME = PromiseKit;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -1890,12 +1877,12 @@
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Sources/PMK.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit;
PRODUCT_NAME = PromiseKit;
SDKROOT = macosx;
};
@ -1904,6 +1891,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
632665191D482D010018F06F /* Build configuration list for PBXNativeTarget "PMKiOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6326651A1D482D010018F06F /* Debug */,
6326651B1D482D010018F06F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63533B3C1AE57A9300C10972 /* Build configuration list for PBXNativeTarget "PMKAPlusTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@ -1967,15 +1963,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63F803B91AB87A8200E4DEE1 /* Build configuration list for PBXNativeTarget "PMKiOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63F803BA1AB87A8200E4DEE1 /* Debug */,
63F803BB1AB87A8200E4DEE1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63F803C91AB89A0F00E4DEE1 /* Build configuration list for PBXNativeTarget "PMKOSX" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
@ -72,11 +72,11 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
@ -94,10 +94,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference

View File

@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63F803A21AB87A8200E4DEE1"
BlueprintIdentifier = "632665131D482D010018F06F"
BuildableName = "PromiseKit.framework"
BlueprintName = "PMKiOS"
ReferencedContainer = "container:PromiseKit.xcodeproj">
@ -52,7 +52,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63F803A21AB87A8200E4DEE1"
BlueprintIdentifier = "632665131D482D010018F06F"
BuildableName = "PromiseKit.framework"
BlueprintName = "PMKiOS"
ReferencedContainer = "container:PromiseKit.xcodeproj">
@ -74,7 +74,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63F803A21AB87A8200E4DEE1"
BlueprintIdentifier = "632665131D482D010018F06F"
BuildableName = "PromiseKit.framework"
BlueprintName = "PMKiOS"
ReferencedContainer = "container:PromiseKit.xcodeproj">
@ -92,7 +92,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63F803A21AB87A8200E4DEE1"
BlueprintIdentifier = "632665131D482D010018F06F"
BuildableName = "PromiseKit.framework"
BlueprintName = "PMKiOS"
ReferencedContainer = "container:PromiseKit.xcodeproj">

View File

@ -293,7 +293,7 @@ public typealias AnyPromise = PMKPromise
}
extension AnyPromise: DebugPrintable {
extension AnyPromise: CustomDebugStringConvertible {
override public var debugDescription: String {
return "AnyPromise: \(state)"
}

View File

@ -71,7 +71,7 @@ func unconsume(error: NSError) {
} else {
// this is how we know when the error is deallocated
// because we will be deallocated at the same time
objc_setAssociatedObject(error, &handle, Consumable(parent: error), objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN))
objc_setAssociatedObject(error, &handle, Consumable(parent: error), .OBJC_ASSOCIATION_RETAIN)
}
}

View File

@ -21,23 +21,22 @@ public func NSJSONFromData(data: NSData) -> Promise<NSDictionary> {
}
private func NSJSONFromDataT<T>(data: NSData) -> Promise<T> {
var error: NSError?
let json: AnyObject? = NSJSONSerialization.JSONObjectWithData(data, options:nil, error:&error)
if let cast = json as? T {
return Promise(cast)
} else if let error = error {
// NSJSONSerialization gives awful errors, so we wrap it
let debug = error.userInfo!["NSDebugDescription"] as? String
do {
let json: AnyObject? = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions())
if let cast = json as? T {
return Promise(cast)
} else {
var info = [NSObject: AnyObject]()
info[NSLocalizedDescriptionKey] = "The server returned JSON in an unexpected arrangement"
info[PMKJSONErrorJSONObjectKey] = json
return Promise(NSError(domain: PMKErrorDomain, code: PMKJSONError, userInfo: info))
}
} catch let error {
let debug = (error as NSError).userInfo["NSDebugDescription"] as? String
let description = "The servers JSON response could not be decoded. (\(debug))"
return Promise(NSError(domain: PMKErrorDomain, code: PMKJSONError, userInfo: [
NSLocalizedDescriptionKey: "There was an error decoding the servers JSON response.",
NSUnderlyingErrorKey: error
NSLocalizedDescriptionKey: description,
NSUnderlyingErrorKey: error as NSError
]))
} else {
var info = [NSObject: AnyObject]()
info[NSLocalizedDescriptionKey] = "The server returned JSON in an unexpected arrangement"
info[PMKJSONErrorJSONObjectKey] = json
return Promise(NSError(domain: PMKErrorDomain, code: PMKJSONError, userInfo: info))
}
}

View File

@ -16,7 +16,6 @@ public enum CatchPolicy {
that promise, which returns a promise, you can call `then` on that
promise, et cetera.
0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2
Promises start in a pending state and *resolve* with a value to become
*fulfilled* or with an `NSError` to become rejected.
@ -115,10 +114,10 @@ public class Promise<T> {
}
/**
defer is convenient for wrapping delegates or larger asynchronous systems.
defer_ is convenient for wrapping delegates or larger asynchronous systems.
class Foo: BarDelegate {
let (promise, fulfill, reject) = Promise<Int>.defer()
let (promise, fulfill, reject) = Promise<Int>.defer_()
func barDidFinishWithResult(result: Int) {
fulfill(result)
@ -136,7 +135,7 @@ public class Promise<T> {
3) A function that rejects that promise
*/
public class func defer() -> (promise: Promise, fulfill: (T) -> Void, reject: (NSError) -> Void) {
public class func defer_() -> (promise: Promise, fulfill: (T) -> Void, reject: (NSError) -> Void) {
var sealant: Sealant<T>!
let promise = Promise { sealant = $0 }
return (promise, sealant.resolve, sealant.resolve)
@ -264,7 +263,7 @@ public class Promise<T> {
@see registerCancellationError
*/
public func catch(policy: CatchPolicy = .AllErrorsExceptCancellation, _ body: (NSError) -> Void) {
public func catch_(policy policy: CatchPolicy = .AllErrorsExceptCancellation, _ body: (NSError) -> Void) {
pipe { resolution in
switch resolution {
case .Fulfilled:
@ -437,7 +436,7 @@ extension Promise {
}
extension Promise: DebugPrintable {
extension Promise: CustomDebugStringConvertible {
public var debugDescription: String {
return "Promise: \(state)"
}

View File

@ -40,10 +40,10 @@ public class Sealant<T> {
To get this to work you often have to help the compiler by specifiying
the type. In future versions of Swift, this should become unecessary.
*/
public func resolve(obj: T!, var _ error: NSError!) {
if obj != nil {
public func resolve(obj: T?, var _ error: NSError?) {
if let obj = obj {
handler(.Fulfilled(obj))
} else if error != nil {
} else if let error = error {
resolve(error)
} else {
//FIXME couldn't get the constants from the umbrella header :(
@ -52,7 +52,7 @@ public class Sealant<T> {
}
}
public func resolve(obj: T, _ error: NSError!) {
public func resolve(obj: T, _ error: NSError?) {
if error == nil {
handler(.Fulfilled(obj))
} else {

View File

@ -118,7 +118,7 @@ class Handlers: SequenceType {
}
extension Resolution: DebugPrintable {
extension Resolution: CustomDebugStringConvertible {
var debugDescription: String {
switch self {
case Fulfilled(let value):
@ -129,7 +129,7 @@ extension Resolution: DebugPrintable {
}
}
extension UnsealedState: DebugPrintable {
extension UnsealedState: CustomDebugStringConvertible {
var debugDescription: String {
var rv: String?
get { seal in
@ -144,7 +144,7 @@ extension UnsealedState: DebugPrintable {
}
}
extension SealedState: DebugPrintable {
extension SealedState: CustomDebugStringConvertible {
var debugDescription: String {
return "SealedState: \(resolution)"
}

View File

@ -1,7 +1,7 @@
import Foundation.NSProgress
private func when<T>(promises: [Promise<T>]) -> Promise<Void> {
let (rootPromise, fulfill, reject) = Promise<Void>.defer()
let (rootPromise, fulfill, reject) = Promise<Void>.defer_()
#if !PMKDisableProgress
let progress = NSProgress(totalUnitCount: Int64(promises.count))
progress.cancellable = false
@ -16,7 +16,7 @@ private func when<T>(promises: [Promise<T>]) -> Promise<Void> {
}
let barrier = dispatch_queue_create("org.promisekit.barrier.when", DISPATCH_QUEUE_CONCURRENT)
for (index, promise) in enumerate(promises) {
for promise in promises {
promise.pipe { resolution in
if !rootPromise.pending { return }
@ -50,13 +50,13 @@ public func when(promises: Promise<Void>...) -> Promise<Void> {
return when(promises)
}
public func when<U, V>(pu: Promise<U>, pv: Promise<V>) -> Promise<(U, V)> {
public func when<U, V>(pu: Promise<U>, _ pv: Promise<V>) -> Promise<(U, V)> {
return when(pu.asVoid(), pv.asVoid()).then(on: zalgo) { (pu.value!, pv.value!) }
}
public func when<U, V, X>(pu: Promise<U>, pv: Promise<V>, px: Promise<X>) -> Promise<(U, V, X)> {
public func when<U, V, X>(pu: Promise<U>, _ pv: Promise<V>, _ px: Promise<X>) -> Promise<(U, V, X)> {
return when(pu.asVoid(), pv.asVoid(), px.asVoid()).then(on: zalgo) { (pu.value!, pv.value!, px.value!) }
}
@availability(*, unavailable, message="Use `when`")
@available(*, unavailable, message="Use `when`")
public func join<T>(promises: Promise<T>...) {}

View File

@ -9,7 +9,7 @@ class AnyPromiseTestSuite_Swift: XCTestCase {
// AnyPromise.then { return x }
AnyPromise(bound: dispatch_promise{1}).then { obj -> Int in
XCTAssertEqual(obj as! Int, 1)
XCTAssertEqual(obj as? Int, 1)
return 2
}.then { value -> Void in
XCTAssertEqual(value, 2)
@ -25,10 +25,10 @@ class AnyPromiseTestSuite_Swift: XCTestCase {
// AnyPromise.then { return AnyPromise }
AnyPromise(bound: dispatch_promise{1}).then { obj -> AnyPromise in
XCTAssertEqual(obj as! Int, 1)
XCTAssertEqual(obj as? Int, 1)
return AnyPromise(bound: dispatch_promise{2})
}.then { obj -> Void in
XCTAssertEqual(obj as! Int, 2)
XCTAssertEqual(obj as? Int, 2)
ex.fulfill()
}
@ -41,7 +41,7 @@ class AnyPromiseTestSuite_Swift: XCTestCase {
// AnyPromise.then { return Promise<Int> }
AnyPromise(bound: dispatch_promise{1}).then { obj -> Promise<Int> in
XCTAssertEqual(obj as! Int, 1)
XCTAssertEqual(obj as? Int, 1)
return dispatch_promise{2}
}.then { value -> Void in
XCTAssertEqual(value, 2)

View File

@ -5,7 +5,7 @@
@interface TestAVAudioSession: XCTestCase @end @implementation TestAVAudioSession
- (void)test {
- (void)testM {
id ex = [self expectationWithDescription:@""];
[[AVAudioSession new] requestRecordPermission].then(^{

View File

@ -22,22 +22,22 @@ class TestACAccountStore: XCTestCase {
waitForExpectationsWithTimeout(1, handler: nil)
}
func testRequestAccessToAccountsWithType() {
class MockAccountStore: ACAccountStore {
override func requestAccessToAccountsWithType(accountType: ACAccountType!, options: [NSObject : AnyObject]!, completion: ACAccountStoreRequestAccessCompletionHandler!) {
completion(true, nil)
}
}
let ex = expectationWithDescription("")
let store = MockAccountStore()
let type = store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook)
store.requestAccessToAccountsWithType(type).then { _ in
ex.fulfill()
}
waitForExpectationsWithTimeout(1, handler: nil)
}
// func testRequestAccessToAccountsWithType() {
// class MockAccountStore: ACAccountStore {
// override func requestAccessToAccountsWithType(accountType: ACAccountType!, options: [NSObject : AnyObject]!, completion: ACAccountStoreRequestAccessCompletionHandler!) {
// completion(true, nil)
// }
// }
//
// let ex = expectationWithDescription("")
// let store = MockAccountStore()
// let type = store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook)
// store.requestAccessToAccountsWithType(type).then { _ in
// ex.fulfill()
// }
//
// waitForExpectationsWithTimeout(1, handler: nil)
// }
func testSaveAccount() {
class MockAccountStore: ACAccountStore {

View File

@ -7,7 +7,7 @@ class TestAddressBook: XCTestCase {
func test1() {
let ex = expectationWithDescription("")
ABAddressBookRequestAccess().then { (auth: ABAuthorizationStatus) in
XCTAssertEqual(auth, .Authorized)
XCTAssertEqual(auth, ABAuthorizationStatus.Authorized)
}.then(ex.fulfill)
waitForExpectationsWithTimeout(1, handler: nil)
}

View File

@ -12,7 +12,7 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func accountStatusWithCompletionHandler(completionHandler: ((CKAccountStatus, NSError!) -> Void)!) {
private override func accountStatusWithCompletionHandler(completionHandler: (CKAccountStatus, NSError?) -> Void) {
completionHandler(.CouldNotDetermine, nil)
}
}
@ -30,13 +30,13 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func requestApplicationPermission(applicationPermission: CKApplicationPermissions, completionHandler: CKApplicationPermissionBlock!) {
private override func requestApplicationPermission(applicationPermission: CKApplicationPermissions, completionHandler: CKApplicationPermissionBlock) {
completionHandler(.Granted, nil)
}
}
let ex = expectationWithDescription("")
let pp = CKApplicationPermissions.PermissionUserDiscoverability
let pp = CKApplicationPermissions.UserDiscoverability
MockContainer().requestApplicationPermission(pp).then { perms -> Void in
XCTAssertEqual(perms, CKApplicationPermissionStatus.Granted)
ex.fulfill()
@ -49,16 +49,16 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func statusForApplicationPermission(applicationPermission: CKApplicationPermissions, completionHandler: CKApplicationPermissionBlock!) {
private override func statusForApplicationPermission(applicationPermission: CKApplicationPermissions, completionHandler: CKApplicationPermissionBlock) {
completionHandler(.Granted, nil)
}
}
let ex = expectationWithDescription("")
let pp = CKApplicationPermissions.PermissionUserDiscoverability
let pp = CKApplicationPermissions.UserDiscoverability
MockContainer().statusForApplicationPermission(pp).then {
XCTAssertEqual($0, CKApplicationPermissionStatus.Granted)
}.then(ex.fulfill)
}.then(ex.fulfill)
waitForExpectationsWithTimeout(1, handler: nil)
}
@ -67,7 +67,7 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func discoverAllContactUserInfosWithCompletionHandler(completionHandler: (([AnyObject]!, NSError!) -> Void)!) {
private override func discoverAllContactUserInfosWithCompletionHandler(completionHandler: ([CKDiscoveredUserInfo]?, NSError?) -> Void) {
completionHandler([PMKDiscoveredUserInfo()], nil)
}
}
@ -75,7 +75,7 @@ class Test_CKContainer_Swift: XCTestCase {
let ex = expectationWithDescription("")
MockContainer().discoverAllContactUserInfos().then {
XCTAssertEqual($0, [PMKDiscoveredUserInfo()])
}.then(ex.fulfill)
}.then(ex.fulfill)
waitForExpectationsWithTimeout(1, handler: nil)
}
@ -84,7 +84,7 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func discoverUserInfoWithEmailAddress(email: String!, completionHandler: ((CKDiscoveredUserInfo!, NSError!) -> Void)!) {
private override func discoverUserInfoWithEmailAddress(email: String, completionHandler: (CKDiscoveredUserInfo?, NSError?) -> Void) {
completionHandler(PMKDiscoveredUserInfo(), nil)
}
}
@ -92,7 +92,7 @@ class Test_CKContainer_Swift: XCTestCase {
let ex = expectationWithDescription("")
MockContainer().discoverUserInfo(email: "mxcl@me.com").then {
XCTAssertEqual($0, PMKDiscoveredUserInfo())
}.then(ex.fulfill)
}.then(ex.fulfill)
waitForExpectationsWithTimeout(1, handler: nil)
}
@ -101,7 +101,7 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func discoverUserInfoWithUserRecordID(userRecordID: CKRecordID!, completionHandler: ((CKDiscoveredUserInfo!, NSError!) -> Void)!) {
private override func discoverUserInfoWithUserRecordID(userRecordID: CKRecordID, completionHandler: (CKDiscoveredUserInfo?, NSError?) -> Void) {
completionHandler(PMKDiscoveredUserInfo(), nil)
}
}
@ -109,7 +109,7 @@ class Test_CKContainer_Swift: XCTestCase {
let ex = expectationWithDescription("")
MockContainer().discoverUserInfo(recordID: dummy()).then {
XCTAssertEqual($0, PMKDiscoveredUserInfo())
}.then(ex.fulfill)
}.then(ex.fulfill)
waitForExpectationsWithTimeout(1, handler: nil)
}
@ -118,7 +118,7 @@ class Test_CKContainer_Swift: XCTestCase {
init(_: Bool = false)
{}
private override func fetchUserRecordIDWithCompletionHandler(completionHandler: ((CKRecordID!, NSError!) -> Void)!) {
private override func fetchUserRecordIDWithCompletionHandler(completionHandler: (CKRecordID?, NSError?) -> Void) {
completionHandler(dummy(), nil)
}
}
@ -126,7 +126,7 @@ class Test_CKContainer_Swift: XCTestCase {
let ex = expectationWithDescription("")
MockContainer().fetchUserRecordID().then {
XCTAssertEqual($0, dummy())
}.then(ex.fulfill)
}.then(ex.fulfill)
waitForExpectationsWithTimeout(1, handler: nil)
}
}

View File

@ -34,7 +34,7 @@ class TestCLLocationManager: XCTestCase {
let ex = expectationWithDescription("")
CLLocationManager.requestAuthorization().then { x -> Void in
XCTAssertEqual(x, .Restricted)
XCTAssertEqual(x, CLAuthorizationStatus.Restricted)
ex.fulfill()
}
@ -47,7 +47,7 @@ class TestCLLocationManager: XCTestCase {
let ex = expectationWithDescription("")
CLLocationManager.requestAuthorization().then { x -> Void in
XCTAssertEqual(x, .AuthorizedWhenInUse)
XCTAssertEqual(x, CLAuthorizationStatus.AuthorizedWhenInUse)
ex.fulfill()
}
@ -63,7 +63,7 @@ private let dummyPlacemark = CLPlacemark()
class TestCLGeocoder: XCTestCase {
func testReverseGeocodeLocation() {
class MockGeocoder: CLGeocoder {
private override func reverseGeocodeLocation(location: CLLocation!, completionHandler: CLGeocodeCompletionHandler!) {
private override func reverseGeocodeLocation(location: CLLocation, completionHandler: CLGeocodeCompletionHandler) {
completionHandler([dummyPlacemark], nil)
}
}
@ -78,7 +78,7 @@ class TestCLGeocoder: XCTestCase {
func testGeocodeAddressDictionary() {
class MockGeocoder: CLGeocoder {
private override func geocodeAddressDictionary(addressDictionary: [NSObject : AnyObject]!, completionHandler: CLGeocodeCompletionHandler!) {
private override func geocodeAddressDictionary(addressDictionary: [NSObject : AnyObject], completionHandler: CLGeocodeCompletionHandler) {
completionHandler([dummyPlacemark], nil)
}
}
@ -93,7 +93,7 @@ class TestCLGeocoder: XCTestCase {
func testGeocodeAddressString() {
class MockGeocoder: CLGeocoder {
override func geocodeAddressString(addressString: String!, completionHandler: CLGeocodeCompletionHandler!) {
override func geocodeAddressString(addressString: String, completionHandler: CLGeocodeCompletionHandler) {
completionHandler([dummyPlacemark], nil)
}
}
@ -111,7 +111,7 @@ class TestCLGeocoder: XCTestCase {
/////////////////////////////////////////////////////////////// resources
func swizzle(foo: AnyClass, from: Selector, isClassMethod: Bool = false, @noescape body: () -> Void) {
func swizzle(foo: AnyClass, _ from: Selector, isClassMethod: Bool = false, @noescape body: () -> Void) {
let get: (AnyClass!, Selector) -> Method = isClassMethod ? class_getClassMethod : class_getInstanceMethod
let originalMethod = get(foo, from)
let swizzledMethod = get(foo, Selector("pmk_\(from)"))
@ -121,7 +121,7 @@ func swizzle(foo: AnyClass, from: Selector, isClassMethod: Bool = false, @noesca
method_exchangeImplementations(swizzledMethod, originalMethod)
}
private let dummy = [CLLocation(latitude: 0, longitude: 0)!, CLLocation(latitude: 10, longitude: 20)!]
private let dummy = [CLLocation(latitude: 0, longitude: 0), CLLocation(latitude: 10, longitude: 20)]
extension CLLocationManager {
@objc func pmk_startUpdatingLocation() {

View File

@ -7,7 +7,7 @@ class TestMKDirections: XCTestCase {
let ex = expectationWithDescription("")
class MockDirections: MKDirections {
private override func calculateDirectionsWithCompletionHandler(completionHandler: MKDirectionsHandler!) {
private override func calculateDirectionsWithCompletionHandler(completionHandler: MKDirectionsHandler) {
completionHandler(MKDirectionsResponse(), nil)
}
}
@ -25,7 +25,7 @@ class TestMKDirections: XCTestCase {
let ex = expectationWithDescription("")
class MockDirections: MKDirections {
private override func calculateETAWithCompletionHandler(completionHandler: MKETAHandler!) {
private override func calculateETAWithCompletionHandler(completionHandler: MKETAHandler) {
completionHandler(MKETAResponse(), nil)
}
}
@ -45,7 +45,7 @@ class TestMKSnapshotter: XCTestCase {
let ex = expectationWithDescription("")
class MockSnapshotter: MKMapSnapshotter {
private override func startWithCompletionHandler(completionHandler: MKMapSnapshotCompletionHandler!) {
private override func startWithCompletionHandler(completionHandler: MKMapSnapshotCompletionHandler) {
completionHandler(MKMapSnapshot(), nil)
}
}

View File

@ -17,10 +17,10 @@ class TestPromiseMailComposer: UIKitTestCase {
control.sendAction(button.action, to: button.target, forEvent: nil)
}
})
promise.catch { _ -> Void in
promise.catch_ { _ -> Void in
XCTFail()
}
promise.catch(policy: CatchPolicy.AllErrors) { _ -> Void in
promise.catch_(policy: CatchPolicy.AllErrors) { _ -> Void in
// seems necessary to give vc stack a bit of time
after(0.5).then(ex.fulfill)
}

View File

@ -14,7 +14,7 @@ class TestNSObject: XCTestCase {
foo.observe("bar").then { (newValue: String) -> Void in
XCTAssertEqual(newValue, "moo")
ex.fulfill()
}.catch { err in
}.catch_ { err in
XCTFail()
}
foo.bar = "moo"

View File

@ -25,16 +25,16 @@ class TestNSTask: XCTestCase {
task.promise().then { (stdout: String, stderr: String, exitStatus: Int) -> Void in
XCTFail()
}.catch { err in
let userInfo = err.userInfo!
let expectedStderrData = "ls: \(dir): No such file or directory\n".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
}.catch_ { err in
let userInfo = err.userInfo
let expectedStderrData = "ls: \(dir): No such file or directory\n".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
XCTAssertEqual(userInfo[PMKTaskErrorLaunchPathKey] as! String, task.launchPath)
XCTAssertEqual(userInfo[PMKTaskErrorArgumentsKey] as! [String], task.arguments as! [String])
XCTAssertEqual(userInfo[PMKTaskErrorStandardErrorKey] as! NSData, expectedStderrData)
XCTAssertEqual(userInfo[PMKTaskErrorExitStatusKey] as! Int, 1)
XCTAssertEqual((userInfo[PMKTaskErrorStandardOutputKey] as! NSData).length, 0)
ex.fulfill()
XCTAssertEqual(userInfo[PMKTaskErrorLaunchPathKey] as? String, task.launchPath!)
XCTAssertEqual(userInfo[PMKTaskErrorArgumentsKey] as! [String], task.arguments!)
XCTAssertEqual(userInfo[PMKTaskErrorStandardErrorKey] as? NSData, expectedStderrData)
XCTAssertEqual(userInfo[PMKTaskErrorExitStatusKey] as? Int, 1)
XCTAssertEqual((userInfo[PMKTaskErrorStandardOutputKey] as! NSData).length, 0)
ex.fulfill()
}
waitForExpectationsWithTimeout(10, handler: nil)
}

View File

@ -29,7 +29,7 @@ class TestUIActionSheet: UIKitTestCase {
sheet.addButtonWithTitle("0")
sheet.addButtonWithTitle("1")
sheet.cancelButtonIndex = sheet.addButtonWithTitle("2")
sheet.promiseInView(rootvc.view).catch(policy: .AllErrors) { err in
sheet.promiseInView(rootvc.view).catch_(policy: .AllErrors) { err in
XCTAssertTrue(err.cancelled)
ex.fulfill()
}
@ -60,7 +60,7 @@ class TestUIActionSheet: UIKitTestCase {
let sheet = UIActionSheet()
sheet.cancelButtonIndex = sheet.addButtonWithTitle("0")
sheet.promiseInView(rootvc.view).catch(policy: .AllErrors) { _ in
sheet.promiseInView(rootvc.view).catch_(policy: .AllErrors) { _ in
ex.fulfill()
}
after(0.5).then {

View File

@ -29,7 +29,7 @@ class TestUIAlertView: UIKitTestCase {
alert.addButtonWithTitle("0")
alert.addButtonWithTitle("1")
alert.cancelButtonIndex = alert.addButtonWithTitle("2")
alert.promise().catch(policy: .AllErrors) { err in
alert.promise().catch_(policy: .AllErrors) { err in
XCTAssertTrue(err.cancelled)
ex.fulfill()
}
@ -60,7 +60,7 @@ class TestUIAlertView: UIKitTestCase {
let alert = UIAlertView()
alert.cancelButtonIndex = alert.addButtonWithTitle("0")
alert.promise().catch(policy: .AllErrors) { _ in
alert.promise().catch_(policy: .AllErrors) { _ in
ex.fulfill()
}
after(0.5).then {

View File

@ -9,7 +9,7 @@ class TestPromiseImagePickerController: UIKitTestCase {
// UIImagePickerController fulfills with edited image
func test1() {
class Mock: UIViewController {
var info = [NSObject:AnyObject]()
var info = [String:AnyObject]()
override func presentViewController(vc: UIViewController, animated flag: Bool, completion: (() -> Void)?) {
let ipc = vc as! UIImagePickerController
@ -35,7 +35,7 @@ class TestPromiseImagePickerController: UIKitTestCase {
// UIImagePickerController fulfills with original image if no edited image available
func test2() {
class Mock: UIViewController {
var info = [NSObject:AnyObject]()
var info = [String:AnyObject]()
override func presentViewController(vc: UIViewController, animated flag: Bool, completion: (() -> Void)?) {
let ipc = vc as! UIImagePickerController
@ -69,10 +69,10 @@ class TestPromiseImagePickerController: UIKitTestCase {
UIControl().sendAction(button.action, to: button.target, forEvent: nil)
}
})
promise.catch { _ -> Void in
promise.catch_ { _ -> Void in
XCTFail()
}
promise.catch(policy: CatchPolicy.AllErrors) { _ -> Void in
promise.catch_(policy: CatchPolicy.AllErrors) { _ -> Void in
after(0.5).then(ex.fulfill)
}
waitForExpectationsWithTimeout(10, handler: nil)
@ -87,12 +87,11 @@ class TestPromiseImagePickerController: UIKitTestCase {
let promise: Promise<UIImage> = rootvc.promiseViewController(picker, animated: false, completion: {
after(0.05).then { _ -> Promise<Void> in
let tv: UITableView = find(picker, UITableView.self)
tv.visibleCells()[1].tap()
tv.visibleCells[1].tap()
return after(1.5)
}.then { _ -> Void in
let vcs = picker.viewControllers
let cv: UICollectionView = find(picker.viewControllers[1] as! UIViewController, UICollectionView.self)
let cell = cv.visibleCells()[0] as! UICollectionViewCell
let cv: UICollectionView = find(picker.viewControllers[1], UICollectionView.self)
let cell = cv.visibleCells()[0]
cell.tap()
}
})
@ -112,12 +111,12 @@ class TestPromiseImagePickerController: UIKitTestCase {
let promise: Promise<NSData> = rootvc.promiseViewController(picker, animated: false, completion: {
after(0.05).then { _ -> Promise<Void> in
let tv: UITableView = find(picker, UITableView.self)
tv.visibleCells()[1].tap()
tv.visibleCells[1].tap()
return after(1.5)
}.then { _ -> Void in
let vcs = picker.viewControllers
let cv: UICollectionView = find(vcs[1] as! UIViewController, UICollectionView.self)
let cell = cv.visibleCells()[0] as! UICollectionViewCell
let cv: UICollectionView = find(vcs[1], UICollectionView.self)
let cell = cv.visibleCells()[0]
cell.tap()
}
})

View File

@ -20,7 +20,7 @@ class TestPromisableViewController: UIKitTestCase {
func test1a() {
let ex = expectationWithDescription("")
let p: Promise<Int> = rootvc.promiseViewController(UIViewController(), animated: false)
p.catch { err in
p.catch_ { err in
XCTAssertEqual(err.domain, PMKErrorDomain)
XCTAssertEqual(err.code, PMKInvalidUsageError)
ex.fulfill()
@ -32,7 +32,7 @@ class TestPromisableViewController: UIKitTestCase {
func test1b() {
let ex = expectationWithDescription("")
let p: Promise<Int> = rootvc.promiseViewController(MyViewController(), animated: false)
p.catch { err in
p.catch_ { err in
XCTAssertEqual(err.domain, PMKErrorDomain)
XCTAssertEqual(err.code, PMKInvalidUsageError)
ex.fulfill()
@ -46,7 +46,7 @@ class TestPromisableViewController: UIKitTestCase {
let my = MyViewController()
my.promise = Promise(true)
let p: Promise<Int> = rootvc.promiseViewController(my, animated: false)
p.catch { err in
p.catch_ { err in
XCTAssertEqual(err.domain, PMKErrorDomain)
XCTAssertEqual(err.code, PMKInvalidUsageError)
ex.fulfill()
@ -71,7 +71,7 @@ class TestPromisableViewController: UIKitTestCase {
func test2b() {
let ex = expectationWithDescription("")
let my = MyViewController()
let (promise, resolve, _) = Promise<Int>.defer()
let (promise, resolve, _) = Promise<Int>.defer_()
my.promise = promise
rootvc.promiseViewController(my, animated: false).then { (x: Int) -> Void in
XCTAssertTrue(my.appeared)
@ -121,18 +121,18 @@ class UIKitTestCase: XCTestCase {
}
func subviewsOf(v: UIView) -> [UIView] {
var vv = v.subviews as! [UIView]
for v in v.subviews as! [UIView] {
var vv = v.subviews
for v in v.subviews {
vv += subviewsOf(v)
}
return vv
}
func find<T>(vc: UIViewController, type: AnyClass) -> T! {
func find<T>(vc: UIViewController, _ type: AnyClass) -> T! {
return find(vc.view, type)
}
func find<T>(view: UIView, type: AnyClass) -> T! {
func find<T>(view: UIView, _ type: AnyClass) -> T! {
for x in subviewsOf(view) {
if x is T {
return x as! T
@ -143,11 +143,11 @@ func find<T>(view: UIView, type: AnyClass) -> T! {
extension XCTestCase {
func tester(_ file : String = __FILE__, _ line : Int = __LINE__) -> KIFUITestActor {
func tester(file : String = __FILE__, _ line : Int = __LINE__) -> KIFUITestActor {
return KIFUITestActor(inFile: file, atLine: line, delegate: self)
}
func system(_ file : String = __FILE__, _ line : Int = __LINE__) -> KIFSystemTestActor {
func system(file : String = __FILE__, _ line : Int = __LINE__) -> KIFSystemTestActor {
return KIFSystemTestActor(inFile: file, atLine: line, delegate: self)
}
}

View File

@ -42,7 +42,7 @@ class TestErrorUnhandler: XCTestCase {
PMKUnhandledErrorHandler = { err in
XCTFail()
}
promise.catch { error in
promise.catch_ { error in
ex.fulfill()
}
}
@ -100,7 +100,7 @@ class TestErrorUnhandler: XCTestCase {
XCTFail()
}.finally {
ex1.fulfill()
}.catch { err in
}.catch_ { err in
ex2.fulfill()
}
}

View File

@ -12,7 +12,7 @@ class TestPromise: XCTestCase {
Promise(1).then { _ -> AnyPromise in
return AnyPromise(bound: after(0).then{ 1 })
}.then { x -> Void in
XCTAssertEqual(x as! Int, 1)
XCTAssertEqual(x as? Int, 1)
ex.fulfill()
}
waitForExpectationsWithTimeout(1, handler: nil)
@ -23,7 +23,7 @@ class TestPromise: XCTestCase {
let ex = expectationWithDescription("")
Promise(1).then { _ -> AnyPromise in
return AnyPromise(bound: after(0).then{ Promise<Int>(error: "") })
}.catch { err -> Void in
}.catch_ { err -> Void in
ex.fulfill()
}
waitForExpectationsWithTimeout(1, handler: nil)
@ -55,7 +55,7 @@ class TestPromise: XCTestCase {
return Promise(NSError.cancelledError())
}.then { _ -> Void in
XCTFail()
}.catch { _ -> Void in
}.catch_ { _ -> Void in
XCTFail()
}
@ -79,7 +79,7 @@ class TestPromise: XCTestCase {
return Promise(err)
}.then { _ -> Void in
XCTFail()
}.catch { _ -> Void in
}.catch_ { _ -> Void in
XCTFail()
}
@ -91,7 +91,7 @@ class TestPromise: XCTestCase {
after(0).then { _ -> Promise<Int> in
return Promise(NSError.cancelledError())
}.catch(policy: .AllErrors) { _ -> Void in
}.catch_(policy: .AllErrors) { _ -> Void in
ex.fulfill()
}

View File

@ -60,7 +60,7 @@ class TestWhen: XCTestCase {
let p2 = after(0.01).then{ return Promise<Bool>(error: "Fail") }
let p3 = Promise(false)
when(p1, p2, p3).catch { _ in
when(p1, p2, p3).catch_ { _ in
e1.fulfill()
}
@ -116,7 +116,7 @@ class TestWhen: XCTestCase {
progress.resignCurrent()
promise.catch { _ in
promise.catch_ { _ in
ex2.fulfill()
}

View File

@ -3,12 +3,12 @@ import PromiseKit
func stressDataRace<T: Equatable>(e1: XCTestExpectation, iterations: Int = 1000, stressFactor: Int = 10, # stressFunction: (Promise<T>) -> Void, fulfill f: () -> T) {
func stressDataRace<T: Equatable>(e1: XCTestExpectation, iterations: Int = 1000, stressFactor: Int = 10, stressFunction: (Promise<T>) -> Void, fulfill f: () -> T) {
let group = dispatch_group_create()
let queue = dispatch_queue_create("the.domain.of.Zalgo", DISPATCH_QUEUE_CONCURRENT)
for i in 0..<iterations {
let (promise, fulfill, reject) = Promise<T>.defer()
for _ in 0..<iterations {
let (promise, fulfill, _) = Promise<T>.defer_()
dispatch_apply(stressFactor, queue) { n in
stressFunction(promise)
@ -42,7 +42,7 @@ class TestZalgo: XCTestCase {
var x = 0
let (p2, f, _) = Promise<Int>.defer()
let (p2, f, _) = Promise<Int>.defer_()
p2.then(on: zalgo) { _ in
x = 1
}

View File

@ -10,6 +10,7 @@ class App: UIResponder, UIApplicationDelegate {
window!.rootViewController = UIViewController()
window!.backgroundColor = UIColor.grayColor()
window!.makeKeyAndVisible()
UIView.setAnimationsEnabled(false)
return true
}
}

View File

@ -11,7 +11,7 @@ class Test2121: XCTestCase {
promise.then { a in
onFulfilledCalled = true
}
promise.catch { e->() in
promise.catch_ { e->() in
XCTAssertFalse(onFulfilledCalled)
ee[0].fulfill()
}
@ -23,11 +23,11 @@ class Test2121: XCTestCase {
func test2() {
var onFulfilledCalled = false
let (promise, fulfiller, rejecter) = Promise<Int>.defer()
let (promise, fulfiller, rejecter) = Promise<Int>.defer_()
promise.then{ a -> Void in
onFulfilledCalled = true
}
promise.catch{ e -> Void in
promise.catch_{ e -> Void in
XCTAssertFalse(onFulfilledCalled)
}
fulfiller(dummy)
@ -37,12 +37,12 @@ class Test2121: XCTestCase {
func test3() {
var onFulfilledCalled = false
let (promise, fulfiller, rejecter) = Promise<Int>.defer()
let (promise, fulfiller, rejecter) = Promise<Int>.defer_()
promise.then{ a->() in
onFulfilledCalled = true;
}
promise.catch{ e->() in
promise.catch_{ e->() in
XCTAssertFalse(onFulfilledCalled)
}
@ -55,12 +55,12 @@ class Test2121: XCTestCase {
func test4() {
var onFulfilledCalled = false
let (promise, fulfiller, rejecter) = Promise<Int>.defer()
let (promise, fulfiller, rejecter) = Promise<Int>.defer_()
promise.then{ a in
onFulfilledCalled = true
}
promise.catch{ e->() in
promise.catch_{ e->() in
XCTAssertFalse(onFulfilledCalled)
}
@ -88,7 +88,7 @@ var sentinel = 456
func later(block: ()->()) {
later(50, block)
}
func later(timeout: Double, block: ()->()) {
func later(timeout: Double, _ block: ()->()) {
let ticks = Double(NSEC_PER_SEC) / (timeout * 1000.0)
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(ticks)), dispatch_get_main_queue(), block)
}
@ -110,14 +110,14 @@ extension XCTestCase {
test(Promise(v1), e1, v1)
waitForExpectationsWithTimeout(1, handler: nil)
let (p2, f2, _) = Promise<Int>.defer()
let (p2, f2, _) = Promise<Int>.defer_()
let v2 = Int(rand())
let e2 = e("immediately-fulfilled")
test(p2, e2, v2)
f2(v2)
waitForExpectationsWithTimeout(1, handler: nil)
let (p3, f3, _) = Promise<Int>.defer()
let (p3, f3, _) = Promise<Int>.defer_()
let v3 = Int(rand())
let e3 = e("eventually-fulfilled")
later {
@ -140,14 +140,14 @@ extension XCTestCase {
waitForExpectationsWithTimeout(1, handler: nil)
let e2 = e("immediately-rejected")
let (p2, _, r2) = Promise<Int>.defer()
let (p2, _, r2) = Promise<Int>.defer_()
let v2 = NSError(domain:PMKErrorDomain, code:Int(rand()), userInfo:nil)
test(p2, e2, v2)
r2(v2)
waitForExpectationsWithTimeout(1, handler: nil)
let e3 = e("eventually-rejected")
let (p3, _, r3) = Promise<Int>.defer()
let (p3, _, r3) = Promise<Int>.defer_()
let v3 = NSError(domain:PMKErrorDomain, code:Int(rand()), userInfo:nil)
later {
test(p3, e3, v3)

View File

@ -12,7 +12,7 @@ class Test2131: XCTestCase {
onRejectedCalled = true
exes[0].fulfill()
}
promise.catch { e->() in
promise.catch_ { e->() in
XCTAssertFalse(onRejectedCalled)
}
later {
@ -23,11 +23,11 @@ class Test2131: XCTestCase {
func test2131_2() {
var onRejectedCalled = false
let (promise, fulfiller, rejecter) = Promise<Int>.defer()
let (promise, fulfiller, rejecter) = Promise<Int>.defer_()
promise.then{ a -> Void in
XCTAssertFalse(onRejectedCalled)
}
promise.catch{ e -> Void in
promise.catch_{ e -> Void in
onRejectedCalled = true
}
fulfiller(dummy)
@ -37,12 +37,12 @@ class Test2131: XCTestCase {
func test2131_3() {
var onRejectedCalled = false
let (promise, fulfiller, rejecter) = Promise<Int>.defer()
let (promise, fulfiller, rejecter) = Promise<Int>.defer_()
promise.then{ a->() in
XCTAssertFalse(onRejectedCalled)
}
promise.catch{ e->() in
promise.catch_{ e->() in
onRejectedCalled = true;
}
@ -55,12 +55,12 @@ class Test2131: XCTestCase {
func test2131_4() {
var onRejectedCalled = false
let (promise, fulfiller, rejecter) = Promise<Int>.defer()
let (promise, fulfiller, rejecter) = Promise<Int>.defer_()
promise.then{ a in
XCTAssertFalse(onRejectedCalled)
}
promise.catch{ e->() in
promise.catch_{ e->() in
onRejectedCalled = true
}

View File

@ -23,7 +23,7 @@ class Test222: XCTestCase {
// 2.2.2.2: it must not be called before `promise` is fulfilled
let e1 = expectationWithDescription("fulfilled after a delay")
let (p1, f1, _) = Promise<Int>.defer()
let (p1, f1, _) = Promise<Int>.defer_()
var isFulfilled = false
p1.then { _->() in
@ -38,7 +38,7 @@ class Test222: XCTestCase {
let e2 = expectationWithDescription("never fulfilled")
let (p2, f2, _) = Promise<Int>.defer()
let (p2, _, _) = Promise<Int>.defer_()
var onFulfilledCalled = false
p2.then { _->() in
@ -63,7 +63,7 @@ class Test222: XCTestCase {
func test22232() {
// trying to fulfill a pending promise more than once, immediately
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var timesCalled = 0
promise.then { _->() in
XCTAssertEqual(++timesCalled, 1)
@ -73,7 +73,7 @@ class Test222: XCTestCase {
}
func test22233() {
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var timesCalled = 0
let e1 = expectationWithDescription("trying to fulfill a pending promise more than once, delayed")
@ -89,7 +89,7 @@ class Test222: XCTestCase {
}
func test22234() {
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var timesCalled = 0
let e1 = expectationWithDescription("trying to fulfill a pending promise more than once, immediately then delayed")
@ -105,7 +105,7 @@ class Test222: XCTestCase {
}
func test22235() {
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var timesCalled = [0, 0, 0]
let desc = "when multiple `then` calls are made, spaced apart in time"
let e1 = expectationWithDescription(desc)
@ -137,7 +137,7 @@ class Test222: XCTestCase {
}
func test2224() {
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var timesCalled = [0, 0]
let e1 = expectationWithDescription("when `then` is interleaved with fulfillment")

View File

@ -9,7 +9,7 @@ class Test223: XCTestCase {
// 2.2.3.1: it must be called after `promise` is rejected,
// with `promise`s rejection reason as its first argument
suiteRejected(1) { (promise, exes, memo) -> () in
promise.catch { error->() in
promise.catch_ { error->() in
XCTAssertEqual(error, memo)
return exes[0].fulfill()
}
@ -21,10 +21,10 @@ class Test223: XCTestCase {
// 2.2.3.2: it must not be called before `promise` is fulfilled
let expectation = expectationWithDescription("rejected after a delay")
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var isRejected = false
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertTrue(isRejected)
expectation.fulfill()
}
@ -37,10 +37,10 @@ class Test223: XCTestCase {
func test22322() {
let expectation = expectationWithDescription("never rejected")
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, _) = Promise<Int>.defer_()
var onRejectedCalled = false
promise.catch { _->() in
promise.catch_ { _->() in
onRejectedCalled = true
expectation.fulfill()
}
@ -55,16 +55,16 @@ class Test223: XCTestCase {
// 2.2.3.3: it must not be called more than once.
// already-rejected
var timesCalled = 0
Promise(dammy).catch { _ in
Promise(dammy).catch_ { _ in
XCTAssertEqual(++timesCalled, 1)
}
}
func test22332() {
// trying to reject a pending promise more than once, immediately
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var timesCalled = 0
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled, 1)
}
rejecter(dammy)
@ -72,11 +72,11 @@ class Test223: XCTestCase {
}
func test22333() {
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var timesCalled = 0
let expectation = expectationWithDescription("trying to reject a pending promise more than once, delayed")
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled, 1)
expectation.fulfill()
}
@ -88,11 +88,11 @@ class Test223: XCTestCase {
}
func test22334() {
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var timesCalled = 0
let expectation = expectationWithDescription("trying to fulfill a pending promise more than once, immediately then delayed")
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled, 1)
expectation.fulfill()
}
@ -104,26 +104,26 @@ class Test223: XCTestCase {
}
func test22335() {
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var timesCalled = [0, 0, 0]
let desc = "when multiple `then` calls are made, spaced apart in time"
let e1 = expectationWithDescription(desc)
let e2 = expectationWithDescription(desc)
let e3 = expectationWithDescription(desc)
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled[0], 1)
e1.fulfill()
}
later(50.0) {
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled[1], 1)
e2.fulfill()
}
return
}
later(100.0) {
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled[2], 1)
e3.fulfill()
}
@ -136,17 +136,17 @@ class Test223: XCTestCase {
}
func test2234() {
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var timesCalled = [0, 0]
let expectation = expectationWithDescription("when `then` is interleaved with fulfillment")
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled[0], 1)
}
rejecter(dammy)
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssertEqual(++timesCalled[1], 1)
expectation.fulfill()
}

View File

@ -20,7 +20,7 @@ class Test224: XCTestCase {
}
suiteRejected(1) { (promise, exes, memo)->() in
var catchHasReturned = false
promise.catch { _->() in
promise.catch_ { _->() in
XCTAssert(catchHasReturned)
exes[0].fulfill()
}
@ -32,7 +32,7 @@ class Test224: XCTestCase {
func test2242_1() {
// when `onFulfilled` is added immediately before the promise is fulfilled
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var onFulfilledCalled = false
fulfiller(dummy)
@ -61,14 +61,13 @@ class Test224: XCTestCase {
func test2242_3() {
// when `onFulfilled` is added inside an `onRejected`
let err = NSError(domain: "a", code: 1, userInfo: nil)
let resolved = Promise(dummy)
let rejected = Promise<Int>(dammy)
var firstOnRejectedFinished = false
let ex = expectationWithDescription("")
rejected.catch { _->() in
rejected.catch_ { _->() in
resolved.then { _->() in
XCTAssert(firstOnRejectedFinished)
ex.fulfill()
@ -81,7 +80,7 @@ class Test224: XCTestCase {
func test2242_4() {
// when the promise is fulfilled asynchronously
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
var firstStackFinished = false
let ex = expectationWithDescription("")
later {
@ -99,9 +98,9 @@ class Test224: XCTestCase {
func test2243() {
// when `onRejected` is added immediately before the promise is rejected
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var onRejectedCalled = false
promise.catch{ _->() in
promise.catch_{ _->() in
onRejectedCalled = true
}
rejecter(dammy)
@ -110,10 +109,10 @@ class Test224: XCTestCase {
func test2244() {
// when `onRejected` is added immediately after the promise is rejected
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var onRejectedCalled = false
rejecter(dammy)
promise.catch{ _->() in
promise.catch_{ _->() in
onRejectedCalled = true
}
XCTAssertFalse(onRejectedCalled)
@ -127,7 +126,7 @@ class Test224: XCTestCase {
let ex = expectationWithDescription("")
resolved.then{ _->() in
rejected.catch{ _->() in
rejected.catch_{ _->() in
XCTAssert(firstOnFulfilledFinished)
ex.fulfill()
}
@ -142,8 +141,8 @@ class Test224: XCTestCase {
var firstOnRejectedFinished = false
let ex = expectationWithDescription("")
promise.catch{ _->() in
promise.catch{ _->() in
promise.catch_{ _->() in
promise.catch_{ _->() in
XCTAssertTrue(firstOnRejectedFinished)
ex.fulfill()
}
@ -154,7 +153,7 @@ class Test224: XCTestCase {
func test2247() {
// when the promise is rejected asynchronously
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
var firstStackFinished = false
let ex = expectationWithDescription("")
@ -163,7 +162,7 @@ class Test224: XCTestCase {
firstStackFinished = true
}
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssert(firstStackFinished)
ex.fulfill()
}

View File

@ -75,7 +75,7 @@ class Test226: XCTestCase {
promise.then{ _ -> Promise<Int> in
return Promise(NSError(domain:PMKErrorDomain, code:sentinel2, userInfo:nil))
}.catch { err in
}.catch_ { err in
XCTAssertEqual(err.code, sentinel2)
exes[1].fulfill()
}
@ -135,19 +135,19 @@ class Test226: XCTestCase {
suiteRejected(4){ (promise, exes, sentinel) -> () in
var x = 0
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(++x, 1)
exes[0].fulfill()
}
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(++x, 2)
exes[1].fulfill()
}
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(++x, 3)
exes[2].fulfill()
}
promise.catch{ (err:NSError)->() in
promise.catch_{ (err:NSError)->() in
XCTAssertEqual(err, sentinel)
XCTAssertEqual(x, 3)
exes[3].fulfill()
@ -161,12 +161,12 @@ class Test226: XCTestCase {
suiteRejected(1) { (promise, ee, sentinel) in
let blah = NSError(domain:PMKErrorDomain, code:923764, userInfo:nil)
var x = 0
promise.catch{ err->() in
promise.catch_{ err->() in
XCTAssertEqual(err, sentinel)
XCTAssertEqual(++x, 1)
return
}
promise.catch{ err->() in
promise.catch_{ err->() in
XCTAssertEqual(err, sentinel)
XCTAssertEqual(++x, 2)
return
@ -176,7 +176,7 @@ class Test226: XCTestCase {
XCTAssertEqual(++x, 3)
return Promise(blah)
}
promise.catch{ err->() in
promise.catch_{ err->() in
XCTAssertEqual(err, sentinel)
XCTAssertEqual(x, 3)
ee[0].fulfill()
@ -202,7 +202,7 @@ class Test226: XCTestCase {
promise.recover{ _ -> Promise<Int> in
return Promise(NSError(domain: PMKErrorDomain, code: sentinel2, userInfo: nil))
}.catch { err in
}.catch_ { err in
XCTAssertEqual(err.code, sentinel2)
exes[1].fulfill()
}
@ -222,15 +222,15 @@ class Test226: XCTestCase {
suiteRejected(3) { (promise, exes, memo) in
var x = 0
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(x++, 0)
exes[0].fulfill()
}
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(x++, 1)
exes[1].fulfill()
}
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(x++, 2)
exes[2].fulfill()
}
@ -241,15 +241,15 @@ class Test226: XCTestCase {
// even when one handler is added inside another handler
suiteRejected(3) { (promise, exes, memo) in
var x = 0
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(x++, 0)
exes[0].fulfill()
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(x++, 2)
exes[1].fulfill()
}
}
promise.catch{ _->() in
promise.catch_{ _->() in
XCTAssertEqual(x++, 1)
exes[2].fulfill()
}

View File

@ -26,7 +26,7 @@ class Test232: XCTestCase {
// 2.3.2.1: If `x` is pending, `promise` must remain pending until `x` is fulfilled or rejected.
testPromiseResolution({
return Promise<Int>.defer().promise
return Promise<Int>.defer_().promise
}, test: { promise in
let ex = self.expectationWithDescription("")
var wasFulfilled = false
@ -35,7 +35,7 @@ class Test232: XCTestCase {
promise.then { foo in
wasFulfilled = true
}
promise.catch { foo in
promise.catch_ { foo in
wasRejected = true
}
later(100){
@ -69,7 +69,7 @@ class Test232: XCTestCase {
// `x` is eventually-fulfilled
testPromiseResolution({
let (promise, fulfiller, _) = Promise<Int>.defer()
let (promise, fulfiller, _) = Promise<Int>.defer_()
later { fulfiller(sentinel) }
return promise
}, test: { promise in
@ -90,7 +90,7 @@ class Test232: XCTestCase {
return Promise(dammy)
}, test: { promise in
let ex = self.expectationWithDescription("")
promise.catch{ error->Void in
promise.catch_{ error->Void in
XCTAssertEqual(error, dammy)
ex.fulfill()
}
@ -100,12 +100,12 @@ class Test232: XCTestCase {
func test2323_2() {
// `x` is eventually-rejected
testPromiseResolution({
let (promise, _, rejecter) = Promise<Int>.defer()
let (promise, _, rejecter) = Promise<Int>.defer_()
later { rejecter(dammy) }
return promise
}, test: { promise in
let ex = self.expectationWithDescription("")
promise.catch{ error->Void in
promise.catch_{ error->Void in
XCTAssertEqual(error, dammy)
ex.fulfill()
}

View File

@ -13,7 +13,7 @@ class Test233: XCTestCase {
//
// // via return from a rejected promise
// let e2 = expectationWithDescription("")
// var p2 = Promise(error:dammy).catch { _->Promise<Int> in
// var p2 = Promise(error:dammy).catch_ { _->Promise<Int> in
// return xFactory()
// }
// test(p2, e2)

View File

@ -7,6 +7,7 @@ class TestPromiseBridge: XCTestCase {
func testCanBridgeSwiftArray() {
let p = Promise([NSString(),NSString(),NSString()])
let ap = AnyPromise(bound: p)
XCTAssertGreaterThan(ap.description.characters.count, 0)
// no test since we'd need to write objc, but also
// mainly we are just testing the above compiles
@ -15,6 +16,7 @@ class TestPromiseBridge: XCTestCase {
func testCanBridgeSwiftDictionary() {
let p = Promise([NSString():NSString()])
let ap = AnyPromise(bound: p)
XCTAssertGreaterThan(ap.description.characters.count, 0)
// no test since we'd need to write objc, but also
// mainly we are just testing the above compiles