to swift 5

This commit is contained in:
yume190 2019-06-21 15:40:22 +08:00
parent 168d75094f
commit f84cc7e173
4 changed files with 25 additions and 41 deletions

2
.gitignore vendored
View File

@ -137,3 +137,5 @@ fastlane/screenshots
/*.gcno
# End of https://www.gitignore.io/api/macos,xcode,swift,carthage,fastlane,cocoapods
.build/

View File

@ -5,19 +5,19 @@ import protocol RxSwift.Disposable
import Alamofire
extension Entryable {
var rxData: Observable<Response<Data>> {
public var rxData: Observable<Response<Data>> {
return Observable.create { observer -> Disposable in
self.dataRequest
.validate()
.responseData { (res) in
switch res.result {
case .success:
guard let data = res.data else {
observer.onError(res.error ?? NetError.unknown)
return
}
let result = Response<Data>(
data: data,
request: res.request!,
@ -28,7 +28,7 @@ extension Entryable {
observer.onError(error)
}
}
return Disposables.create {
self.dataRequest.cancel()
}

View File

@ -14,8 +14,8 @@ Pod::Spec.new do |s|
# s.tvos.deployment_target = '9.0'
# s.watchos.deployment_target = '2.0'
s.default_subspec = "Core"
s.swift_version = '4.2'
s.static_framework = true
s.swift_version = '5.0'
# s.static_framework = true
s.subspec "Core" do |ss|
ss.source_files = [
@ -26,7 +26,7 @@ Pod::Spec.new do |s|
]
#"Sources/Moya/", "Sources/Moya/Plugins/"
ss.dependency "Alamofire", "~> 4.8.0"
ss.dependency "JSONDecodeKit", "~> 4.1.0"
ss.dependency "JSONDecodeKit", "~> 5.0"
ss.framework = "Foundation"
end

View File

@ -21,10 +21,8 @@
A82B496321BF872E0033253B /* Entryable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495521BF872E0033253B /* Entryable.swift */; };
A82B496421BF872E0033253B /* Entryable+JSONDecodeKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495621BF872E0033253B /* Entryable+JSONDecodeKit.swift */; };
A82B496521BF872E0033253B /* Entryable+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495721BF872E0033253B /* Entryable+Codable.swift */; };
A82B496621BF872E0033253B /* Entryable+Prmoise.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495821BF872E0033253B /* Entryable+Prmoise.swift */; };
A82B496721BF872E0033253B /* NetError.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495A21BF872E0033253B /* NetError.swift */; };
A82B496821BF872E0033253B /* Codable+Ex.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495C21BF872E0033253B /* Codable+Ex.swift */; };
A82B496921BF872E0033253B /* Promise+Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495D21BF872E0033253B /* Promise+Await.swift */; };
A82B496A21BF872E0033253B /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495E21BF872E0033253B /* Response.swift */; };
A82B496B21BF872E0033253B /* ParameterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B495F21BF872E0033253B /* ParameterType.swift */; };
A82B496C21BF872E0033253B /* YumeAlamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B496021BF872E0033253B /* YumeAlamofire.swift */; };
@ -36,8 +34,9 @@
A83E4BD820C8DD3C00F27CE5 /* PromiseKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A83E4BD420C8DD1300F27CE5 /* PromiseKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A83E4BDA20C8DD5C00F27CE5 /* JSONDecodeKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A83E4BD920C8DD5C00F27CE5 /* JSONDecodeKit.framework */; };
A83E4BDB20C8DD6500F27CE5 /* JSONDecodeKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A83E4BD920C8DD5C00F27CE5 /* JSONDecodeKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A8B0E979224B26EF00B34753 /* Entryable+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8B0E978224B26EF00B34753 /* Entryable+Rx.swift */; };
A8B0E97B224B2A2200B34753 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A8B0E97A224B2A2200B34753 /* RxSwift.framework */; };
A8B0E97E224B3E8200B34753 /* Rx in Resources */ = {isa = PBXBuildFile; fileRef = A8B0E97C224B3E8200B34753 /* Rx */; };
A8B0E97F224B3E8200B34753 /* Await in Resources */ = {isa = PBXBuildFile; fileRef = A8B0E97D224B3E8200B34753 /* Await */; };
A8F40FE81FF3809B000F01E5 /* YumeAlamofire.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F40FE61FF3809B000F01E5 /* YumeAlamofire.h */; settings = {ATTRIBUTES = (Public, ); }; };
A8F40FFB1FF38558000F01E5 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A8F40FF91FF38558000F01E5 /* Alamofire.framework */; };
/* End PBXBuildFile section */
@ -89,10 +88,8 @@
A82B495521BF872E0033253B /* Entryable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entryable.swift; sourceTree = "<group>"; };
A82B495621BF872E0033253B /* Entryable+JSONDecodeKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Entryable+JSONDecodeKit.swift"; sourceTree = "<group>"; };
A82B495721BF872E0033253B /* Entryable+Codable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Entryable+Codable.swift"; sourceTree = "<group>"; };
A82B495821BF872E0033253B /* Entryable+Prmoise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Entryable+Prmoise.swift"; sourceTree = "<group>"; };
A82B495A21BF872E0033253B /* NetError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetError.swift; sourceTree = "<group>"; };
A82B495C21BF872E0033253B /* Codable+Ex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Codable+Ex.swift"; sourceTree = "<group>"; };
A82B495D21BF872E0033253B /* Promise+Await.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Promise+Await.swift"; sourceTree = "<group>"; };
A82B495E21BF872E0033253B /* Response.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Sources/YumeAlamofire/Response.swift; sourceTree = SOURCE_ROOT; };
A82B495F21BF872E0033253B /* ParameterType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ParameterType.swift; path = Sources/YumeAlamofire/ParameterType.swift; sourceTree = SOURCE_ROOT; };
A82B496021BF872E0033253B /* YumeAlamofire.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YumeAlamofire.swift; path = Sources/YumeAlamofire/YumeAlamofire.swift; sourceTree = SOURCE_ROOT; };
@ -101,8 +98,10 @@
A83E4BD320C8DD1300F27CE5 /* AwaitKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AwaitKit.framework; path = Carthage/Build/iOS/AwaitKit.framework; sourceTree = "<group>"; };
A83E4BD420C8DD1300F27CE5 /* PromiseKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PromiseKit.framework; path = Carthage/Build/iOS/PromiseKit.framework; sourceTree = "<group>"; };
A83E4BD920C8DD5C00F27CE5 /* JSONDecodeKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JSONDecodeKit.framework; path = Carthage/Build/iOS/JSONDecodeKit.framework; sourceTree = "<group>"; };
A8B0E978224B26EF00B34753 /* Entryable+Rx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Entryable+Rx.swift"; sourceTree = "<group>"; };
A877868C22BC7B6C00771158 /* YumeAlamofire.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = YumeAlamofire.podspec; sourceTree = "<group>"; };
A8B0E97A224B2A2200B34753 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = "<group>"; };
A8B0E97C224B3E8200B34753 /* Rx */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Rx; path = Sources/Rx; sourceTree = SOURCE_ROOT; };
A8B0E97D224B3E8200B34753 /* Await */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Await; path = Sources/Await; sourceTree = SOURCE_ROOT; };
A8F40FE41FF3809B000F01E5 /* YumeAlamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YumeAlamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A8F40FE61FF3809B000F01E5 /* YumeAlamofire.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YumeAlamofire.h; sourceTree = "<group>"; };
A8F40FE71FF3809B000F01E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -156,8 +155,8 @@
A8281FA420737C9B00725A91 /* Lib */ = {
isa = PBXGroup;
children = (
A8B0E977224B26D000B34753 /* Rx */,
A8B0E976224B26A800B34753 /* Promise */,
A8B0E97D224B3E8200B34753 /* Await */,
A8B0E97C224B3E8200B34753 /* Rx */,
A82B495421BF872E0033253B /* Entry */,
A82B495921BF872E0033253B /* Error */,
A82B495B21BF872E0033253B /* Misc */,
@ -211,26 +210,10 @@
path = Sources/YumeAlamofire/Misc;
sourceTree = SOURCE_ROOT;
};
A8B0E976224B26A800B34753 /* Promise */ = {
isa = PBXGroup;
children = (
A82B495821BF872E0033253B /* Entryable+Prmoise.swift */,
A82B495D21BF872E0033253B /* Promise+Await.swift */,
);
path = Promise;
sourceTree = "<group>";
};
A8B0E977224B26D000B34753 /* Rx */ = {
isa = PBXGroup;
children = (
A8B0E978224B26EF00B34753 /* Entryable+Rx.swift */,
);
path = Rx;
sourceTree = "<group>";
};
A8F40FC11FF38068000F01E5 = {
isa = PBXGroup;
children = (
A877868C22BC7B6C00771158 /* YumeAlamofire.podspec */,
A8F40FE51FF3809B000F01E5 /* YumeAlamofire */,
A8051EC5200718520010EEE7 /* YumeAlamofireTests */,
A82B493C21BF823D0033253B /* JSONMock */,
@ -417,6 +400,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A8B0E97E224B3E8200B34753 /* Rx in Resources */,
A8B0E97F224B3E8200B34753 /* Await in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -486,15 +471,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A82B496921BF872E0033253B /* Promise+Await.swift in Sources */,
A82B496321BF872E0033253B /* Entryable.swift in Sources */,
A82B496421BF872E0033253B /* Entryable+JSONDecodeKit.swift in Sources */,
A82B496C21BF872E0033253B /* YumeAlamofire.swift in Sources */,
A82B496721BF872E0033253B /* NetError.swift in Sources */,
A82B496B21BF872E0033253B /* ParameterType.swift in Sources */,
A82B496521BF872E0033253B /* Entryable+Codable.swift in Sources */,
A8B0E979224B26EF00B34753 /* Entryable+Rx.swift in Sources */,
A82B496621BF872E0033253B /* Entryable+Prmoise.swift in Sources */,
A82B496A21BF872E0033253B /* Response.swift in Sources */,
A82B496821BF872E0033253B /* Codable+Ex.swift in Sources */,
);
@ -533,7 +515,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -555,7 +537,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@ -585,7 +567,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@ -615,7 +597,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@ -759,7 +741,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@ -791,7 +773,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";