Skip to content

Commit

Permalink
Merge pull request #22 from Oni-zerone/feature/refactor-Promise-resolver
Browse files Browse the repository at this point in the history
Feat: Update PunkAPI+PromiseKit
  • Loading branch information
Oni-zerone committed May 18, 2019
2 parents a1e4d36 + 97e9acf commit ec81134
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 21 deletions.
16 changes: 8 additions & 8 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- PromiseKit (6.8.3):
- PromiseKit/CorePromise (= 6.8.3)
- PromiseKit/Foundation (= 6.8.3)
- PromiseKit/UIKit (= 6.8.3)
- PromiseKit/CorePromise (6.8.3)
- PromiseKit/Foundation (6.8.3):
- PromiseKit (6.8.4):
- PromiseKit/CorePromise (= 6.8.4)
- PromiseKit/Foundation (= 6.8.4)
- PromiseKit/UIKit (= 6.8.4)
- PromiseKit/CorePromise (6.8.4)
- PromiseKit/Foundation (6.8.4):
- PromiseKit/CorePromise
- PromiseKit/UIKit (6.8.3):
- PromiseKit/UIKit (6.8.4):
- PromiseKit/CorePromise
- PunkAPI (0.3.0):
- PunkAPI/API (= 0.3.0)
Expand All @@ -28,7 +28,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
PromiseKit: 94c6e781838c5bf4717677d0d882b0e7250c80fc
PromiseKit: 51794a832647e7b819336dc2279039ce9f1cc49b
PunkAPI: e24ccc2530e6a2aefe5a09db66c24e11612c6a6c

PODFILE CHECKSUM: 140a1cf5c3e09e71ebdc08b298d32d1373675b44
Expand Down
16 changes: 8 additions & 8 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Example/PunkAPI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PunkAPI_Example" */;
buildPhases = (
44318C15D7E57EAD731D7620 /* [CP] Check Pods Manifest.lock */,
978C6517228F2C7600D95276 /* Clear Pod Cache */,
9767CC15222AC06A00E684C4 /* SwiftLint */,
9767CBEB2219750F00E684C4 /* ShellScript */,
607FACCC1AFB9204008FA782 /* Sources */,
Expand Down Expand Up @@ -387,6 +388,24 @@
shellPath = /bin/sh;
shellScript = "export PATH=\"/usr/local/bin:$PATH\"\nexport LANG=en_US.UTF-8\n\nif which swiftlint >/dev/null; then\n\nif [ \"$CI\" == true ]; then\necho swiftlint lint --strict\nelse\necho swiftlint\nfi\n\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n\n";
};
978C6517228F2C7600D95276 /* Clear Pod Cache */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Clear Pod Cache";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Xcode 10 Fix Developing Pod Libs\n# Run script phase before the \"Embed Pods Frameworks\nfind \"${SRCROOT}/Pods\" -type f -name *frameworks.sh -exec bash -c \"touch \\\"{}\\\"\" \\;\n";
};
E502466B5504391CFC64510C /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
8 changes: 3 additions & 5 deletions PunkAPI/PromiseKit/Classes/PunkAPI+PromiseKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ public extension PunkAPI {
fileprivate func perform(_ request: Request, resolver: Resolver<[Beer]>) {

self.get(request) { result in
switch result {
case let .success(beers):
resolver.fulfill(beers)

case let .failure(error):
do {
resolver.fulfill(try result.get())
} catch let error {
resolver.reject(error)
}
}
Expand Down

0 comments on commit ec81134

Please sign in to comment.