Compare commits
13 Commits
fix-NSErro
...
swift-2.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0808da4cf0 | ||
|
|
205a3dd150 | ||
|
|
16d6889f59 | ||
|
|
d3d4dda765 | ||
|
|
a92ed7e31f | ||
|
|
0d0ea895c7 | ||
|
|
3982576003 | ||
|
|
6cecb1b94f | ||
|
|
8e2edca821 | ||
|
|
ab0cac391f | ||
|
|
46e227bcb2 | ||
|
|
cc503ae873 | ||
|
|
de740a37f5 |
11
.travis.yml
11
.travis.yml
@ -2,11 +2,11 @@ language: objective-c
|
||||
xcode_project: PromiseKit.xcodeproj
|
||||
xcode_scheme: [PMKiOS, PMKOSX]
|
||||
xcode_sdk: [iphonesimulator9.3, macosx10.11]
|
||||
osx_image: xcode7.3
|
||||
osx_image: xcode8
|
||||
|
||||
install:
|
||||
- "gem install travis-xcodebuild"
|
||||
- "carthage bootstrap --platform Mac,iOS"
|
||||
- "TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 carthage bootstrap --platform Mac,iOS --no-use-binaries"
|
||||
|
||||
script:
|
||||
- travis-xcodebuild
|
||||
@ -18,12 +18,5 @@ matrix:
|
||||
- xcode_scheme: PMKiOS
|
||||
xcode_sdk: macosx10.11
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- swift-2.2-minimal-changes
|
||||
- swift-2.0-minimal-changes
|
||||
- legacy-1.x
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
@ -31,14 +31,14 @@ extension UIActionSheet {
|
||||
|
||||
return proxy.promise
|
||||
}
|
||||
}
|
||||
|
||||
public enum Error: CancellableErrorType {
|
||||
case Cancelled
|
||||
public enum UIActionSheetError: CancellableErrorType {
|
||||
case Cancelled
|
||||
|
||||
public var cancelled: Bool {
|
||||
switch self {
|
||||
case .Cancelled: return true
|
||||
}
|
||||
public var cancelled: Bool {
|
||||
switch self {
|
||||
case .Cancelled: return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,7 @@ private class PMKActionSheetDelegate: NSObject, UIActionSheetDelegate {
|
||||
if buttonIndex != actionSheet.cancelButtonIndex {
|
||||
fulfill(buttonIndex)
|
||||
} else {
|
||||
reject(UIActionSheet.Error.Cancelled)
|
||||
reject(UIActionSheetError.Cancelled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,14 +32,14 @@ extension UIAlertView {
|
||||
|
||||
return proxy.promise
|
||||
}
|
||||
}
|
||||
|
||||
public enum Error: CancellableErrorType {
|
||||
case Cancelled
|
||||
public enum UIAlertViewError: CancellableErrorType {
|
||||
case Cancelled
|
||||
|
||||
public var cancelled: Bool {
|
||||
switch self {
|
||||
case .Cancelled: return true
|
||||
}
|
||||
public var cancelled: Bool {
|
||||
switch self {
|
||||
case .Cancelled: return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,7 +52,7 @@ private class PMKAlertViewDelegate: NSObject, UIAlertViewDelegate {
|
||||
if buttonIndex != alertView.cancelButtonIndex {
|
||||
fulfill(buttonIndex)
|
||||
} else {
|
||||
reject(UIAlertView.Error.Cancelled)
|
||||
reject(UIAlertViewError.Cancelled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ import PromiseKit
|
||||
*/
|
||||
extension UIViewController {
|
||||
|
||||
public enum Error: ErrorType {
|
||||
public enum PMKError: ErrorType {
|
||||
case NavigationControllerEmpty
|
||||
case NoImageFound
|
||||
case NotPromisable
|
||||
@ -45,7 +45,7 @@ extension UIViewController {
|
||||
|
||||
switch vc {
|
||||
case let nc as UINavigationController:
|
||||
guard let vc = nc.viewControllers.first else { return Promise(error: Error.NavigationControllerEmpty) }
|
||||
guard let vc = nc.viewControllers.first else { return Promise(error: PMKError.NavigationControllerEmpty) }
|
||||
pvc = vc
|
||||
default:
|
||||
pvc = vc
|
||||
@ -54,13 +54,13 @@ extension UIViewController {
|
||||
let promise: Promise<T>
|
||||
|
||||
if !pvc.conformsToProtocol(Promisable) {
|
||||
promise = Promise(error: UIViewController.Error.NotPromisable)
|
||||
promise = Promise(error: PMKError.NotPromisable)
|
||||
} else if let p = pvc.valueForKeyPath("promise") as? Promise<T> {
|
||||
promise = p
|
||||
} else if let _: AnyObject = pvc.valueForKeyPath("promise") {
|
||||
promise = Promise(error: UIViewController.Error.NotGenericallyPromisable)
|
||||
promise = Promise(error: PMKError.NotGenericallyPromisable)
|
||||
} else {
|
||||
promise = Promise(error: UIViewController.Error.NilPromisable)
|
||||
promise = Promise(error: PMKError.NilPromisable)
|
||||
}
|
||||
|
||||
if !promise.pending {
|
||||
@ -105,7 +105,7 @@ extension UIViewController {
|
||||
if let img = info[UIImagePickerControllerOriginalImage] as? UIImage {
|
||||
return img
|
||||
}
|
||||
throw Error.NoImageFound
|
||||
throw PMKError.NoImageFound
|
||||
}.always {
|
||||
vc.presentingViewController?.dismissViewControllerAnimated(animated, completion: nil)
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ Pod::Spec.new do |s|
|
||||
ss.ios.source_files = 'Categories/Social/*'
|
||||
ss.osx.source_files = Dir['Categories/Social/*'] - ['Categories/Social/SLComposeViewController+Promise.swift']
|
||||
ss.dependency 'PromiseKit/CorePromise'
|
||||
ss.frameworks = 'Social'
|
||||
ss.ios.frameworks = ss.osx.frameworks = 'Social'
|
||||
end
|
||||
|
||||
s.subspec 'StoreKit' do |ss|
|
||||
|
||||
@ -2191,6 +2191,7 @@
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -2213,6 +2214,7 @@
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -2273,7 +2275,7 @@
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3.5.1;
|
||||
CURRENT_PROJECT_VERSION = 3.5.3;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
@ -2328,7 +2330,7 @@
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3.5.1;
|
||||
CURRENT_PROJECT_VERSION = 3.5.3;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSError.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import "AnyPromise+Private.h"
|
||||
#import "NSMethodSignatureForBlock.m"
|
||||
#import <PromiseKit/Umbrella.h>
|
||||
#import <PromiseKit/PromiseKit.h>
|
||||
|
||||
@ -30,8 +30,8 @@ class Test_UIActionSheet_Swift: UIKitTestCase {
|
||||
sheet.addButtonWithTitle("1")
|
||||
sheet.cancelButtonIndex = sheet.addButtonWithTitle("2")
|
||||
sheet.promiseInView(rootvc.view).error(policy: .AllErrors) { err in
|
||||
guard let err = err as? UIActionSheet.Error else { return XCTFail() }
|
||||
XCTAssertTrue(err == UIActionSheet.Error.Cancelled)
|
||||
guard let err = err as? UIActionSheetError else { return XCTFail() }
|
||||
XCTAssertTrue(err == UIActionSheetError.Cancelled)
|
||||
XCTAssertTrue(err.cancelled)
|
||||
ex.fulfill()
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ class Test_UIAlertView_Swift: UIKitTestCase {
|
||||
alert.addButtonWithTitle("1")
|
||||
alert.cancelButtonIndex = alert.addButtonWithTitle("2")
|
||||
alert.promise().error(policy: .AllErrors) { err in
|
||||
guard let err = err as? UIAlertView.Error else { return XCTFail() }
|
||||
guard let err = err as? UIAlertViewError else { return XCTFail() }
|
||||
XCTAssertTrue(err == .Cancelled)
|
||||
XCTAssertTrue(err.cancelled)
|
||||
ex.fulfill()
|
||||
|
||||
@ -11,7 +11,7 @@ class Test_UIViewController_Swift: UIKitTestCase {
|
||||
let ex = expectationWithDescription("")
|
||||
let p: Promise<Int> = rootvc.promiseViewController(UIViewController(), animate: [])
|
||||
p.error { error in
|
||||
if case UIViewController.Error.NotPromisable = error {
|
||||
if case UIViewController.PMKError.NotPromisable = error {
|
||||
ex.fulfill()
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,7 @@ class Test_UIViewController_Swift: UIKitTestCase {
|
||||
let ex = expectationWithDescription("")
|
||||
let p: Promise<Int> = rootvc.promiseViewController(MockViewController(), animate: [])
|
||||
p.error { error in
|
||||
if case UIViewController.Error.NilPromisable = error {
|
||||
if case UIViewController.PMKError.NilPromisable = error {
|
||||
ex.fulfill()
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ class Test_UIViewController_Swift: UIKitTestCase {
|
||||
my.promise = Promise(true)
|
||||
let p: Promise<Int> = rootvc.promiseViewController(my, animate: [])
|
||||
p.error { err in
|
||||
if case UIViewController.Error.NotGenericallyPromisable = err {
|
||||
if case UIViewController.PMKError.NotGenericallyPromisable = err {
|
||||
ex.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user