├── .gitignore ├── src ├── Podfile ├── MoyaPromise │ ├── MoyaPromise.h │ ├── Info.plist │ ├── Serialization.swift │ ├── RequestPolicy.swift │ ├── Protocols.swift │ ├── SampleDataService.swift │ ├── Plugins.swift │ ├── MoyaProvider+Promise.swift │ ├── DataServiceExtensions.swift │ └── DataService + Default.swift ├── MoyaPromiseTests │ ├── Info.plist │ └── MoyaPromiseTests.swift ├── Podfile.lock └── MoyaPromise.xcodeproj │ └── project.pbxproj ├── Example └── MoyaPromiseExample │ ├── Podfile │ ├── Examples │ ├── CustomCarService │ │ ├── CustomCarService.swift │ │ ├── CustomOAuthCarTarget.swift │ │ └── CustomDataService.swift │ ├── CarService │ │ ├── CarAPI.swift │ │ └── CarDataService.swift │ └── SSLPinningService │ │ └── SomeSSLPinningDataService.swift │ ├── MoyaPromiseExample │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── AppDelegate.swift │ └── ViewController.swift │ └── MoyaPromiseExample.xcodeproj │ └── project.pbxproj ├── MoyaPromise.podspec ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Example/MoyaPromiseExample/Pods 2 | src/Pods 3 | Podfile.lock 4 | MoyaPromise 5 | -------------------------------------------------------------------------------- /src/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'MoyaPromise' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for MoyaPromise 9 | pod “Alamofire” 10 | pod “PromiseKit/Alamofire” 11 | pod “PromiseKit” 12 | pod “Moya” 13 | 14 | target 'MoyaPromiseTests' do 15 | inherit! :search_paths 16 | # Pods for testing 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'MoyaPromiseExample' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | source 'https://github.com/CocoaPods/Specs.git' 8 | source 'https://github.com/Can-Sahin/MoyaPromise' 9 | pod “MoyaPromise” 10 | # pod "Alamofire" 11 | # pod "PromiseKit/Alamofire" 12 | # pod "PromiseKit" 13 | # pod "Moya" 14 | end 15 | -------------------------------------------------------------------------------- /src/MoyaPromise/MoyaPromise.h: -------------------------------------------------------------------------------- 1 | // 2 | // MoyaPromise.h 3 | // MoyaPromise 4 | // 5 | // Created by Can Sahin on 09/03/2018. 6 | // Copyright © 2018 Can Sahin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for MoyaPromise. 12 | FOUNDATION_EXPORT double MoyaPromiseVersionNumber; 13 | 14 | //! Project version string for MoyaPromise. 15 | FOUNDATION_EXPORT const unsigned char MoyaPromiseVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Examples/CustomCarService/CustomCarService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomCarService.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Alamofire 11 | import PromiseKit 12 | import Moya 13 | import MoyaPromise 14 | 15 | 16 | // An example for a customized data service. 17 | public class CustomCarDataService: CustomDataService{ 18 | 19 | public func getCar(_ id:String) -> Promise { 20 | return self.request(target: CarAPI.Car(id).wrap()).asString().promise 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/MoyaPromiseTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/MoyaPromise/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.7.0) 3 | - Moya (11.0.1): 4 | - Moya/Core (= 11.0.1) 5 | - Moya/Core (11.0.1): 6 | - Alamofire (~> 4.1) 7 | - Result (~> 3.0) 8 | - PromiseKit (6.2.1): 9 | - PromiseKit/CorePromise (= 6.2.1) 10 | - PromiseKit/Foundation (= 6.2.1) 11 | - PromiseKit/UIKit (= 6.2.1) 12 | - PromiseKit/Alamofire (6.2.1): 13 | - Alamofire (~> 4.0) 14 | - PromiseKit/CorePromise 15 | - PromiseKit/CorePromise (6.2.1) 16 | - PromiseKit/Foundation (6.2.1): 17 | - PromiseKit/CorePromise 18 | - PromiseKit/UIKit (6.2.1): 19 | - PromiseKit/CorePromise 20 | - Result (3.2.4) 21 | 22 | DEPENDENCIES: 23 | - Alamofire 24 | - Moya 25 | - PromiseKit 26 | - PromiseKit/Alamofire 27 | 28 | SPEC CHECKSUMS: 29 | Alamofire: 907e0a98eb68cdb7f9d1f541a563d6ac5dc77b25 30 | Moya: 3d594ada51a21cc02b18739ab578a1984f900c8a 31 | PromiseKit: edaca6f0a7ed73b08c287600537d13867a7fabc7 32 | Result: d2d07204ce72856f1fd9130bbe42c35a7b0fea10 33 | 34 | PODFILE CHECKSUM: 00307dc90846d1d379f2107da0f83b5bc1917fa2 35 | 36 | COCOAPODS: 1.4.0 37 | -------------------------------------------------------------------------------- /MoyaPromise.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | 5 | s.name = "MoyaPromise" 6 | s.version = "1.0.0" 7 | s.summary = "PromiseKit-oriented 'DataService' layer on top of Moya" 8 | 9 | s.description = <<-DESC 10 | A 'DataService' layer implemented with PromiseKit on the top of Moya with extra functionalities using the power of PromiseKit, especially for JSON-oriented RestAPI calls. Includes several serialization, conditional re-try mechanism. 11 | DESC 12 | 13 | s.homepage = "https://github.com/Can-Sahin/MoyaPromise" 14 | s.license = { :type => "MIT", :file => "LICENSE" } 15 | s.author = { "Can-Sahin" => "cann2005@gmail.com" } 16 | s.swift_version = "4.0" 17 | s.platform = :ios, "8.0" 18 | 19 | s.source = { :git => "https://github.com/Can-Sahin/MoyaPromise.git", :tag => "#{s.version}" } 20 | s.source_files = 'src/MoyaPromise/*.swift' 21 | 22 | s.dependency "Alamofire", "~> 4.7.0" 23 | s.dependency "PromiseKit/Alamofire", "~> 6.0" 24 | s.dependency "PromiseKit", "~> 6.2.1" 25 | s.dependency "Moya", "~> 11.0.1" 26 | 27 | 28 | end 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Can Sahin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/MoyaPromiseTests/MoyaPromiseTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoyaPromiseTests.swift 3 | // MoyaPromiseTests 4 | // 5 | // Created by Can Sahin on 09/03/2018. 6 | // Copyright © 2018 Can Sahin. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import MoyaPromise 11 | 12 | class MoyaPromiseTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Examples/CustomCarService/CustomOAuthCarTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomOAuthCarTarget.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Alamofire 11 | import Moya 12 | import MoyaPromise 13 | 14 | public protocol CustomCarTargetType: TargetType{ 15 | var someExtraFieldForAllCarTarget: String {get} 16 | } 17 | 18 | public protocol OAuth2CarAPI: CustomCarTargetType,TargetConvertible{} 19 | 20 | 21 | public protocol OAuth2TargetWrapped: CustomCarTargetType{ 22 | var oAuthToken: String? {get set} 23 | } 24 | 25 | public struct OAuth2Target : OAuth2TargetWrapped, TargetWrapable{ 26 | public typealias WrappedType = T 27 | public var target: WrappedType 28 | 29 | public init(from: WrappedType) { 30 | target = from 31 | } 32 | 33 | public var oAuthToken: String? 34 | 35 | public var someExtraFieldForAllCarTarget: String{ 36 | return target.someExtraFieldForAllCarTarget 37 | } 38 | } 39 | 40 | extension CarAPI: OAuth2CarAPI{ 41 | public typealias ConvertibleTo = OAuth2Target 42 | /// Generates a new object that is not limited by enum. In other words, that can have stored properties like OAuthToken that will be added during the request. 43 | public func wrap() -> ConvertibleTo{ 44 | return OAuth2Target(from: self) 45 | } 46 | 47 | public var someExtraFieldForAllCarTarget: String { 48 | switch self { 49 | default: 50 | return "" 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Examples/CarService/CarAPI.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarTarget.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Moya 11 | import Alamofire 12 | 13 | public enum CarAPI{ 14 | case Car(String) 15 | case License(String,Int) 16 | case Wheels 17 | } 18 | 19 | extension CarAPI: TargetType { 20 | public var baseURL: URL { return URL(string: "{YOUR_API_URL}")! } 21 | 22 | 23 | public var method: Moya.Method { 24 | switch self { 25 | case .Car: 26 | return .get 27 | default: 28 | return .get 29 | } 30 | 31 | } 32 | 33 | // Path will be added to BaseUrl 34 | public var path: String { 35 | switch self { 36 | case .Car: 37 | return "" 38 | default: 39 | return "" 40 | } 41 | } 42 | public var headers: [String: String]? { 43 | return nil 44 | } 45 | 46 | public var parameterEncoding : ParameterEncoding{ 47 | switch self { 48 | case .Car: 49 | return URLEncoding.default 50 | default: 51 | return URLEncoding.default 52 | } 53 | } 54 | 55 | 56 | public var parameters: [String: Any] { 57 | switch self { 58 | default: 59 | return [:] 60 | } 61 | } 62 | public var task: Task { 63 | return .requestParameters(parameters: self.parameters, encoding: self.parameterEncoding) 64 | } 65 | 66 | public var validationType: ValidationType{ 67 | return .successCodes 68 | } 69 | 70 | public var sampleData: Data { 71 | return "Sample Data".data(using: String.Encoding.utf8)! 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/MoyaPromise/Serialization.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Serialization.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import Alamofire 10 | 11 | class Serialization { 12 | enum ErrorCode: Int { 13 | case noData = 1 14 | case DecodingError = 2 15 | } 16 | 17 | static func newError(_ code: ErrorCode, failureReason: String) -> NSError { 18 | let errorDomain = "com.responseSerialization.error" 19 | 20 | let userInfo = [NSLocalizedFailureReasonErrorKey: failureReason] 21 | let returnError = NSError(domain: errorDomain, code: code.rawValue, userInfo: userInfo) 22 | 23 | return returnError 24 | } 25 | 26 | class ObjectCoder{ 27 | public static func CodableSerializer() -> DataResponseSerializer { 28 | return DataResponseSerializer { _, response, data, error in 29 | if let err = error{ 30 | return .failure(err) 31 | } 32 | guard let _ = data else{ 33 | let failureReason = "Data could not be serialized. Input data was nil." 34 | let error = Serialization.newError(.noData, failureReason: failureReason) 35 | return .failure(error) 36 | } 37 | let decoder = JSONDecoder() 38 | do { 39 | let obj = try decoder.decode(T.self, from: data!) 40 | return .success(obj) 41 | } 42 | catch{ 43 | let failureReason = "Data could not be decoded." 44 | let error = Serialization.newError(.DecodingError, failureReason: failureReason) 45 | return .failure(error) 46 | } 47 | 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /src/MoyaPromise/RequestPolicy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RequestPolicy.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | import Alamofire 11 | import Moya 12 | 13 | /* 14 | 15 | Alamofire Retrier is disabled. Cancelling the request when its in its coolDown interval does NOT cancel the trigger after the interval 16 | 17 | public class RequestAlamofireRetryPolicy: RequestRetrier{ 18 | public var retryCount: Int 19 | public var coolDownInterval: Double 20 | 21 | private var retryCounter:Int = 0 22 | 23 | var errorClosure: ((SessionManager, Request, Swift.Error) -> Bool) 24 | 25 | public required init (retryCount rCount: Int, coolDownInterval cDown: Double, onError error: @escaping(SessionManager, Request, Swift.Error) -> Bool){ 26 | self.errorClosure = error 27 | self.retryCount = rCount 28 | self.coolDownInterval = cDown 29 | } 30 | public func should(_ manager: SessionManager, retry request: Request, with error: Swift.Error, completion: @escaping RequestRetryCompletion) { 31 | if error.isCancelledError { 32 | completion(false,0) 33 | return 34 | } 35 | retryCounter = retryCounter + 1 36 | guard self.retryCounter <= retryCount else{ 37 | completion(false,0) 38 | return 39 | } 40 | if self.errorClosure(manager, request, error){ 41 | completion(true,coolDownInterval) 42 | } 43 | else{ 44 | completion(false, 0) 45 | } 46 | } 47 | } 48 | 49 | */ 50 | 51 | /* Sample Data is not implemented yet */ 52 | 53 | //public enum RetrievePolicy{ 54 | // case storeAsSampleData 55 | //} 56 | public enum RetryPolicy{ 57 | // case sampleDataOnFailure 58 | case requestRetry(RequestMoyaRetryPolicy) 59 | } 60 | 61 | public class RequestMoyaRetryPolicy { 62 | 63 | var errorClosure: ((Swift.Error) -> Bool) 64 | public var retryCount: Int 65 | public var coolDownInterval: Double 66 | 67 | public required init (retryCount rCount: Int, coolDownInterval cDown: Double, onError error: @escaping(Swift.Error) -> Bool){ 68 | self.errorClosure = error 69 | self.retryCount = rCount 70 | self.coolDownInterval = cDown 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Examples/SSLPinningService/SomeSSLPinningDataService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SomeSSLPinningDataService.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Moya 11 | import PromiseKit 12 | import Alamofire 13 | import MoyaPromise 14 | 15 | /* 16 | Make your own concrete DataService from DataServiceProtocol and implement SSL PublicKey pinning at init 17 | */ 18 | 19 | public class SSLPinningDataService : DataServiceProtocol { 20 | public typealias MoyaTarget = Target 21 | 22 | public var moyaProvider: MoyaProvider 23 | 24 | init(){ 25 | /* 26 | - Creating a certificate file of remote server using 'openssl' - 27 | 28 | Install openssl (brew recommended) 29 | Type the following commands (First produces .pem file then converts it to .der file) 30 | 31 | openssl s_client -showcerts -connect {HOST}:{PORT} -prexit > {FILENAME}.pem (manager: manager) 47 | } 48 | } 49 | 50 | // Initialize from your concrete class 51 | public class SomeSSLPinningDataService: SSLPinningDataService{ 52 | public func getSomething() -> Promise{ 53 | return self.request(target: CarAPI.Wheels).asString().promise 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/MoyaPromise/Protocols.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Protocols.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import Moya 10 | 11 | // In general, developer-generated 'target's are passed through the layers (Dataservice - Moya) that carries the necessary data to form the network request. Since they are enums - they dont necessarily need to be but for the unity I assume target classes are desired to be 'enums'- so, they can only have associated values that is binded with their state (case) and they cant have stored properties. Stored properties might be needed to carry the required data that can be used-modified through layers (rare cases like custom Auth processes that has several states and steps) 12 | 13 | // To enable these a 'Wrapper' must be implemented. This wrapper will add any desired functionality that is not limited with enums and value type semantics. 14 | 15 | // Before implementing a Wrapper for custom operations consider doing it in the Moya or even in Alamofire layer. Moya provides very flexible ways to modify Targets,UrlRequests,Callbacks and informative delegates. 16 | 17 | // For the example, check the CustomCarService and CarTarget 18 | 19 | /// Protocol for enabling conversion to a Wrapper 20 | public protocol TargetConvertible{ 21 | associatedtype ConvertibleTo: TargetWrapable 22 | func wrap() -> ConvertibleTo 23 | } 24 | 25 | /// Protocol for Wrappers of a specific 'TargetType' 26 | public protocol TargetWrapable: TargetType{ 27 | associatedtype WrappedType: TargetType 28 | var target : WrappedType { get set} 29 | } 30 | 31 | // Passthrough the default values 32 | extension TargetWrapable{ 33 | 34 | public var path: String { 35 | return target.path 36 | } 37 | 38 | public var baseURL: URL { 39 | return target.baseURL 40 | } 41 | 42 | public var method: Moya.Method { 43 | return target.method 44 | } 45 | 46 | public var sampleData: Data { 47 | return target.sampleData 48 | } 49 | 50 | public var task: Task { 51 | return target.task 52 | } 53 | 54 | public var validationType: ValidationType { 55 | return target.validationType 56 | } 57 | 58 | public var headers: [String : String]?{ 59 | return target.headers 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/MoyaPromise/SampleDataService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SampleDataService.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | 9 | import Foundation 10 | import Alamofire 11 | import Moya 12 | 13 | /* Currently unimplemented */ 14 | 15 | /// Very basic MockRestAPI service which backend is implemented by/with AWS Serverless. (Simple Lambda function behind the APIGateway that stores and servers static files in S3 that contains sample data). However, you can implement your own logic for serving remote sample data 16 | /// Optional to use 17 | class SampleDataService: DefaultDataService{ 18 | 19 | public func makeSampleRequest(target: SampleDataTarget,queue: DispatchQueue? = nil) -> MoyaCancellablePromise{ 20 | return self.request(target: target, queue: queue) 21 | } 22 | } 23 | 24 | 25 | enum SampleDataTarget : TargetType{ 26 | case Get(TargetType) 27 | case Put(TargetType,String) 28 | 29 | public var baseURL: URL { return URL(string: "https://{YOUR_APIGATEWAY_URL}")! } 30 | 31 | public var method: Moya.Method { 32 | switch self { 33 | case .Get: 34 | return .post 35 | case .Put: 36 | return .put 37 | } 38 | } 39 | 40 | public var path: String { 41 | return "" 42 | } 43 | public var headers: [String: String]? { 44 | return nil 45 | } 46 | 47 | public var parameterEncoding : ParameterEncoding{ 48 | return Alamofire.JSONEncoding.default 49 | } 50 | 51 | 52 | public var parameters: [String: Any] { 53 | switch self { 54 | case .Get(let sourceTarget): 55 | return ["Application": Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String, "URL": constructUrlField(sourceTarget: sourceTarget)] 56 | case .Put(let sourceTarget, let data): 57 | return ["Application": Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String, "URL": constructUrlField(sourceTarget: sourceTarget), "ResponseData": data] 58 | } 59 | } 60 | private func constructUrlField(sourceTarget: TargetType) -> String{ 61 | var url = "" 62 | if sourceTarget.path.isEmpty { 63 | url = sourceTarget.baseURL.absoluteString 64 | } else { 65 | url = sourceTarget.baseURL.appendingPathComponent(sourceTarget.path).absoluteString 66 | } 67 | return url 68 | } 69 | public var task: Task { 70 | return .requestParameters(parameters: self.parameters, encoding: self.parameterEncoding) 71 | } 72 | 73 | public var validate: Bool{ 74 | return true 75 | } 76 | public var sampleData: Data { 77 | return "Sample Data".data(using: String.Encoding.utf8)! 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Examples/CarService/CarDataService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarDataService.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Alamofire 11 | import PromiseKit 12 | import Moya 13 | import MoyaPromise 14 | 15 | // Subclass of default 16 | public class CarDataService: DefaultDataService{ 17 | // override init() { 18 | // let moyaProvider = MoyaProvider(plugins: [DebugNetworkLoggerPlugin()]) 19 | // super.init(moyaProvider: moyaProvider) 20 | // } 21 | 22 | /// Make the request and parse the response to string 23 | public func getCar(_ id:String) -> Promise { 24 | return self.request(target: CarAPI.Car(id)).asString().promise 25 | } 26 | 27 | /// Make the request and decode the response to an object 28 | public func getCarItem(_ id:String) -> Promise { 29 | return self.request(target: CarAPI.Car(id)).asParsedObject().promise 30 | } 31 | 32 | /* Not implemented for now */ 33 | /// Get sample when the request fails 34 | // public func getCarItemWithSampleDataOnFail(_ id:String) -> Promise { 35 | // /* 36 | // To enable for all requests use 37 | // DataServiceProperties.RequestSampleDataOnFail = true 38 | // */ 39 | // return self.request(target: CarAPI.Car(id),retryPolicy: RetryPolicy.sampleDataOnFailure).asParsedObject() 40 | // } 41 | 42 | /* Not implemented for now */ 43 | /// Write as sample when the request succeeds 44 | // public func getCarItem_WriteAsSampleData(_ id:String) -> Promise { 45 | // /* 46 | // To enable for all requests use 47 | // DataServiceProperties.SaveAllAsSampleData = true 48 | // */ 49 | // return self.request(target: CarAPI.Car(id),retrievePolicy: RetrievePolicy.storeAsSampleData).asParsedObject() 50 | // } 51 | 52 | /// Retry requests under some conditions 53 | public func getCarWithRetryPolicy(_ id:String) -> MoyaCancellablePromise { 54 | let p = RequestMoyaRetryPolicy(retryCount: 10, coolDownInterval: 1) { (error) -> Bool in 55 | print("retry") 56 | // Examine error and decide if you want to retry. Return false to not to retry 57 | return true 58 | } 59 | return request(target: CarAPI.Car(id),retryPolicy: RetryPolicy.requestRetry(p)).asString() 60 | } 61 | 62 | /// Get the request as cancellable 63 | public func getCarAsCancellableRequest(_ id:String) -> MoyaCancellablePromise { 64 | return request(target: CarAPI.Car(id)).asString() 65 | } 66 | 67 | } 68 | 69 | public class DummyCarItem:Codable{ 70 | public var Id: String 71 | public var Name: String 72 | public var Age: Int 73 | } 74 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/Examples/CustomCarService/CustomDataService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomDataService.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import PromiseKit 11 | import Moya 12 | import MoyaPromise 13 | 14 | /* 15 | You can create custom data service to modiy the operational steps outside of the application layer 16 | */ 17 | 18 | public class CustomDataService : DataServiceProtocol{ 19 | public typealias MoyaTarget = T 20 | 21 | public var moyaProvider: MoyaProvider 22 | 23 | private let authTokenEndPointClosure = { (target: MoyaTarget) -> Endpoint in 24 | let defaultEndpoint = MoyaProvider.defaultEndpointMapping(for: target) 25 | if let token = target.oAuthToken{ 26 | return defaultEndpoint.adding(newHTTPHeaderFields: ["Authorization ": "Bearer \(token)"]) 27 | } 28 | else{ 29 | return defaultEndpoint 30 | } 31 | 32 | } 33 | init(){ 34 | self.moyaProvider = MoyaProvider(endpointClosure: authTokenEndPointClosure, plugins:[NetworkLoggerPlugin()]) 35 | } 36 | 37 | 38 | // Override makeRequest 39 | public func makeRequest(target: MoyaTarget, 40 | queue: DispatchQueue? = nil, 41 | progress: Moya.ProgressBlock? = nil) -> MoyaCancellablePromise{ 42 | return self.makeCustomRequest(target: target, queue: queue, progress: progress) 43 | } 44 | 45 | 46 | public func makeCustomRequest(target: MoyaTarget, 47 | queue: DispatchQueue? = nil, 48 | progress: Moya.ProgressBlock? = nil) -> MoyaCancellablePromise{ 49 | // Implement a custom logic for your request. 50 | // Here is an dirty example of getting a OAuth token and making a request with it. 51 | 52 | let cancelWrapper = MoyaPromise.CancellableWrapper() 53 | 54 | let promise = YourOAuthLibraryGetTokenFunction().then {token -> Promise in 55 | if token == "someToken"{ 56 | throw CustomError.Unauthorized 57 | } 58 | var modifiedTarget = target 59 | modifiedTarget.oAuthToken = token 60 | let cancellablePromise = self.makeRequestWithPromise(target: modifiedTarget, queue: queue, progress: progress) 61 | 62 | cancelWrapper.innerCancellable = cancellablePromise.cancelToken 63 | return cancellablePromise.promise 64 | 65 | } 66 | let p = MoyaCancellablePromise(promise: promise, cancelToken: cancelWrapper) 67 | return p 68 | } 69 | 70 | // A dummy function. Use real one to get your token :) 71 | private func YourOAuthLibraryGetTokenFunction() -> Promise{ 72 | return Promise.value("someToken") 73 | } 74 | 75 | } 76 | 77 | public enum CustomError: Swift.Error{ 78 | case Unauthorized 79 | } 80 | 81 | 82 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Moya-PromiseKit-Service 4 | // 5 | // Created by Can Sahin on 01/11/2017. 6 | // Copyright © 2017 Can Sahin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PromiseKit 11 | import MoyaPromise 12 | 13 | class ViewController: UIViewController { 14 | let dataService = CarDataService() 15 | let customCarService = CustomCarDataService() 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | override func didReceiveMemoryWarning() { 24 | super.didReceiveMemoryWarning() 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | @IBAction func networkCall1() { 29 | self.getCarWithRetryAndCancel() 30 | } 31 | @IBAction func networkCall2() { 32 | self.getCar2() 33 | } 34 | 35 | func getCar1(){ 36 | dataService.getCar("someId").done{carString in 37 | print(carString) 38 | }.catch{error in 39 | // Custom error handling 40 | if let err = error as? CustomError{ 41 | if case .Unauthorized = err{ 42 | print("Not authorized") 43 | } 44 | } 45 | print(error) 46 | }.finally { 47 | //UIActivityIndicatorView.stopAnimating() 48 | } 49 | } 50 | func getCar2(){ 51 | dataService.getCarItem("someId").done{carItem in 52 | print(carItem.Name) 53 | }.catch{error in 54 | print(error) 55 | }.finally { 56 | //UIActivityIndicatorView.stopAnimating() 57 | } 58 | } 59 | 60 | func getCarAndCancel(){ 61 | let getCar = dataService.getCarAsCancellableRequest("someId") 62 | getCar.promise.done{carString in 63 | print(carString) 64 | }.catch(policy: CatchPolicy.allErrors){error in 65 | print(error) 66 | }.finally { 67 | //UIActivityIndicatorView.stopAnimating() 68 | } 69 | 70 | PromiseKit.after(seconds: 1).done{getCar.cancel()} 71 | } 72 | func getCarWithRetryAndCancel(){ 73 | let getCar = dataService.getCarWithRetryPolicy("someId") 74 | getCar.promise.done{carString in 75 | print(carString) 76 | }.catch(policy: CatchPolicy.allErrors){error in 77 | print(error) 78 | }.finally { 79 | //UIActivityIndicatorView.stopAnimating() 80 | } 81 | 82 | 83 | PromiseKit.after(seconds: 5).done{ 84 | getCar.cancel() 85 | } 86 | } 87 | 88 | 89 | 90 | func getCar3(){ 91 | customCarService.getCar("someId").map{carString in 92 | print(carString) 93 | }.catch{error in 94 | print(error) 95 | }.finally { 96 | //UIActivityIndicatorView.stopAnimating() 97 | } 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MoyaPromise 2 | 3 | A **'DataService'** layer implemented with [PromiseKit] on the top of [Moya] with extra functionalities using the power of PromiseKit, especially for JSON-oriented RestAPI calls. 4 | 5 | # What is it good for? 6 | - To use Moya requests with Promise pattern 7 | * Implement any custom desired generic functionality at any step of the execution 8 | * Custom error handling and propagation 9 | - To logically group, isolate and modify the collection of network requests 10 | - To strictly bind the targets with their providers 11 | ##### Extra functionalities 12 | - Conditionally re-try a request 13 | - Response serialization 14 | * Out of the box `Codable object`, `String`, `Data` , `[String: Any]`serialization 15 | * Flexible to implement your own custom serialization 16 | - Example project provides an example Public Key Pinning implementation on Alamofire 17 | 18 | # Dependencies 19 | 20 | Currently build upon following pods and version 21 | 22 | `Alamofire (4.7.0)` 23 | 24 | `Moya (11.0.1)` 25 | 26 | `PromiseKit (6.2.1)` 27 | 28 | # Installation 29 | ### CocoaPods 30 | 31 | Add following pod to your podfile 32 | 33 | ```rb 34 | pod 'MoyaPromise' 35 | ``` 36 | 37 | Then run `pod install`. 38 | 39 | Don't forget to 40 | import the framework to swift files like `import MoyaPromise`. 41 | 42 | # Example 43 | 44 | Example Project in the repository provides examples of how to do the requests and how to structure your code. 45 | Its not ready-to-run since `MoyaTarget`s are dummy ones. Its mainly for examining and providing the library use cases. To run it, 46 | 47 | first `pod install` 48 | 49 | then modify the `MoyaTargets` and modify `ViewController`'s default functions to call various requests. 50 | 51 | 52 | 53 | Some basic code examples 54 | 55 | ## Example code 56 | 57 | Make **getCarItem** request where the response is serialized to an object 58 | ```swift 59 | let carDataService = CarDataService() 60 | carDataService.getCarItem("carId").done{carItem in 61 | print(carItem.Name) 62 | }.catch{error in 63 | print(error) 64 | } 65 | ``` 66 | 67 | where **CarDataService** is 68 | ```swift 69 | public class CarDataService: DefaultDataService{ 70 | public func getCarItem(_ id:String) -> Promise { 71 | return self.request(target: CarAPI.Car(id)).asParsedObject().promise 72 | } 73 | public func getDriver(_ carId:String ) -> Promise { 74 | return self.request(target: CarAPI.Driver(carId)).asString().promise 75 | } 76 | } 77 | ``` 78 | Handle various errors either thrown by you or by the network during the request 79 | ```swift 80 | carDataService.getCar("someId").done{carString in 81 | print(carString) 82 | }.catch{error in 83 | // Custom error handling 84 | if let err = error as? SomeCustomError{ 85 | if case .Unauthorized = err{ 86 | print("Not authorized") 87 | // Go to login 88 | } 89 | } 90 | }.always { 91 | //UIActivityIndicatorView.stopAnimating() 92 | } 93 | ``` 94 | 95 | **Check the example project to see more of the abilities** 96 | 97 | # License 98 | MIT 99 | 100 | [Moya]: 101 | [PromiseKit]: 102 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 28 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/MoyaPromise/Plugins.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Plugins.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import Moya 10 | import PromiseKit 11 | import enum Result.Result 12 | 13 | // Custom plugins 14 | 15 | 16 | /* Not necessary anymore since Moya enabled custom status codes */ 17 | 18 | /// Plugin for extending the range of valid codes of Alamofire, since Moya layer doesn't allow further than the boolean flag 'validate'. 19 | /// Make sure you set 'validate' to FALSE in Target 20 | //public struct AcceptableCodesPlugin: PluginType { 21 | // 22 | // fileprivate static var defaultCodes: [Int] { return Array(200..<300) } 23 | // 24 | // private var acceptableStatusCodes: [Int] 25 | // public init(_ codes: [Int]) { 26 | // acceptableStatusCodes = AcceptableCodesPlugin.defaultCodes + codes 27 | // } 28 | // 29 | // public func process(_ result: Result, target: TargetType) -> Result { 30 | // if target.validate{ 31 | // return result 32 | // } 33 | // 34 | // switch result { 35 | // case let .success(response): 36 | // if acceptableStatusCodes.contains(response.statusCode) { 37 | // return .success(response) 38 | // } 39 | // else{ 40 | // let reason: AFError.ResponseValidationFailureReason = .unacceptableStatusCode(code: response.statusCode) 41 | // return .failure(MoyaError.underlying(AFError.responseValidationFailed(reason: reason),nil)) 42 | // } 43 | // case .failure(_): 44 | // return result 45 | // } 46 | // 47 | // } 48 | //} 49 | 50 | /// Simple network console logger for debug mode 51 | public struct DebugNetworkLoggerPlugin: PluginType{ 52 | private let logResponseData: Bool 53 | init(_ logResponseData: Bool = false) { 54 | self.logResponseData = logResponseData 55 | } 56 | public func willSend(_ request: RequestType, target: TargetType) { 57 | #if DEBUG 58 | print("- Outgoing Network Request -") 59 | 60 | print("Request: " + (request.request?.description ?? "(invalid request)")) 61 | 62 | if let headers = request.request?.allHTTPHeaderFields { 63 | print("Headers: " + headers.description) 64 | } 65 | if let body = request.request?.httpBody, let stringOutput = String(data: body, encoding: .utf8) { 66 | print("Request Body: " + stringOutput) 67 | } 68 | print("") 69 | 70 | #endif 71 | } 72 | 73 | public func didReceive(_ result: Result, target: TargetType) { 74 | #if DEBUG 75 | if case .success(let rsp) = result { 76 | guard let response = rsp.response else { 77 | print("Received empty network response for \(target).") 78 | return 79 | } 80 | print("- Incoming Network Response -") 81 | print("Url: " + target.baseURL.appendingPathComponent(target.path).absoluteString) 82 | print("Response: " + response.description) 83 | if self.logResponseData, let stringData = String(data: rsp.data, encoding: String.Encoding.utf8) { 84 | print("Data: " + stringData) 85 | } 86 | } else { 87 | print("- Incoming Network Response FAILED!! - \n") 88 | print("Url: " + target.baseURL.appendingPathComponent(target.path).absoluteString) 89 | 90 | } 91 | print("") 92 | 93 | #endif 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/MoyaPromise/MoyaProvider+Promise.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoyaProvider+Promise.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import PromiseKit 10 | import Moya 11 | 12 | 13 | // Copy of Moya.CancellableWrapper class. Moya made it internal so this is the identical copy for the module 14 | public class CancellableWrapper: Cancellable { 15 | public var innerCancellable: Cancellable = SimpleCancellable() 16 | 17 | public var isCancelled: Bool { return innerCancellable.isCancelled } 18 | 19 | public func cancel() { 20 | innerCancellable.cancel() 21 | } 22 | public init() {} 23 | } 24 | // Copy of Moya.SimpleCancellable class. Moya made it internal so this is the identical copy for the module 25 | public class SimpleCancellable: Cancellable { 26 | public var isCancelled = false 27 | public func cancel() { 28 | isCancelled = true 29 | } 30 | public init() {} 31 | } 32 | 33 | /// Simply a 'custom' Promise holding a cancellable token 34 | public class MoyaCancellablePromise{ 35 | private let corePromise: Promise 36 | public var cancelToken: Cancellable = SimpleCancellable() 37 | 38 | public func cancel(){ 39 | cancelToken.cancel() 40 | } 41 | 42 | public var isCancelled: Bool { return cancelToken.isCancelled} 43 | 44 | public init(promise: Promise) { 45 | self.corePromise = promise 46 | } 47 | public init(promise: Promise, cancelToken: Cancellable?) { 48 | self.corePromise = promise 49 | if let token = cancelToken{ 50 | self.cancelToken = token 51 | } 52 | } 53 | 54 | public init(value: T) { 55 | self.corePromise = Promise.value(value); 56 | } 57 | 58 | public init(error: Swift.Error) { 59 | self.corePromise = Promise.init(error: error); 60 | } 61 | public var promise: Promise{ 62 | return self.corePromise; 63 | } 64 | 65 | /// 'Recover' implementation with CancelledError check 66 | public func recover(on q: DispatchQueue = .main, policy: CatchPolicy = .allErrorsExceptCancellation, execute body: @escaping (Swift.Error, Cancellable?, @escaping (Cancellable) -> Void) throws -> Promise) -> MoyaCancellablePromise{ 67 | let recoveredPromise = self.corePromise.recover(on: q, policy: policy) { (error) -> Promise in 68 | if self.isCancelled{ 69 | throw PMKError.cancelled 70 | } 71 | return try body(error, self.cancelToken) {token in 72 | // Pass it as nested object so the top level object (firstly created MoyaRequest) can still access the cancel token after many tries 73 | if let cancelWrapper = self.cancelToken as? CancellableWrapper{ 74 | cancelWrapper.innerCancellable = token 75 | } 76 | else{ 77 | self.cancelToken = token 78 | } 79 | } 80 | } 81 | return MoyaCancellablePromise(promise: recoveredPromise, cancelToken: self.cancelToken) 82 | } 83 | } 84 | 85 | public extension MoyaProvider { 86 | 87 | /// Promise value of moya request 88 | public func requestPromise(target: Target, 89 | queue: DispatchQueue? = nil, 90 | progress: Moya.ProgressBlock? = nil) -> MoyaCancellablePromise{ 91 | 92 | let token = CancellableWrapper() 93 | 94 | let p:Promise = Promise {seal in 95 | token.innerCancellable = self.request(target, callbackQueue: queue, progress: progress, completion: { (result) in 96 | switch result { 97 | case let .success(response): 98 | seal.fulfill(response) 99 | case let .failure(error): 100 | if error.isCancelledError{ 101 | seal.reject(PMKError.cancelled) 102 | } 103 | else{ 104 | seal.reject(error) 105 | } 106 | } 107 | }) 108 | } 109 | let moyaPromise = MoyaCancellablePromise(promise: p, cancelToken: token) 110 | return moyaPromise 111 | } 112 | 113 | } 114 | 115 | -------------------------------------------------------------------------------- /src/MoyaPromise/DataServiceExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataServiceExtensions.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import Alamofire 10 | import PromiseKit 11 | import Moya 12 | 13 | 14 | extension Swift.Error{ 15 | var isMoyaUnderlyingError: Bool{ 16 | if let err = self as? MoyaError{ 17 | if case MoyaError.underlying(_,_) = err{ 18 | return true 19 | } 20 | } 21 | return false 22 | } 23 | } 24 | 25 | extension MoyaError{ 26 | var isCancelledError: Bool { 27 | switch self { 28 | case .underlying(let error,_): 29 | return error.isCancelled 30 | default: 31 | return false 32 | } 33 | } 34 | var innerError: (Swift.Error?, Moya.Response?)?{ 35 | switch self { 36 | case .underlying(let error, let rsp): 37 | return (error,rsp) 38 | default: 39 | return nil 40 | } 41 | } 42 | public func isStatusCodeError(code errorCode: Int) -> (Bool,Response?){ 43 | if case let MoyaError.underlying(err,data) = self, case let AFError.responseValidationFailed(reason) = err, case let AFError.ResponseValidationFailureReason.unacceptableStatusCode(code) = reason, code == errorCode{ 44 | return (true,data) 45 | } 46 | return (false,nil) 47 | } 48 | } 49 | 50 | 51 | extension Data{ 52 | public func asString() -> String?{ 53 | return String(data: self, encoding: String.Encoding.utf8) 54 | } 55 | } 56 | 57 | // Serializers for the response 58 | extension Moya.Response{ 59 | private func serializeWithPromise (_ serializer: DataResponseSerializer) -> Promise{ 60 | return Promise { seal in 61 | self.serialize(responseSerializer: serializer) { (result) in 62 | switch result { 63 | case .success(let value): 64 | seal.fulfill(value) 65 | case .failure(let error): 66 | seal.reject(error) 67 | } 68 | } 69 | 70 | } 71 | } 72 | 73 | @discardableResult 74 | private func serialize( 75 | queue: DispatchQueue? = nil, 76 | responseSerializer: T, 77 | completionHandler: @escaping (Alamofire.Result) -> Void) 78 | -> Self 79 | { 80 | let result = responseSerializer.serializeResponse( 81 | self.request, 82 | self.response, 83 | self.data, 84 | nil 85 | ) 86 | (queue ?? DispatchQueue.main).async { completionHandler(result) } 87 | return self 88 | } 89 | 90 | public func responseObject(queue: DispatchQueue? = nil, 91 | encoding: String.Encoding? = nil) -> Promise { 92 | let serializer : DataResponseSerializer = Serialization.ObjectCoder.CodableSerializer() 93 | return serializeWithPromise(serializer) 94 | } 95 | 96 | public func response() -> Promise<(URLRequest, HTTPURLResponse, Data)> { 97 | return Promise { seal in 98 | if let a = self.request, let b = self.response{ 99 | seal.fulfill((a,b,self.data)) 100 | } else { 101 | seal.reject(PMKError.invalidCallingConvention) 102 | } 103 | 104 | } 105 | } 106 | public func responseString(queue: DispatchQueue? = nil, 107 | encoding: String.Encoding? = nil) -> Promise { 108 | let serializer = DataRequest.stringResponseSerializer(encoding: encoding) 109 | return serializeWithPromise(serializer) 110 | } 111 | 112 | 113 | public func responseData() -> Promise { 114 | let serializer = DataRequest.dataResponseSerializer() 115 | return serializeWithPromise(serializer) 116 | 117 | } 118 | 119 | public func responseJSON(options: JSONSerialization.ReadingOptions = .allowFragments) -> Promise { 120 | let serializer = DataRequest.jsonResponseSerializer(options: options) 121 | return serializeWithPromise(serializer) 122 | } 123 | 124 | public func responseJsonDictionary(options: JSONSerialization.ReadingOptions = .allowFragments) -> Promise<[String: Any]> { 125 | let serializer = DataRequest.jsonResponseSerializer(options: options) 126 | return serializeWithPromise(serializer).map{json -> [String: Any] in 127 | if let value = json as? [String: Any]{ 128 | return value 129 | } 130 | else{ 131 | return [:] 132 | } 133 | } 134 | 135 | } 136 | } 137 | public func pickNonNil(_ params: T?...) -> T?{ 138 | for item in params { 139 | if item != nil { return item} 140 | } 141 | return nil 142 | } 143 | 144 | -------------------------------------------------------------------------------- /src/MoyaPromise/DataService + Default.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataService + Default.swift 3 | // 4 | // Created by Can Sahin on 28/06/2017. 5 | // Copyright © 2017 Can Sahin. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import Alamofire 10 | import PromiseKit 11 | import Moya 12 | 13 | public struct DataServiceProperties{ 14 | public static var RequestSampleDataOnFail = false 15 | public static var SaveAllAsSampleData = false 16 | } 17 | 18 | /// Concrete class for default implementations 19 | open class DefaultDataService : DataServiceProtocol { 20 | public typealias MoyaTarget = Target 21 | 22 | public var moyaProvider: MoyaProvider 23 | 24 | public init(){ 25 | self.moyaProvider = MoyaProvider() 26 | } 27 | public init(moyaProvider: MoyaProvider){ 28 | self.moyaProvider = moyaProvider 29 | } 30 | } 31 | 32 | /// Protocol for every DataService types 33 | public protocol DataServiceProtocol{ 34 | associatedtype MoyaTarget: TargetType 35 | var moyaProvider: MoyaProvider { get set} 36 | var retryPolicy: RetryPolicy? {get set} 37 | // var retrievePolicy: RetrievePolicy? {get set} 38 | //Override this when writing a custom DataService 39 | func makeRequest(target: MoyaTarget,queue: DispatchQueue?,progress: Moya.ProgressBlock?) -> MoyaCancellablePromise 40 | } 41 | 42 | // Default implementations for the protocol 43 | public extension DataServiceProtocol{ 44 | public var retryPolicy: RetryPolicy?{ get{return nil} set{}} 45 | // public var retrievePolicy: RetrievePolicy?{ get{return nil} set{}} 46 | 47 | public func cancelAllTasks(){ 48 | moyaProvider.manager.session.getTasksWithCompletionHandler { dataTasks, uploadTasks, downloadTasks in 49 | dataTasks.forEach { $0.cancel() } 50 | uploadTasks.forEach { $0.cancel() } 51 | downloadTasks.forEach { $0.cancel() } } 52 | } 53 | 54 | 55 | public func request(target: MoyaTarget, 56 | retryPolicy: RetryPolicy? = nil, 57 | queue: DispatchQueue? = nil, 58 | progress: Moya.ProgressBlock? = nil) -> MoyaCancellablePromise{ 59 | // var changedRetryPolicy = retryPolicy 60 | // var changedRetrievePolicy = retrievePolicy 61 | 62 | // #if DEBUG 63 | // if DataServiceProperties.RequestSampleDataOnFail{ 64 | // changedRetryPolicy = RetryPolicy.sampleDataOnFailure 65 | // } 66 | // if DataServiceProperties.SaveAllAsSampleData { 67 | // changedRetrievePolicy = RetrievePolicy.storeAsSampleData 68 | // } 69 | // #endif 70 | if let policy = pickNonNil(retryPolicy, self.retryPolicy){ 71 | return retry(policy: policy, target: target) { 72 | return self.makeRequest(target: target, queue: queue, progress: progress).completeWithRetrievePolicy(target: target) 73 | } 74 | } 75 | else{ 76 | return makeRequest(target: target, queue: queue, progress: progress).completeWithRetrievePolicy(target: target) 77 | } 78 | 79 | } 80 | 81 | 82 | public func makeRequest(target: MoyaTarget, 83 | queue: DispatchQueue? = nil, 84 | progress: Moya.ProgressBlock? = nil) -> MoyaCancellablePromise{ 85 | return self.makeRequestWithPromise(target: target, queue: queue, progress: progress) 86 | 87 | } 88 | public func makeRequestWithPromise(target: MoyaTarget, 89 | queue: DispatchQueue? = nil, 90 | progress: Moya.ProgressBlock? = nil) -> MoyaCancellablePromise{ 91 | return self.moyaProvider.requestPromise(target: target, queue: queue, progress: progress) 92 | 93 | } 94 | 95 | 96 | @discardableResult 97 | private func retry(policy retryPolicy : RetryPolicy?, target targetToRetry: MoyaTarget, _ body: @escaping () -> MoyaCancellablePromise) -> MoyaCancellablePromise { 98 | 99 | guard let policy = retryPolicy else{ 100 | return body() 101 | } 102 | 103 | switch policy { 104 | // case .sampleDataOnFailure: 105 | // #if DEBUG 106 | // return retryWithSampleData(target: targetToRetry, body) 107 | // #else 108 | // return body() 109 | // #endif 110 | case .requestRetry(let moyaPolicy): 111 | return retryRequest(p: moyaPolicy, body) 112 | } 113 | 114 | } 115 | // @discardableResult 116 | // private func retryWithSampleData(target targetToRetry: MoyaTarget, _ body: @escaping () -> MoyaCancellablePromise) -> MoyaCancellablePromise { 117 | // 118 | // return body().recover(policy: CatchPolicy.allErrorsExceptCancellation) { error, token -> MoyaCancellablePromise in 119 | // let p: MoyaCancellablePromise = MoyaCancellablePromise{(f, r) in 120 | // SampleDataService().makeSampleRequest(target: SampleDataTarget.Get(targetToRetry)).then{ (rsp) -> Void in 121 | // print("Sample Data is found") 122 | // f(rsp) 123 | // }.catch{errorLast in 124 | // if let moyaError = errorLast as? MoyaError, moyaError.isStatusCodeError(code:404).0{ 125 | // print("Sample data cannot be found! ") 126 | // } 127 | // else{ 128 | // print("Cannot get sample data: " + errorLast.localizedDescription) 129 | // } 130 | // r(error) 131 | // } 132 | // } 133 | // if let cancelToken = token{ 134 | // p.cancelToken = cancelToken 135 | // } 136 | // return p 137 | // } 138 | // } 139 | @discardableResult 140 | private func retryRequest(p policy : RequestMoyaRetryPolicy, _ body: @escaping () -> MoyaCancellablePromise) -> MoyaCancellablePromise { 141 | 142 | var retryCounter = 0 143 | let times = policy.retryCount 144 | let coolDown = policy.coolDownInterval 145 | 146 | func attempt() -> MoyaCancellablePromise { 147 | return body().recover(policy: CatchPolicy.allErrorsExceptCancellation) { error, token , setTokenFunction -> Promise in 148 | retryCounter += 1 149 | guard retryCounter <= times else { 150 | throw error 151 | } 152 | if !policy.errorClosure(error){ 153 | throw error 154 | } 155 | let promise = PromiseKit.after(seconds: coolDown).then{_ -> Promise in 156 | if token?.isCancelled ?? false { 157 | throw PMKError.cancelled 158 | } 159 | let result = attempt() 160 | setTokenFunction(result.cancelToken) 161 | return result.promise 162 | } 163 | return promise 164 | } 165 | } 166 | 167 | return attempt() 168 | } 169 | 170 | } 171 | extension MoyaCancellablePromise where T: Moya.Response{ 172 | func completeWithRetrievePolicy(target: TargetType) -> Self{ 173 | //Retrieve Policy is unimplemented for now 174 | return self 175 | // guard let retrievePolicy = policy else{ 176 | // return self 177 | // } 178 | // if retrievePolicy == .storeAsSampleData{ 179 | // return storeAsSampleData(target: target) 180 | // } 181 | // return self 182 | } 183 | // private func storeAsSampleData(target: TargetType) -> Self{ 184 | // #if DEBUG 185 | // self.thenWith { moyaResponse in 186 | // moyaResponse.responseString().then{data -> Void in 187 | // SampleDataService().makeSampleRequest(target: SampleDataTarget.Put(target,data)).catch{error in 188 | // print("Cannot write sample data: " + error.localizedDescription) 189 | // } 190 | // } 191 | // }.catch{_ in} 192 | // #endif 193 | // return self 194 | // } 195 | } 196 | 197 | extension MoyaCancellablePromise where T: Moya.Response{ 198 | public func asParsedObject() -> MoyaCancellablePromise{ 199 | return MoyaCancellablePromise(promise: self.promise.then(on: DispatchQueue.global(qos: .background)) { moyaResponse in 200 | return moyaResponse.responseObject() 201 | }, cancelToken: self.cancelToken); 202 | } 203 | 204 | public func asString() -> MoyaCancellablePromise{ 205 | return MoyaCancellablePromise(promise: self.promise.then { moyaResponse in 206 | return moyaResponse.responseString() 207 | }, cancelToken: self.cancelToken); 208 | } 209 | public func asData() -> MoyaCancellablePromise{ 210 | return MoyaCancellablePromise(promise: self.promise.then { moyaResponse in 211 | return moyaResponse.responseData() 212 | }, cancelToken: self.cancelToken); 213 | } 214 | public func asJson() -> MoyaCancellablePromise{ 215 | return MoyaCancellablePromise(promise: self.promise.then { moyaResponse in 216 | return moyaResponse.responseJSON() 217 | }, cancelToken: self.cancelToken); 218 | } 219 | public func asJsonDictionary() -> MoyaCancellablePromise<[String: Any]>{ 220 | return MoyaCancellablePromise<[String: Any]>(promise: self.promise.then { moyaResponse in 221 | return moyaResponse.responseJsonDictionary() 222 | }, cancelToken: self.cancelToken); 223 | } 224 | } 225 | 226 | -------------------------------------------------------------------------------- /Example/MoyaPromiseExample/MoyaPromiseExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5B4BCF6C1FA9F205008F8370 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCF6B1FA9F205008F8370 /* AppDelegate.swift */; }; 11 | 5B4BCF6E1FA9F205008F8370 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCF6D1FA9F205008F8370 /* ViewController.swift */; }; 12 | 5B4BCF711FA9F205008F8370 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B4BCF6F1FA9F205008F8370 /* Main.storyboard */; }; 13 | 5B4BCF731FA9F205008F8370 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B4BCF721FA9F205008F8370 /* Assets.xcassets */; }; 14 | 5B4BCF761FA9F205008F8370 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B4BCF741FA9F205008F8370 /* LaunchScreen.storyboard */; }; 15 | 5B4BCFA71FA9F777008F8370 /* CarDataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCFA61FA9F777008F8370 /* CarDataService.swift */; }; 16 | 5B4BCFAA1FA9F7C1008F8370 /* CarAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCFA91FA9F7C1008F8370 /* CarAPI.swift */; }; 17 | 5B4BCFAE1FA9FB41008F8370 /* SomeSSLPinningDataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCFAD1FA9FB41008F8370 /* SomeSSLPinningDataService.swift */; }; 18 | 5B4BCFB21FAA000D008F8370 /* CustomDataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCFB11FAA000D008F8370 /* CustomDataService.swift */; }; 19 | 5B4BCFB51FAA0174008F8370 /* CustomOAuthCarTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCFB41FAA0174008F8370 /* CustomOAuthCarTarget.swift */; }; 20 | 5B4BCFB81FAA058D008F8370 /* CustomCarService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4BCFB71FAA058D008F8370 /* CustomCarService.swift */; }; 21 | 7EC8416DCE03831A207CD1C7 /* Pods_MoyaPromiseExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FD6EC9B46FE7A405F9EB682 /* Pods_MoyaPromiseExample.framework */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 5B4BCF681FA9F205008F8370 /* MoyaPromiseExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoyaPromiseExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 5B4BCF6B1FA9F205008F8370 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 27 | 5B4BCF6D1FA9F205008F8370 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 28 | 5B4BCF701FA9F205008F8370 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | 5B4BCF721FA9F205008F8370 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 5B4BCF751FA9F205008F8370 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 5B4BCF771FA9F205008F8370 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 5B4BCFA61FA9F777008F8370 /* CarDataService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarDataService.swift; sourceTree = ""; }; 33 | 5B4BCFA91FA9F7C1008F8370 /* CarAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarAPI.swift; sourceTree = ""; }; 34 | 5B4BCFAD1FA9FB41008F8370 /* SomeSSLPinningDataService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SomeSSLPinningDataService.swift; sourceTree = ""; }; 35 | 5B4BCFB11FAA000D008F8370 /* CustomDataService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomDataService.swift; sourceTree = ""; }; 36 | 5B4BCFB41FAA0174008F8370 /* CustomOAuthCarTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomOAuthCarTarget.swift; sourceTree = ""; }; 37 | 5B4BCFB71FAA058D008F8370 /* CustomCarService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCarService.swift; sourceTree = ""; }; 38 | 5FD6EC9B46FE7A405F9EB682 /* Pods_MoyaPromiseExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MoyaPromiseExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 8282FA1D113FDAFA405279BB /* Pods-MoyaPromiseExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoyaPromiseExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MoyaPromiseExample/Pods-MoyaPromiseExample.debug.xcconfig"; sourceTree = ""; }; 40 | B3E79E3BCFEED62C8FC26207 /* Pods-Moya-PromiseKit-Service.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Moya-PromiseKit-Service.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Moya-PromiseKit-Service/Pods-Moya-PromiseKit-Service.debug.xcconfig"; sourceTree = ""; }; 41 | C11A98D6A3AE9C10E1346A09 /* Pods-MoyaPromiseExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoyaPromiseExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-MoyaPromiseExample/Pods-MoyaPromiseExample.release.xcconfig"; sourceTree = ""; }; 42 | F5337130FAED273AEABC639C /* Pods-Moya-PromiseKit-Service.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Moya-PromiseKit-Service.release.xcconfig"; path = "Pods/Target Support Files/Pods-Moya-PromiseKit-Service/Pods-Moya-PromiseKit-Service.release.xcconfig"; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 5B4BCF651FA9F205008F8370 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 7EC8416DCE03831A207CD1C7 /* Pods_MoyaPromiseExample.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | 01277A38C2BCAF6A229F599C /* Frameworks */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 5FD6EC9B46FE7A405F9EB682 /* Pods_MoyaPromiseExample.framework */, 61 | ); 62 | name = Frameworks; 63 | sourceTree = ""; 64 | }; 65 | 5B4BCF5F1FA9F205008F8370 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 5B4BCF6A1FA9F205008F8370 /* MoyaPromiseExample */, 69 | 5B4BCF691FA9F205008F8370 /* Products */, 70 | B4B3B8B70F9AA3A77EC70C47 /* Pods */, 71 | 01277A38C2BCAF6A229F599C /* Frameworks */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 5B4BCF691FA9F205008F8370 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 5B4BCF681FA9F205008F8370 /* MoyaPromiseExample.app */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | 5B4BCF6A1FA9F205008F8370 /* MoyaPromiseExample */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 5B4BCFA41FA9F759008F8370 /* Examples */, 87 | 5B4BCF6B1FA9F205008F8370 /* AppDelegate.swift */, 88 | 5B4BCF6D1FA9F205008F8370 /* ViewController.swift */, 89 | 5B4BCF6F1FA9F205008F8370 /* Main.storyboard */, 90 | 5B4BCF721FA9F205008F8370 /* Assets.xcassets */, 91 | 5B4BCF741FA9F205008F8370 /* LaunchScreen.storyboard */, 92 | 5B4BCF771FA9F205008F8370 /* Info.plist */, 93 | ); 94 | path = MoyaPromiseExample; 95 | sourceTree = ""; 96 | }; 97 | 5B4BCFA41FA9F759008F8370 /* Examples */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 5B4BCFB01FA9FFED008F8370 /* CustomCarService */, 101 | 5B4BCFAC1FA9FB29008F8370 /* SSLPinningService */, 102 | 5B4BCFA51FA9F759008F8370 /* CarService */, 103 | ); 104 | path = Examples; 105 | sourceTree = SOURCE_ROOT; 106 | }; 107 | 5B4BCFA51FA9F759008F8370 /* CarService */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 5B4BCFA61FA9F777008F8370 /* CarDataService.swift */, 111 | 5B4BCFA91FA9F7C1008F8370 /* CarAPI.swift */, 112 | ); 113 | path = CarService; 114 | sourceTree = ""; 115 | }; 116 | 5B4BCFAC1FA9FB29008F8370 /* SSLPinningService */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 5B4BCFAD1FA9FB41008F8370 /* SomeSSLPinningDataService.swift */, 120 | ); 121 | path = SSLPinningService; 122 | sourceTree = ""; 123 | }; 124 | 5B4BCFB01FA9FFED008F8370 /* CustomCarService */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 5B4BCFB11FAA000D008F8370 /* CustomDataService.swift */, 128 | 5B4BCFB41FAA0174008F8370 /* CustomOAuthCarTarget.swift */, 129 | 5B4BCFB71FAA058D008F8370 /* CustomCarService.swift */, 130 | ); 131 | path = CustomCarService; 132 | sourceTree = ""; 133 | }; 134 | B4B3B8B70F9AA3A77EC70C47 /* Pods */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | B3E79E3BCFEED62C8FC26207 /* Pods-Moya-PromiseKit-Service.debug.xcconfig */, 138 | F5337130FAED273AEABC639C /* Pods-Moya-PromiseKit-Service.release.xcconfig */, 139 | 8282FA1D113FDAFA405279BB /* Pods-MoyaPromiseExample.debug.xcconfig */, 140 | C11A98D6A3AE9C10E1346A09 /* Pods-MoyaPromiseExample.release.xcconfig */, 141 | ); 142 | name = Pods; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 5B4BCF671FA9F205008F8370 /* MoyaPromiseExample */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 5B4BCF851FA9F206008F8370 /* Build configuration list for PBXNativeTarget "MoyaPromiseExample" */; 151 | buildPhases = ( 152 | 63E16EBC45CBB741B6AF4C44 /* [CP] Check Pods Manifest.lock */, 153 | 5B4BCF641FA9F205008F8370 /* Sources */, 154 | 5B4BCF651FA9F205008F8370 /* Frameworks */, 155 | 5B4BCF661FA9F205008F8370 /* Resources */, 156 | 644E919C8E13CB97130D6005 /* [CP] Embed Pods Frameworks */, 157 | C2E0EEB0DE02696E7404D560 /* [CP] Copy Pods Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = MoyaPromiseExample; 164 | productName = "Moya-PromiseKit-Service"; 165 | productReference = 5B4BCF681FA9F205008F8370 /* MoyaPromiseExample.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | 5B4BCF601FA9F205008F8370 /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | LastSwiftUpdateCheck = 0900; 175 | LastUpgradeCheck = 0900; 176 | ORGANIZATIONNAME = "Can Sahin"; 177 | TargetAttributes = { 178 | 5B4BCF671FA9F205008F8370 = { 179 | CreatedOnToolsVersion = 9.0.1; 180 | ProvisioningStyle = Automatic; 181 | }; 182 | }; 183 | }; 184 | buildConfigurationList = 5B4BCF631FA9F205008F8370 /* Build configuration list for PBXProject "MoyaPromiseExample" */; 185 | compatibilityVersion = "Xcode 8.0"; 186 | developmentRegion = en; 187 | hasScannedForEncodings = 0; 188 | knownRegions = ( 189 | en, 190 | Base, 191 | ); 192 | mainGroup = 5B4BCF5F1FA9F205008F8370; 193 | productRefGroup = 5B4BCF691FA9F205008F8370 /* Products */; 194 | projectDirPath = ""; 195 | projectRoot = ""; 196 | targets = ( 197 | 5B4BCF671FA9F205008F8370 /* MoyaPromiseExample */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | 5B4BCF661FA9F205008F8370 /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 5B4BCF761FA9F205008F8370 /* LaunchScreen.storyboard in Resources */, 208 | 5B4BCF731FA9F205008F8370 /* Assets.xcassets in Resources */, 209 | 5B4BCF711FA9F205008F8370 /* Main.storyboard in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXResourcesBuildPhase section */ 214 | 215 | /* Begin PBXShellScriptBuildPhase section */ 216 | 63E16EBC45CBB741B6AF4C44 /* [CP] Check Pods Manifest.lock */ = { 217 | isa = PBXShellScriptBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | ); 221 | inputPaths = ( 222 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 223 | "${PODS_ROOT}/Manifest.lock", 224 | ); 225 | name = "[CP] Check Pods Manifest.lock"; 226 | outputPaths = ( 227 | "$(DERIVED_FILE_DIR)/Pods-MoyaPromiseExample-checkManifestLockResult.txt", 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | shellPath = /bin/sh; 231 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 232 | showEnvVarsInLog = 0; 233 | }; 234 | 644E919C8E13CB97130D6005 /* [CP] Embed Pods Frameworks */ = { 235 | isa = PBXShellScriptBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | inputPaths = ( 240 | "${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromiseExample/Pods-MoyaPromiseExample-frameworks.sh", 241 | "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", 242 | "${BUILT_PRODUCTS_DIR}/Moya/Moya.framework", 243 | "${BUILT_PRODUCTS_DIR}/MoyaPromise/MoyaPromise.framework", 244 | "${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework", 245 | "${BUILT_PRODUCTS_DIR}/Result/Result.framework", 246 | ); 247 | name = "[CP] Embed Pods Frameworks"; 248 | outputPaths = ( 249 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", 250 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework", 251 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoyaPromise.framework", 252 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework", 253 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework", 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | shellPath = /bin/sh; 257 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromiseExample/Pods-MoyaPromiseExample-frameworks.sh\"\n"; 258 | showEnvVarsInLog = 0; 259 | }; 260 | C2E0EEB0DE02696E7404D560 /* [CP] Copy Pods Resources */ = { 261 | isa = PBXShellScriptBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | inputPaths = ( 266 | ); 267 | name = "[CP] Copy Pods Resources"; 268 | outputPaths = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromiseExample/Pods-MoyaPromiseExample-resources.sh\"\n"; 273 | showEnvVarsInLog = 0; 274 | }; 275 | /* End PBXShellScriptBuildPhase section */ 276 | 277 | /* Begin PBXSourcesBuildPhase section */ 278 | 5B4BCF641FA9F205008F8370 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 5B4BCF6E1FA9F205008F8370 /* ViewController.swift in Sources */, 283 | 5B4BCFB51FAA0174008F8370 /* CustomOAuthCarTarget.swift in Sources */, 284 | 5B4BCFB81FAA058D008F8370 /* CustomCarService.swift in Sources */, 285 | 5B4BCFAA1FA9F7C1008F8370 /* CarAPI.swift in Sources */, 286 | 5B4BCF6C1FA9F205008F8370 /* AppDelegate.swift in Sources */, 287 | 5B4BCFB21FAA000D008F8370 /* CustomDataService.swift in Sources */, 288 | 5B4BCFA71FA9F777008F8370 /* CarDataService.swift in Sources */, 289 | 5B4BCFAE1FA9FB41008F8370 /* SomeSSLPinningDataService.swift in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXSourcesBuildPhase section */ 294 | 295 | /* Begin PBXVariantGroup section */ 296 | 5B4BCF6F1FA9F205008F8370 /* Main.storyboard */ = { 297 | isa = PBXVariantGroup; 298 | children = ( 299 | 5B4BCF701FA9F205008F8370 /* Base */, 300 | ); 301 | name = Main.storyboard; 302 | sourceTree = ""; 303 | }; 304 | 5B4BCF741FA9F205008F8370 /* LaunchScreen.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | 5B4BCF751FA9F205008F8370 /* Base */, 308 | ); 309 | name = LaunchScreen.storyboard; 310 | sourceTree = ""; 311 | }; 312 | /* End PBXVariantGroup section */ 313 | 314 | /* Begin XCBuildConfiguration section */ 315 | 5B4BCF831FA9F206008F8370 /* Debug */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_ANALYZER_NONNULL = YES; 320 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_COMMA = YES; 328 | CLANG_WARN_CONSTANT_CONVERSION = YES; 329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 330 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INFINITE_RECURSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_STRICT_PROTOTYPES = YES; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | CODE_SIGN_IDENTITY = "iPhone Developer"; 345 | COPY_PHASE_STRIP = NO; 346 | DEBUG_INFORMATION_FORMAT = dwarf; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | ENABLE_TESTABILITY = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu11; 350 | GCC_DYNAMIC_NO_PIC = NO; 351 | GCC_NO_COMMON_BLOCKS = YES; 352 | GCC_OPTIMIZATION_LEVEL = 0; 353 | GCC_PREPROCESSOR_DEFINITIONS = ( 354 | "DEBUG=1", 355 | "$(inherited)", 356 | ); 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 364 | MTL_ENABLE_DEBUG_INFO = YES; 365 | ONLY_ACTIVE_ARCH = YES; 366 | SDKROOT = iphoneos; 367 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 368 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 369 | }; 370 | name = Debug; 371 | }; 372 | 5B4BCF841FA9F206008F8370 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_SEARCH_USER_PATHS = NO; 376 | CLANG_ANALYZER_NONNULL = YES; 377 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 383 | CLANG_WARN_BOOL_CONVERSION = YES; 384 | CLANG_WARN_COMMA = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 388 | CLANG_WARN_EMPTY_BODY = YES; 389 | CLANG_WARN_ENUM_CONVERSION = YES; 390 | CLANG_WARN_INFINITE_RECURSION = YES; 391 | CLANG_WARN_INT_CONVERSION = YES; 392 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 393 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 394 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 395 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 396 | CLANG_WARN_STRICT_PROTOTYPES = YES; 397 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 398 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | CODE_SIGN_IDENTITY = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu11; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | SDKROOT = iphoneos; 417 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 418 | VALIDATE_PRODUCT = YES; 419 | }; 420 | name = Release; 421 | }; 422 | 5B4BCF861FA9F206008F8370 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | baseConfigurationReference = 8282FA1D113FDAFA405279BB /* Pods-MoyaPromiseExample.debug.xcconfig */; 425 | buildSettings = { 426 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 427 | CODE_SIGN_STYLE = Automatic; 428 | INFOPLIST_FILE = MoyaPromiseExample/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = "Can-Sahin.MoyaPromiseExample"; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | SWIFT_VERSION = 4.0; 433 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | }; 435 | name = Debug; 436 | }; 437 | 5B4BCF871FA9F206008F8370 /* Release */ = { 438 | isa = XCBuildConfiguration; 439 | baseConfigurationReference = C11A98D6A3AE9C10E1346A09 /* Pods-MoyaPromiseExample.release.xcconfig */; 440 | buildSettings = { 441 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 442 | CODE_SIGN_STYLE = Automatic; 443 | INFOPLIST_FILE = MoyaPromiseExample/Info.plist; 444 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 445 | PRODUCT_BUNDLE_IDENTIFIER = "Can-Sahin.MoyaPromiseExample"; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | SWIFT_VERSION = 4.0; 448 | TARGETED_DEVICE_FAMILY = "1,2"; 449 | }; 450 | name = Release; 451 | }; 452 | /* End XCBuildConfiguration section */ 453 | 454 | /* Begin XCConfigurationList section */ 455 | 5B4BCF631FA9F205008F8370 /* Build configuration list for PBXProject "MoyaPromiseExample" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | 5B4BCF831FA9F206008F8370 /* Debug */, 459 | 5B4BCF841FA9F206008F8370 /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | defaultConfigurationName = Release; 463 | }; 464 | 5B4BCF851FA9F206008F8370 /* Build configuration list for PBXNativeTarget "MoyaPromiseExample" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 5B4BCF861FA9F206008F8370 /* Debug */, 468 | 5B4BCF871FA9F206008F8370 /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | defaultConfigurationName = Release; 472 | }; 473 | /* End XCConfigurationList section */ 474 | }; 475 | rootObject = 5B4BCF601FA9F205008F8370 /* Project object */; 476 | } 477 | -------------------------------------------------------------------------------- /src/MoyaPromise.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5B1F0C502054B74D0016A663 /* DataService + Default.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C4F2054B74D0016A663 /* DataService + Default.swift */; }; 11 | 5B1F0C5A2054BB660016A663 /* DataServiceExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C532054BB650016A663 /* DataServiceExtensions.swift */; }; 12 | 5B1F0C5B2054BB660016A663 /* Plugins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C542054BB650016A663 /* Plugins.swift */; }; 13 | 5B1F0C5C2054BB660016A663 /* RequestPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C552054BB660016A663 /* RequestPolicy.swift */; }; 14 | 5B1F0C5D2054BB660016A663 /* Serialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C562054BB660016A663 /* Serialization.swift */; }; 15 | 5B1F0C5E2054BB660016A663 /* SampleDataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C572054BB660016A663 /* SampleDataService.swift */; }; 16 | 5B1F0C5F2054BB660016A663 /* MoyaProvider+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C582054BB660016A663 /* MoyaProvider+Promise.swift */; }; 17 | 5B1F0C602054BB660016A663 /* Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1F0C592054BB660016A663 /* Protocols.swift */; }; 18 | 5BEDD8CE20527AC80038D360 /* MoyaPromise.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5BEDD8C420527AC80038D360 /* MoyaPromise.framework */; }; 19 | 5BEDD8D320527AC80038D360 /* MoyaPromiseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BEDD8D220527AC80038D360 /* MoyaPromiseTests.swift */; }; 20 | 5BEDD8D520527AC80038D360 /* MoyaPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 5BEDD8C720527AC80038D360 /* MoyaPromise.h */; settings = {ATTRIBUTES = (Public, ); }; }; 21 | 63B710EE43ADB358E9199441 /* Pods_MoyaPromiseTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C6ECB97E1E8A4931A2649D0 /* Pods_MoyaPromiseTests.framework */; }; 22 | F3D284E3736981AF09C070E5 /* Pods_MoyaPromise.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0FF957F0C0184E6C3819E8CB /* Pods_MoyaPromise.framework */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 5BEDD8CF20527AC80038D360 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 5BEDD8BB20527AC80038D360 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 5BEDD8C320527AC80038D360; 31 | remoteInfo = MoyaPromise; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 0FF957F0C0184E6C3819E8CB /* Pods_MoyaPromise.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MoyaPromise.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 4B6E018656667430D3C671C9 /* Pods-MoyaPromise.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoyaPromise.release.xcconfig"; path = "Pods/Target Support Files/Pods-MoyaPromise/Pods-MoyaPromise.release.xcconfig"; sourceTree = ""; }; 38 | 5B1F0C4F2054B74D0016A663 /* DataService + Default.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DataService + Default.swift"; sourceTree = ""; }; 39 | 5B1F0C532054BB650016A663 /* DataServiceExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataServiceExtensions.swift; sourceTree = ""; }; 40 | 5B1F0C542054BB650016A663 /* Plugins.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Plugins.swift; sourceTree = ""; }; 41 | 5B1F0C552054BB660016A663 /* RequestPolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestPolicy.swift; sourceTree = ""; }; 42 | 5B1F0C562054BB660016A663 /* Serialization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Serialization.swift; sourceTree = ""; }; 43 | 5B1F0C572054BB660016A663 /* SampleDataService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleDataService.swift; sourceTree = ""; }; 44 | 5B1F0C582054BB660016A663 /* MoyaProvider+Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MoyaProvider+Promise.swift"; sourceTree = ""; }; 45 | 5B1F0C592054BB660016A663 /* Protocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Protocols.swift; sourceTree = ""; }; 46 | 5BEDD8C420527AC80038D360 /* MoyaPromise.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MoyaPromise.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 5BEDD8C720527AC80038D360 /* MoyaPromise.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoyaPromise.h; sourceTree = ""; }; 48 | 5BEDD8C820527AC80038D360 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 5BEDD8CD20527AC80038D360 /* MoyaPromiseTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MoyaPromiseTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 5BEDD8D220527AC80038D360 /* MoyaPromiseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoyaPromiseTests.swift; sourceTree = ""; }; 51 | 5BEDD8D420527AC80038D360 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 5C6ECB97E1E8A4931A2649D0 /* Pods_MoyaPromiseTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MoyaPromiseTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 6EC2BD3BBA499EEEEBD822D7 /* Pods-MoyaPromise.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoyaPromise.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MoyaPromise/Pods-MoyaPromise.debug.xcconfig"; sourceTree = ""; }; 54 | B2633A27D56E1B436A8DC4E6 /* Pods-MoyaPromiseTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoyaPromiseTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MoyaPromiseTests/Pods-MoyaPromiseTests.debug.xcconfig"; sourceTree = ""; }; 55 | C58C01ABBA8F4B336C48BD15 /* Pods-MoyaPromiseTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoyaPromiseTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MoyaPromiseTests/Pods-MoyaPromiseTests.release.xcconfig"; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 5BEDD8C020527AC80038D360 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | F3D284E3736981AF09C070E5 /* Pods_MoyaPromise.framework in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 5BEDD8CA20527AC80038D360 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 5BEDD8CE20527AC80038D360 /* MoyaPromise.framework in Frameworks */, 72 | 63B710EE43ADB358E9199441 /* Pods_MoyaPromiseTests.framework in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 025524DCF60DC50829F4B23E /* Pods */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 6EC2BD3BBA499EEEEBD822D7 /* Pods-MoyaPromise.debug.xcconfig */, 83 | 4B6E018656667430D3C671C9 /* Pods-MoyaPromise.release.xcconfig */, 84 | B2633A27D56E1B436A8DC4E6 /* Pods-MoyaPromiseTests.debug.xcconfig */, 85 | C58C01ABBA8F4B336C48BD15 /* Pods-MoyaPromiseTests.release.xcconfig */, 86 | ); 87 | name = Pods; 88 | sourceTree = ""; 89 | }; 90 | 5BEDD8BA20527AC80038D360 = { 91 | isa = PBXGroup; 92 | children = ( 93 | 5BEDD8C620527AC80038D360 /* MoyaPromise */, 94 | 5BEDD8D120527AC80038D360 /* MoyaPromiseTests */, 95 | 5BEDD8C520527AC80038D360 /* Products */, 96 | 025524DCF60DC50829F4B23E /* Pods */, 97 | E44E381FDE003F5236B61CCB /* Frameworks */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | 5BEDD8C520527AC80038D360 /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 5BEDD8C420527AC80038D360 /* MoyaPromise.framework */, 105 | 5BEDD8CD20527AC80038D360 /* MoyaPromiseTests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | 5BEDD8C620527AC80038D360 /* MoyaPromise */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 5B1F0C532054BB650016A663 /* DataServiceExtensions.swift */, 114 | 5B1F0C582054BB660016A663 /* MoyaProvider+Promise.swift */, 115 | 5B1F0C542054BB650016A663 /* Plugins.swift */, 116 | 5B1F0C592054BB660016A663 /* Protocols.swift */, 117 | 5B1F0C552054BB660016A663 /* RequestPolicy.swift */, 118 | 5B1F0C572054BB660016A663 /* SampleDataService.swift */, 119 | 5B1F0C562054BB660016A663 /* Serialization.swift */, 120 | 5B1F0C4F2054B74D0016A663 /* DataService + Default.swift */, 121 | 5BEDD8C720527AC80038D360 /* MoyaPromise.h */, 122 | 5BEDD8C820527AC80038D360 /* Info.plist */, 123 | ); 124 | path = MoyaPromise; 125 | sourceTree = ""; 126 | }; 127 | 5BEDD8D120527AC80038D360 /* MoyaPromiseTests */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 5BEDD8D220527AC80038D360 /* MoyaPromiseTests.swift */, 131 | 5BEDD8D420527AC80038D360 /* Info.plist */, 132 | ); 133 | path = MoyaPromiseTests; 134 | sourceTree = ""; 135 | }; 136 | E44E381FDE003F5236B61CCB /* Frameworks */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 0FF957F0C0184E6C3819E8CB /* Pods_MoyaPromise.framework */, 140 | 5C6ECB97E1E8A4931A2649D0 /* Pods_MoyaPromiseTests.framework */, 141 | ); 142 | name = Frameworks; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXHeadersBuildPhase section */ 148 | 5BEDD8C120527AC80038D360 /* Headers */ = { 149 | isa = PBXHeadersBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 5BEDD8D520527AC80038D360 /* MoyaPromise.h in Headers */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXHeadersBuildPhase section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 5BEDD8C320527AC80038D360 /* MoyaPromise */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 5BEDD8D820527AC80038D360 /* Build configuration list for PBXNativeTarget "MoyaPromise" */; 162 | buildPhases = ( 163 | A37FB6F7E41DD8FF0BD36C8E /* [CP] Check Pods Manifest.lock */, 164 | 5BEDD8BF20527AC80038D360 /* Sources */, 165 | 5BEDD8C020527AC80038D360 /* Frameworks */, 166 | 5BEDD8C120527AC80038D360 /* Headers */, 167 | 5BEDD8C220527AC80038D360 /* Resources */, 168 | 31F0189C83B81E92AA41CCDE /* [CP] Copy Pods Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = MoyaPromise; 175 | productName = MoyaPromise; 176 | productReference = 5BEDD8C420527AC80038D360 /* MoyaPromise.framework */; 177 | productType = "com.apple.product-type.framework"; 178 | }; 179 | 5BEDD8CC20527AC80038D360 /* MoyaPromiseTests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 5BEDD8DB20527AC80038D360 /* Build configuration list for PBXNativeTarget "MoyaPromiseTests" */; 182 | buildPhases = ( 183 | 1DAEE422550CA7D2DF38F4D9 /* [CP] Check Pods Manifest.lock */, 184 | 5BEDD8C920527AC80038D360 /* Sources */, 185 | 5BEDD8CA20527AC80038D360 /* Frameworks */, 186 | 5BEDD8CB20527AC80038D360 /* Resources */, 187 | 7B9043E164A0F1BD1A7F3533 /* [CP] Embed Pods Frameworks */, 188 | 2F37FE3F1CCF8E793DE7E86C /* [CP] Copy Pods Resources */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | 5BEDD8D020527AC80038D360 /* PBXTargetDependency */, 194 | ); 195 | name = MoyaPromiseTests; 196 | productName = MoyaPromiseTests; 197 | productReference = 5BEDD8CD20527AC80038D360 /* MoyaPromiseTests.xctest */; 198 | productType = "com.apple.product-type.bundle.unit-test"; 199 | }; 200 | /* End PBXNativeTarget section */ 201 | 202 | /* Begin PBXProject section */ 203 | 5BEDD8BB20527AC80038D360 /* Project object */ = { 204 | isa = PBXProject; 205 | attributes = { 206 | LastSwiftUpdateCheck = 0910; 207 | LastUpgradeCheck = 0910; 208 | ORGANIZATIONNAME = "Can Sahin"; 209 | TargetAttributes = { 210 | 5BEDD8C320527AC80038D360 = { 211 | CreatedOnToolsVersion = 9.1; 212 | LastSwiftMigration = 0910; 213 | ProvisioningStyle = Automatic; 214 | }; 215 | 5BEDD8CC20527AC80038D360 = { 216 | CreatedOnToolsVersion = 9.1; 217 | ProvisioningStyle = Automatic; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = 5BEDD8BE20527AC80038D360 /* Build configuration list for PBXProject "MoyaPromise" */; 222 | compatibilityVersion = "Xcode 8.0"; 223 | developmentRegion = en; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | ); 228 | mainGroup = 5BEDD8BA20527AC80038D360; 229 | productRefGroup = 5BEDD8C520527AC80038D360 /* Products */; 230 | projectDirPath = ""; 231 | projectRoot = ""; 232 | targets = ( 233 | 5BEDD8C320527AC80038D360 /* MoyaPromise */, 234 | 5BEDD8CC20527AC80038D360 /* MoyaPromiseTests */, 235 | ); 236 | }; 237 | /* End PBXProject section */ 238 | 239 | /* Begin PBXResourcesBuildPhase section */ 240 | 5BEDD8C220527AC80038D360 /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | 5BEDD8CB20527AC80038D360 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXShellScriptBuildPhase section */ 257 | 1DAEE422550CA7D2DF38F4D9 /* [CP] Check Pods Manifest.lock */ = { 258 | isa = PBXShellScriptBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | inputPaths = ( 263 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 264 | "${PODS_ROOT}/Manifest.lock", 265 | ); 266 | name = "[CP] Check Pods Manifest.lock"; 267 | outputPaths = ( 268 | "$(DERIVED_FILE_DIR)/Pods-MoyaPromiseTests-checkManifestLockResult.txt", 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 273 | showEnvVarsInLog = 0; 274 | }; 275 | 2F37FE3F1CCF8E793DE7E86C /* [CP] Copy Pods Resources */ = { 276 | isa = PBXShellScriptBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | inputPaths = ( 281 | ); 282 | name = "[CP] Copy Pods Resources"; 283 | outputPaths = ( 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | shellPath = /bin/sh; 287 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromiseTests/Pods-MoyaPromiseTests-resources.sh\"\n"; 288 | showEnvVarsInLog = 0; 289 | }; 290 | 31F0189C83B81E92AA41CCDE /* [CP] Copy Pods Resources */ = { 291 | isa = PBXShellScriptBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | inputPaths = ( 296 | ); 297 | name = "[CP] Copy Pods Resources"; 298 | outputPaths = ( 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | shellPath = /bin/sh; 302 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromise/Pods-MoyaPromise-resources.sh\"\n"; 303 | showEnvVarsInLog = 0; 304 | }; 305 | 7B9043E164A0F1BD1A7F3533 /* [CP] Embed Pods Frameworks */ = { 306 | isa = PBXShellScriptBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | ); 310 | inputPaths = ( 311 | "${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromiseTests/Pods-MoyaPromiseTests-frameworks.sh", 312 | "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", 313 | "${BUILT_PRODUCTS_DIR}/Moya/Moya.framework", 314 | "${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework", 315 | "${BUILT_PRODUCTS_DIR}/Result/Result.framework", 316 | ); 317 | name = "[CP] Embed Pods Frameworks"; 318 | outputPaths = ( 319 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", 320 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework", 321 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework", 322 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework", 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | shellPath = /bin/sh; 326 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MoyaPromiseTests/Pods-MoyaPromiseTests-frameworks.sh\"\n"; 327 | showEnvVarsInLog = 0; 328 | }; 329 | A37FB6F7E41DD8FF0BD36C8E /* [CP] Check Pods Manifest.lock */ = { 330 | isa = PBXShellScriptBuildPhase; 331 | buildActionMask = 2147483647; 332 | files = ( 333 | ); 334 | inputPaths = ( 335 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 336 | "${PODS_ROOT}/Manifest.lock", 337 | ); 338 | name = "[CP] Check Pods Manifest.lock"; 339 | outputPaths = ( 340 | "$(DERIVED_FILE_DIR)/Pods-MoyaPromise-checkManifestLockResult.txt", 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | shellPath = /bin/sh; 344 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 345 | showEnvVarsInLog = 0; 346 | }; 347 | /* End PBXShellScriptBuildPhase section */ 348 | 349 | /* Begin PBXSourcesBuildPhase section */ 350 | 5BEDD8BF20527AC80038D360 /* Sources */ = { 351 | isa = PBXSourcesBuildPhase; 352 | buildActionMask = 2147483647; 353 | files = ( 354 | 5B1F0C5F2054BB660016A663 /* MoyaProvider+Promise.swift in Sources */, 355 | 5B1F0C502054B74D0016A663 /* DataService + Default.swift in Sources */, 356 | 5B1F0C5A2054BB660016A663 /* DataServiceExtensions.swift in Sources */, 357 | 5B1F0C602054BB660016A663 /* Protocols.swift in Sources */, 358 | 5B1F0C5C2054BB660016A663 /* RequestPolicy.swift in Sources */, 359 | 5B1F0C5B2054BB660016A663 /* Plugins.swift in Sources */, 360 | 5B1F0C5D2054BB660016A663 /* Serialization.swift in Sources */, 361 | 5B1F0C5E2054BB660016A663 /* SampleDataService.swift in Sources */, 362 | ); 363 | runOnlyForDeploymentPostprocessing = 0; 364 | }; 365 | 5BEDD8C920527AC80038D360 /* Sources */ = { 366 | isa = PBXSourcesBuildPhase; 367 | buildActionMask = 2147483647; 368 | files = ( 369 | 5BEDD8D320527AC80038D360 /* MoyaPromiseTests.swift in Sources */, 370 | ); 371 | runOnlyForDeploymentPostprocessing = 0; 372 | }; 373 | /* End PBXSourcesBuildPhase section */ 374 | 375 | /* Begin PBXTargetDependency section */ 376 | 5BEDD8D020527AC80038D360 /* PBXTargetDependency */ = { 377 | isa = PBXTargetDependency; 378 | target = 5BEDD8C320527AC80038D360 /* MoyaPromise */; 379 | targetProxy = 5BEDD8CF20527AC80038D360 /* PBXContainerItemProxy */; 380 | }; 381 | /* End PBXTargetDependency section */ 382 | 383 | /* Begin XCBuildConfiguration section */ 384 | 5BEDD8D620527AC80038D360 /* Debug */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ALWAYS_SEARCH_USER_PATHS = NO; 388 | CLANG_ANALYZER_NONNULL = YES; 389 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 390 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 391 | CLANG_CXX_LIBRARY = "libc++"; 392 | CLANG_ENABLE_MODULES = YES; 393 | CLANG_ENABLE_OBJC_ARC = YES; 394 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_COMMA = YES; 397 | CLANG_WARN_CONSTANT_CONVERSION = YES; 398 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 399 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 400 | CLANG_WARN_EMPTY_BODY = YES; 401 | CLANG_WARN_ENUM_CONVERSION = YES; 402 | CLANG_WARN_INFINITE_RECURSION = YES; 403 | CLANG_WARN_INT_CONVERSION = YES; 404 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 405 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 407 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 408 | CLANG_WARN_STRICT_PROTOTYPES = YES; 409 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 410 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | CODE_SIGN_IDENTITY = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | CURRENT_PROJECT_VERSION = 1; 416 | DEBUG_INFORMATION_FORMAT = dwarf; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | ENABLE_TESTABILITY = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu11; 420 | GCC_DYNAMIC_NO_PIC = NO; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_OPTIMIZATION_LEVEL = 0; 423 | GCC_PREPROCESSOR_DEFINITIONS = ( 424 | "DEBUG=1", 425 | "$(inherited)", 426 | ); 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 434 | MTL_ENABLE_DEBUG_INFO = YES; 435 | ONLY_ACTIVE_ARCH = YES; 436 | SDKROOT = iphoneos; 437 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 438 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 439 | VERSIONING_SYSTEM = "apple-generic"; 440 | VERSION_INFO_PREFIX = ""; 441 | }; 442 | name = Debug; 443 | }; 444 | 5BEDD8D720527AC80038D360 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ALWAYS_SEARCH_USER_PATHS = NO; 448 | CLANG_ANALYZER_NONNULL = YES; 449 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 450 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 451 | CLANG_CXX_LIBRARY = "libc++"; 452 | CLANG_ENABLE_MODULES = YES; 453 | CLANG_ENABLE_OBJC_ARC = YES; 454 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 455 | CLANG_WARN_BOOL_CONVERSION = YES; 456 | CLANG_WARN_COMMA = YES; 457 | CLANG_WARN_CONSTANT_CONVERSION = YES; 458 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 459 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 460 | CLANG_WARN_EMPTY_BODY = YES; 461 | CLANG_WARN_ENUM_CONVERSION = YES; 462 | CLANG_WARN_INFINITE_RECURSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 465 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 466 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 467 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 468 | CLANG_WARN_STRICT_PROTOTYPES = YES; 469 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 470 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 471 | CLANG_WARN_UNREACHABLE_CODE = YES; 472 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 473 | CODE_SIGN_IDENTITY = "iPhone Developer"; 474 | COPY_PHASE_STRIP = NO; 475 | CURRENT_PROJECT_VERSION = 1; 476 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 477 | ENABLE_NS_ASSERTIONS = NO; 478 | ENABLE_STRICT_OBJC_MSGSEND = YES; 479 | GCC_C_LANGUAGE_STANDARD = gnu11; 480 | GCC_NO_COMMON_BLOCKS = YES; 481 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 482 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 483 | GCC_WARN_UNDECLARED_SELECTOR = YES; 484 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 485 | GCC_WARN_UNUSED_FUNCTION = YES; 486 | GCC_WARN_UNUSED_VARIABLE = YES; 487 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 488 | MTL_ENABLE_DEBUG_INFO = NO; 489 | SDKROOT = iphoneos; 490 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 491 | VALIDATE_PRODUCT = YES; 492 | VERSIONING_SYSTEM = "apple-generic"; 493 | VERSION_INFO_PREFIX = ""; 494 | }; 495 | name = Release; 496 | }; 497 | 5BEDD8D920527AC80038D360 /* Debug */ = { 498 | isa = XCBuildConfiguration; 499 | baseConfigurationReference = 6EC2BD3BBA499EEEEBD822D7 /* Pods-MoyaPromise.debug.xcconfig */; 500 | buildSettings = { 501 | CLANG_ENABLE_MODULES = YES; 502 | CODE_SIGN_IDENTITY = ""; 503 | CODE_SIGN_STYLE = Automatic; 504 | DEFINES_MODULE = YES; 505 | DYLIB_COMPATIBILITY_VERSION = 1; 506 | DYLIB_CURRENT_VERSION = 1; 507 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 508 | INFOPLIST_FILE = MoyaPromise/Info.plist; 509 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 510 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 511 | PRODUCT_BUNDLE_IDENTIFIER = "Can-Sahin.MoyaPromise"; 512 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 513 | SKIP_INSTALL = YES; 514 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 515 | SWIFT_VERSION = 4.0; 516 | TARGETED_DEVICE_FAMILY = "1,2"; 517 | }; 518 | name = Debug; 519 | }; 520 | 5BEDD8DA20527AC80038D360 /* Release */ = { 521 | isa = XCBuildConfiguration; 522 | baseConfigurationReference = 4B6E018656667430D3C671C9 /* Pods-MoyaPromise.release.xcconfig */; 523 | buildSettings = { 524 | CLANG_ENABLE_MODULES = YES; 525 | CODE_SIGN_IDENTITY = ""; 526 | CODE_SIGN_STYLE = Automatic; 527 | DEFINES_MODULE = YES; 528 | DYLIB_COMPATIBILITY_VERSION = 1; 529 | DYLIB_CURRENT_VERSION = 1; 530 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 531 | INFOPLIST_FILE = MoyaPromise/Info.plist; 532 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 533 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 534 | PRODUCT_BUNDLE_IDENTIFIER = "Can-Sahin.MoyaPromise"; 535 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 536 | SKIP_INSTALL = YES; 537 | SWIFT_VERSION = 4.0; 538 | TARGETED_DEVICE_FAMILY = "1,2"; 539 | }; 540 | name = Release; 541 | }; 542 | 5BEDD8DC20527AC80038D360 /* Debug */ = { 543 | isa = XCBuildConfiguration; 544 | baseConfigurationReference = B2633A27D56E1B436A8DC4E6 /* Pods-MoyaPromiseTests.debug.xcconfig */; 545 | buildSettings = { 546 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 547 | CODE_SIGN_STYLE = Automatic; 548 | INFOPLIST_FILE = MoyaPromiseTests/Info.plist; 549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 550 | PRODUCT_BUNDLE_IDENTIFIER = "Can-Sahin.MoyaPromiseTests"; 551 | PRODUCT_NAME = "$(TARGET_NAME)"; 552 | SWIFT_VERSION = 4.0; 553 | TARGETED_DEVICE_FAMILY = "1,2"; 554 | }; 555 | name = Debug; 556 | }; 557 | 5BEDD8DD20527AC80038D360 /* Release */ = { 558 | isa = XCBuildConfiguration; 559 | baseConfigurationReference = C58C01ABBA8F4B336C48BD15 /* Pods-MoyaPromiseTests.release.xcconfig */; 560 | buildSettings = { 561 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 562 | CODE_SIGN_STYLE = Automatic; 563 | INFOPLIST_FILE = MoyaPromiseTests/Info.plist; 564 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 565 | PRODUCT_BUNDLE_IDENTIFIER = "Can-Sahin.MoyaPromiseTests"; 566 | PRODUCT_NAME = "$(TARGET_NAME)"; 567 | SWIFT_VERSION = 4.0; 568 | TARGETED_DEVICE_FAMILY = "1,2"; 569 | }; 570 | name = Release; 571 | }; 572 | /* End XCBuildConfiguration section */ 573 | 574 | /* Begin XCConfigurationList section */ 575 | 5BEDD8BE20527AC80038D360 /* Build configuration list for PBXProject "MoyaPromise" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 5BEDD8D620527AC80038D360 /* Debug */, 579 | 5BEDD8D720527AC80038D360 /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | 5BEDD8D820527AC80038D360 /* Build configuration list for PBXNativeTarget "MoyaPromise" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 5BEDD8D920527AC80038D360 /* Debug */, 588 | 5BEDD8DA20527AC80038D360 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | 5BEDD8DB20527AC80038D360 /* Build configuration list for PBXNativeTarget "MoyaPromiseTests" */ = { 594 | isa = XCConfigurationList; 595 | buildConfigurations = ( 596 | 5BEDD8DC20527AC80038D360 /* Debug */, 597 | 5BEDD8DD20527AC80038D360 /* Release */, 598 | ); 599 | defaultConfigurationIsVisible = 0; 600 | defaultConfigurationName = Release; 601 | }; 602 | /* End XCConfigurationList section */ 603 | }; 604 | rootObject = 5BEDD8BB20527AC80038D360 /* Project object */; 605 | } 606 | --------------------------------------------------------------------------------