This is old documentation, use with caution

Cocoa+Promise

We provide wrappers for almost all the asynchronous functionality provided by Apple. For example:

CLLocationManager.promise().then { location in
    // pod "PromiseKit/CoreLocation"
}

MKDirections(/*…*/).calculate().then { directionsResponse in
    // pod "PromiseKit/MapKit"
}

URLSession.shared.POST(url, formData: params).asDictionary().then { json in
    // pod "PromiseKit/OMGHTTPURLRQ"
}

Alamofire.request(url, withMethod: .GET).responseJSON().then { json in
    // pod "PromiseKit/Alamofire"
}

CKContainer.publicCloudDatabase.fetchUserRecord().then { user in
    // pod "PromiseKit/CloudKit"
}

promiseViewController(UIImagePickerController()).then { image in
    // pod "PromiseKit/UIKit"
    // --> included in the default "PromiseKit" pod
}

NSNotificationCenter.default.observe(once: notificationName).then { obj in
    // pod "PromiseKit/Foundation"
    // --> included in the default "PromiseKit" pod
}

Above is just a small sampling; view our full extensions listing on GitHub.


For convenience, we also provide:

In addition, PromiseKit is designed so that promises can be provided by other third-party libraries: CocoaPods that use PromiseKit.