├── .DS_Store ├── .gitattributes ├── HttpRequest ├── .DS_Store ├── Assets.xcassets │ ├── Contents.json │ ├── Alert │ │ ├── Contents.json │ │ ├── Alert_info.imageset │ │ │ ├── info_96px_1201117_easyicon.net.png │ │ │ ├── info_128px_1201117_easyicon.net.png │ │ │ └── Contents.json │ │ ├── Alert_error.imageset │ │ │ ├── error_128px_1201052_easyicon.net.png │ │ │ ├── error_96px_1201052_easyicon.net.png │ │ │ └── Contents.json │ │ ├── Alert_success.imageset │ │ │ ├── success_128px_1201384_easyicon.net.png │ │ │ ├── success_96px_1201384_easyicon.net.png │ │ │ └── Contents.json │ │ └── Alert_warning.imageset │ │ │ ├── warning_128px_1201426_easyicon.net.png │ │ │ ├── warning_96px_1201426_easyicon.net.png │ │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── BaseModel.swift ├── DMModel.swift ├── DMAPI.swift ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── Utils │ ├── HUD.swift │ └── SaveFiles.swift ├── Info.plist ├── Moya │ ├── MoyaConfig.swift │ └── HttpRequest.swift ├── AppDelegate.swift └── DMCell.swift ├── Pods ├── Target Support Files │ ├── Moya │ │ ├── Moya.modulemap │ │ ├── Moya-dummy.m │ │ ├── Moya-prefix.pch │ │ ├── Moya-umbrella.h │ │ ├── Moya.xcconfig │ │ ├── Info.plist │ │ └── Moya-Info.plist │ ├── Result │ │ ├── Result.modulemap │ │ ├── Result-dummy.m │ │ ├── Result-prefix.pch │ │ ├── Result-umbrella.h │ │ ├── Result.xcconfig │ │ ├── Info.plist │ │ └── Result-Info.plist │ ├── SnapKit │ │ ├── SnapKit.modulemap │ │ ├── SnapKit-dummy.m │ │ ├── SnapKit-prefix.pch │ │ ├── SnapKit-umbrella.h │ │ ├── SnapKit.xcconfig │ │ ├── Info.plist │ │ └── SnapKit-Info.plist │ ├── Alamofire │ │ ├── Alamofire.modulemap │ │ ├── Alamofire-dummy.m │ │ ├── Alamofire-prefix.pch │ │ ├── Alamofire-umbrella.h │ │ ├── Alamofire.xcconfig │ │ ├── Info.plist │ │ └── Alamofire-Info.plist │ ├── Kingfisher │ │ ├── Kingfisher.modulemap │ │ ├── Kingfisher-dummy.m │ │ ├── Kingfisher-prefix.pch │ │ ├── Kingfisher-umbrella.h │ │ ├── Kingfisher.xcconfig │ │ ├── Info.plist │ │ └── Kingfisher-Info.plist │ ├── MBProgressHUD │ │ ├── MBProgressHUD.modulemap │ │ ├── MBProgressHUD-dummy.m │ │ ├── MBProgressHUD-prefix.pch │ │ ├── MBProgressHUD-umbrella.h │ │ ├── MBProgressHUD.xcconfig │ │ ├── Info.plist │ │ └── MBProgressHUD-Info.plist │ └── Pods-HttpRequest │ │ ├── Pods-HttpRequest.modulemap │ │ ├── Pods-HttpRequest-dummy.m │ │ ├── Pods-HttpRequest-umbrella.h │ │ ├── Info.plist │ │ ├── Pods-HttpRequest-Info.plist │ │ ├── Pods-HttpRequest.debug.xcconfig │ │ └── Pods-HttpRequest.release.xcconfig ├── Moya │ ├── Sources │ │ └── Moya │ │ │ ├── Image.swift │ │ │ ├── AnyEncodable.swift │ │ │ ├── URL+Moya.swift │ │ │ ├── Cancellable.swift │ │ │ ├── Plugins │ │ │ ├── CredentialsPlugin.swift │ │ │ ├── NetworkActivityPlugin.swift │ │ │ └── AccessTokenPlugin.swift │ │ │ ├── URLRequest+Encoding.swift │ │ │ ├── TargetType.swift │ │ │ ├── ValidationType.swift │ │ │ ├── MultiTarget.swift │ │ │ ├── MoyaProvider+Defaults.swift │ │ │ ├── Task.swift │ │ │ ├── Plugin.swift │ │ │ ├── MultipartFormData.swift │ │ │ └── MoyaError.swift │ └── License.md ├── Result │ ├── Result │ │ ├── NoError.swift │ │ └── AnyError.swift │ └── LICENSE ├── Manifest.lock ├── MBProgressHUD │ └── LICENSE ├── Kingfisher │ ├── LICENSE │ └── Sources │ │ ├── Box.swift │ │ ├── Kingfisher.h │ │ ├── ThreadHelper.swift │ │ ├── RequestModifier.swift │ │ ├── Kingfisher.swift │ │ └── Resource.swift ├── SnapKit │ ├── LICENSE │ └── Source │ │ ├── ConstraintView.swift │ │ ├── ConstraintInsets.swift │ │ ├── ConstraintLayoutSupport.swift │ │ ├── UILayoutSupport+Extensions.swift │ │ ├── ConstraintLayoutGuide+Extensions.swift │ │ ├── ConstraintLayoutGuide.swift │ │ ├── ConstraintConfig.swift │ │ ├── ConstraintRelation.swift │ │ ├── Typealiases.swift │ │ ├── ConstraintMakerFinalizable.swift │ │ ├── ConstraintRelatableTarget.swift │ │ ├── LayoutConstraint.swift │ │ ├── ConstraintLayoutSupportDSL.swift │ │ ├── ConstraintItem.swift │ │ ├── ConstraintMakerEditable.swift │ │ ├── ConstraintMultiplierTarget.swift │ │ ├── ConstraintOffsetTarget.swift │ │ ├── ConstraintPriorityTarget.swift │ │ ├── ConstraintLayoutGuideDSL.swift │ │ ├── ConstraintPriority.swift │ │ ├── ConstraintMakerPriortizable.swift │ │ ├── ConstraintDescription.swift │ │ └── ConstraintInsetTarget.swift ├── Alamofire │ ├── LICENSE │ └── Source │ │ └── DispatchQueue+Alamofire.swift └── Pods.xcodeproj │ └── xcuserdata │ ├── yj.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── jinyuannan.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── yijin.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ ├── Moya.xcscheme │ │ ├── Result.xcscheme │ │ ├── SnapKit.xcscheme │ │ ├── Alamofire.xcscheme │ │ ├── Kingfisher.xcscheme │ │ ├── MBProgressHUD.xcscheme │ │ └── Pods-HttpRequest.xcscheme │ └── duodiankeji.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ ├── Moya.xcscheme │ ├── Result.xcscheme │ ├── SnapKit.xcscheme │ ├── Alamofire.xcscheme │ ├── Kingfisher.xcscheme │ ├── MBProgressHUD.xcscheme │ └── Pods-HttpRequest.xcscheme ├── HttpRequest.xcworkspace ├── xcuserdata │ ├── yijin.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── UserInterfaceState.xcuserstate │ ├── duodiankeji.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── UserInterfaceState.xcuserstate │ ├── yj.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ └── jinyuannan.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── HttpRequest.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ ├── yijin.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── jinyuannan.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ ├── yijin.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── duodiankeji.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── jinyuannan.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── yj.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── 说明.md ├── Podfile ├── HttpRequestTests ├── Info.plist └── HttpRequestTests.swift ├── HttpRequestUITests ├── Info.plist └── HttpRequestUITests.swift ├── Podfile.lock └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /HttpRequest/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/.DS_Store -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Moya.modulemap: -------------------------------------------------------------------------------- 1 | framework module Moya { 2 | umbrella header "Moya-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Moya-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Moya : NSObject 3 | @end 4 | @implementation PodsDummy_Moya 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result.modulemap: -------------------------------------------------------------------------------- 1 | framework module Result { 2 | umbrella header "Result-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Result : NSObject 3 | @end 4 | @implementation PodsDummy_Result 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit.modulemap: -------------------------------------------------------------------------------- 1 | framework module SnapKit { 2 | umbrella header "SnapKit-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire.modulemap: -------------------------------------------------------------------------------- 1 | framework module Alamofire { 2 | umbrella header "Alamofire-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SnapKit : NSObject 3 | @end 4 | @implementation PodsDummy_SnapKit 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Kingfisher.modulemap: -------------------------------------------------------------------------------- 1 | framework module Kingfisher { 2 | umbrella header "Kingfisher-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Alamofire : NSObject 3 | @end 4 | @implementation PodsDummy_Alamofire 5 | @end 6 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/yijin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Kingfisher-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Kingfisher : NSObject 3 | @end 4 | @implementation PodsDummy_Kingfisher 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD.modulemap: -------------------------------------------------------------------------------- 1 | framework module MBProgressHUD { 2 | umbrella header "MBProgressHUD-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/duodiankeji.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_MBProgressHUD : NSObject 3 | @end 4 | @implementation PodsDummy_MBProgressHUD 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Pods-HttpRequest.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_HttpRequest { 2 | umbrella header "Pods-HttpRequest-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/yj.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest.xcworkspace/xcuserdata/yj.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Pods-HttpRequest-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HttpRequest : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HttpRequest 5 | @end 6 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/yijin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest.xcworkspace/xcuserdata/yijin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/jinyuannan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest.xcworkspace/xcuserdata/jinyuannan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_info.imageset/info_96px_1201117_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_info.imageset/info_96px_1201117_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/duodiankeji.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest.xcworkspace/xcuserdata/duodiankeji.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_error.imageset/error_128px_1201052_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_error.imageset/error_128px_1201052_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_error.imageset/error_96px_1201052_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_error.imageset/error_96px_1201052_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_info.imageset/info_128px_1201117_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_info.imageset/info_128px_1201117_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_success.imageset/success_128px_1201384_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_success.imageset/success_128px_1201384_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_success.imageset/success_96px_1201384_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_success.imageset/success_96px_1201384_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_warning.imageset/warning_128px_1201426_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_warning.imageset/warning_128px_1201426_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_warning.imageset/warning_96px_1201426_easyicon.net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest/Assets.xcassets/Alert/Alert_warning.imageset/warning_96px_1201426_easyicon.net.png -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/jinyuannan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/project.xcworkspace/xcuserdata/yijin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest.xcodeproj/project.xcworkspace/xcuserdata/yijin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/project.xcworkspace/xcuserdata/jinyuannan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Habit21D/SwiftHttpRequest/HEAD/HttpRequest.xcodeproj/project.xcworkspace/xcuserdata/jinyuannan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /说明.md: -------------------------------------------------------------------------------- 1 | ## Demo说明(Swift5.2) 2 | 1.MoyaConfig文件需要根据项目进行配置。每一项代码中都有明确的注释。请仔细阅读 3 | 4 | 2.Moya文件夹中:MoyaBase是对Moya的封装; 5 | /Moya/MoyaBase/组件可以不更改,当然,你也可以自定义组件; 6 | /Moya/MoyaAPI里是后台接口及model文件 7 | 8 | 3./Moya/MoyaBase/HttpRequest需要自己重写跳转登录的代码,如果用不到可以删除或者将HttpCode.needLogin改为不可能用到的值 9 | 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Moya-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | 2 | source 'https://github.com/aliyun/aliyun-specs.git' 3 | platform :ios, '8.0' 4 | use_frameworks! 5 | 6 | target 'HttpRequest' do 7 | #-- OC库 8 | pod 'MBProgressHUD' 9 | 10 | #-- swift5.0 11 | pod 'Moya' 12 | pod 'SnapKit' 13 | pod 'Kingfisher' 14 | end 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Kingfisher-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Image.swift: -------------------------------------------------------------------------------- 1 | #if os(iOS) || os(watchOS) || os(tvOS) 2 | import UIKit.UIImage 3 | public typealias ImageType = UIImage 4 | #elseif os(macOS) 5 | import AppKit.NSImage 6 | public typealias ImageType = NSImage 7 | #endif 8 | 9 | /// An alias for the SDK's image type. 10 | public typealias Image = ImageType 11 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/AnyEncodable.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct AnyEncodable: Encodable { 4 | 5 | private let encodable: Encodable 6 | 7 | public init(_ encodable: Encodable) { 8 | self.encodable = encodable 9 | } 10 | 11 | func encode(to encoder: Encoder) throws { 12 | try encodable.encode(to: encoder) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Moya-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double MoyaVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char MoyaVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double ResultVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char ResultVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double SnapKitVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double AlamofireVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char AlamofireVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Result/Result/NoError.swift: -------------------------------------------------------------------------------- 1 | /// An “error” that is impossible to construct. 2 | /// 3 | /// This can be used to describe `Result`s where failures will never 4 | /// be generated. For example, `Result` describes a result that 5 | /// contains an `Int`eger and is guaranteed never to be a `failure`. 6 | public enum NoError: Swift.Error, Equatable { 7 | public static func ==(lhs: NoError, rhs: NoError) -> Bool { 8 | return true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Pods-HttpRequest-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_HttpRequestVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_HttpRequestVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Kingfisher-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Kingfisher.h" 14 | 15 | FOUNDATION_EXPORT double KingfisherVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char KingfisherVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HttpRequest.xcscheme 8 | 9 | orderHint 10 | 7 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "MBProgressHUD.h" 14 | 15 | FOUNDATION_EXPORT double MBProgressHUDVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char MBProgressHUDVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HttpRequest.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 7 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/xcuserdata/jinyuannan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HttpRequest.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 4 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /HttpRequest/BaseModel.swift: -------------------------------------------------------------------------------- 1 | 2 | enum HttpCode : Int { 3 | case success = 1 //请求成功的状态吗 4 | case needLogin = -1 // 返回需要登录的错误码 5 | } 6 | 7 | struct BaseModel: Decodable { 8 | var code: Int 9 | var data: Content 10 | struct Content: Decodable { 11 | var message: String 12 | } 13 | } 14 | 15 | 16 | extension BaseModel { 17 | var generalCode: Int { 18 | return code 19 | } 20 | 21 | var generalMessage: String { 22 | return data.message 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Result 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Result 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_info.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "info_96px_1201117_easyicon.net.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "info_128px_1201117_easyicon.net.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Alamofire 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_error.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "error_96px_1201052_easyicon.net.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "error_128px_1201052_easyicon.net.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_success.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "success_96px_1201384_easyicon.net.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "success_128px_1201384_easyicon.net.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /HttpRequest/Assets.xcassets/Alert/Alert_warning.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "warning_96px_1201426_easyicon.net.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "warning_128px_1201426_easyicon.net.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "QuartzCore" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/MBProgressHUD 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Kingfisher.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Kingfisher 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/URL+Moya.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public extension URL { 4 | 5 | /// Initialize URL from Moya's `TargetType`. 6 | init(target: T) { 7 | // When a TargetType's path is empty, URL.appendingPathComponent may introduce trailing /, which may not be wanted in some cases 8 | // See: https://github.com/Moya/Moya/pull/1053 9 | // And: https://github.com/Moya/Moya/issues/1049 10 | if target.path.isEmpty { 11 | self = target.baseURL 12 | } else { 13 | self = target.baseURL.appendingPathComponent(target.path) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HttpRequest/DMModel.swift: -------------------------------------------------------------------------------- 1 | // rankList的model 2 | 3 | import Foundation 4 | 5 | struct DMModel: Codable { 6 | var code: Int 7 | var data: DMData 8 | struct DMData: Codable { 9 | var stateCode: Int 10 | var message: String 11 | var returnData: DMReturnData? 12 | } 13 | 14 | struct DMReturnData: Codable { 15 | var rankinglist: [DMRankingList]? 16 | } 17 | 18 | struct DMRankingList: Codable { 19 | var title: String 20 | var subTitle: String 21 | var cover: String 22 | var argName: String 23 | var argValue: Int 24 | var rankingType: String 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Moya.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Moya 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Result" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" 5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Moya 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Cancellable.swift: -------------------------------------------------------------------------------- 1 | /// Protocol to define the opaque type returned from a request. 2 | public protocol Cancellable { 3 | 4 | /// A Boolean value stating whether a request is cancelled. 5 | var isCancelled: Bool { get } 6 | 7 | /// Cancels the represented request. 8 | func cancel() 9 | } 10 | 11 | internal class CancellableWrapper: Cancellable { 12 | internal var innerCancellable: Cancellable = SimpleCancellable() 13 | 14 | var isCancelled: Bool { return innerCancellable.isCancelled } 15 | 16 | internal func cancel() { 17 | innerCancellable.cancel() 18 | } 19 | } 20 | 21 | internal class SimpleCancellable: Cancellable { 22 | var isCancelled = false 23 | func cancel() { 24 | isCancelled = true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | /// Provides each request with optional URLCredentials. 5 | public final class CredentialsPlugin: PluginType { 6 | 7 | public typealias CredentialClosure = (TargetType) -> URLCredential? 8 | let credentialsClosure: CredentialClosure 9 | 10 | /// Initializes a CredentialsPlugin. 11 | public init(credentialsClosure: @escaping CredentialClosure) { 12 | self.credentialsClosure = credentialsClosure 13 | } 14 | 15 | // MARK: Plugin 16 | 17 | public func willSend(_ request: RequestType, target: TargetType) { 18 | if let credentials = credentialsClosure(target) { 19 | _ = request.authenticate(usingCredential: credentials) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /HttpRequestTests/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 | -------------------------------------------------------------------------------- /HttpRequestUITests/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 | -------------------------------------------------------------------------------- /HttpRequest.xcodeproj/xcuserdata/yj.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HttpRequest.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E963E8291FFF1C050047B134 16 | 17 | primary 18 | 19 | 20 | E963E83D1FFF1C050047B134 21 | 22 | primary 23 | 24 | 25 | E963E8481FFF1C050047B134 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 10.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 3.2.4 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.6.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.6.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Moya/Moya-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 12.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.8.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Kingfisher/Kingfisher-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 4.10.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Pods-HttpRequest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.8.2) 3 | - Kingfisher (4.10.1) 4 | - MBProgressHUD (1.1.0) 5 | - Moya (12.0.1): 6 | - Moya/Core (= 12.0.1) 7 | - Moya/Core (12.0.1): 8 | - Alamofire (~> 4.1) 9 | - Result (~> 4.0) 10 | - Result (4.1.0) 11 | - SnapKit (4.2.0) 12 | 13 | DEPENDENCIES: 14 | - Kingfisher 15 | - MBProgressHUD 16 | - Moya 17 | - SnapKit 18 | 19 | SPEC REPOS: 20 | https://github.com/cocoapods/specs.git: 21 | - Alamofire 22 | - Kingfisher 23 | - MBProgressHUD 24 | - Moya 25 | - Result 26 | - SnapKit 27 | 28 | SPEC CHECKSUMS: 29 | Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3 30 | Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0 31 | MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9 32 | Moya: cf730b3cd9e005401ef37a85143aa141a12fd38f 33 | Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 34 | SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a 35 | 36 | PODFILE CHECKSUM: 0cad825e9b5a0c5287e57b877109237ead97a6c5 37 | 38 | COCOAPODS: 1.7.1 39 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.8.2) 3 | - Kingfisher (4.10.1) 4 | - MBProgressHUD (1.1.0) 5 | - Moya (12.0.1): 6 | - Moya/Core (= 12.0.1) 7 | - Moya/Core (12.0.1): 8 | - Alamofire (~> 4.1) 9 | - Result (~> 4.0) 10 | - Result (4.1.0) 11 | - SnapKit (4.2.0) 12 | 13 | DEPENDENCIES: 14 | - Kingfisher 15 | - MBProgressHUD 16 | - Moya 17 | - SnapKit 18 | 19 | SPEC REPOS: 20 | https://github.com/cocoapods/specs.git: 21 | - Alamofire 22 | - Kingfisher 23 | - MBProgressHUD 24 | - Moya 25 | - Result 26 | - SnapKit 27 | 28 | SPEC CHECKSUMS: 29 | Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3 30 | Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0 31 | MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9 32 | Moya: cf730b3cd9e005401ef37a85143aa141a12fd38f 33 | Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 34 | SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a 35 | 36 | PODFILE CHECKSUM: 0cad825e9b5a0c5287e57b877109237ead97a6c5 37 | 38 | COCOAPODS: 1.7.1 39 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/URLRequest+Encoding.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal extension URLRequest { 4 | 5 | mutating func encoded(encodable: Encodable, encoder: JSONEncoder = JSONEncoder()) throws -> URLRequest { 6 | do { 7 | let encodable = AnyEncodable(encodable) 8 | httpBody = try encoder.encode(encodable) 9 | 10 | let contentTypeHeaderName = "Content-Type" 11 | if value(forHTTPHeaderField: contentTypeHeaderName) == nil { 12 | setValue("application/json", forHTTPHeaderField: contentTypeHeaderName) 13 | } 14 | 15 | return self 16 | } catch { 17 | throw MoyaError.encodableMapping(error) 18 | } 19 | } 20 | 21 | func encoded(parameters: [String: Any], parameterEncoding: ParameterEncoding) throws -> URLRequest { 22 | do { 23 | return try parameterEncoding.encode(self, with: parameters) 24 | } catch { 25 | throw MoyaError.parameterEncoding(error) 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Pods/MBProgressHUD/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © 2009-2016 Matej Bukovinski 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /HttpRequestTests/HttpRequestTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HttpRequestTests.swift 3 | // HttpRequestTests 4 | // 5 | // Created by 易金 on 2018/1/5. 6 | // Copyright © 2018年 jin. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import HttpRequest 11 | 12 | class HttpRequestTests: 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 | -------------------------------------------------------------------------------- /Pods/Result/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Rob Rix 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. -------------------------------------------------------------------------------- /Pods/Kingfisher/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Wei Wang 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 | 23 | -------------------------------------------------------------------------------- /Pods/SnapKit/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Alamofire/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Moya/License.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-present Artsy, Ash Furrow 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 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yj.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Alamofire.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | Kingfisher.xcscheme 13 | 14 | orderHint 15 | 2 16 | 17 | MBProgressHUD.xcscheme 18 | 19 | orderHint 20 | 3 21 | 22 | Moya.xcscheme 23 | 24 | orderHint 25 | 4 26 | 27 | Pods-HttpRequest.xcscheme 28 | 29 | orderHint 30 | 5 31 | 32 | Result.xcscheme 33 | 34 | orderHint 35 | 6 36 | 37 | SnapKit.xcscheme 38 | 39 | orderHint 40 | 7 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Pods/Result/Result/AnyError.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A type-erased error which wraps an arbitrary error instance. This should be 4 | /// useful for generic contexts. 5 | public struct AnyError: Swift.Error { 6 | /// The underlying error. 7 | public let error: Swift.Error 8 | 9 | public init(_ error: Swift.Error) { 10 | if let anyError = error as? AnyError { 11 | self = anyError 12 | } else { 13 | self.error = error 14 | } 15 | } 16 | } 17 | 18 | extension AnyError: ErrorConvertible { 19 | public static func error(from error: Error) -> AnyError { 20 | return AnyError(error) 21 | } 22 | } 23 | 24 | extension AnyError: CustomStringConvertible { 25 | public var description: String { 26 | return String(describing: error) 27 | } 28 | } 29 | 30 | extension AnyError: LocalizedError { 31 | public var errorDescription: String? { 32 | return error.localizedDescription 33 | } 34 | 35 | public var failureReason: String? { 36 | return (error as? LocalizedError)?.failureReason 37 | } 38 | 39 | public var helpAnchor: String? { 40 | return (error as? LocalizedError)?.helpAnchor 41 | } 42 | 43 | public var recoverySuggestion: String? { 44 | return (error as? LocalizedError)?.recoverySuggestion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | /// Network activity change notification type. 5 | public enum NetworkActivityChangeType { 6 | case began, ended 7 | } 8 | 9 | /// Notify a request's network activity changes (request begins or ends). 10 | public final class NetworkActivityPlugin: PluginType { 11 | 12 | public typealias NetworkActivityClosure = (_ change: NetworkActivityChangeType, _ target: TargetType) -> Void 13 | let networkActivityClosure: NetworkActivityClosure 14 | 15 | /// Initializes a NetworkActivityPlugin. 16 | public init(networkActivityClosure: @escaping NetworkActivityClosure) { 17 | self.networkActivityClosure = networkActivityClosure 18 | } 19 | 20 | // MARK: Plugin 21 | 22 | /// Called by the provider as soon as the request is about to start 23 | public func willSend(_ request: RequestType, target: TargetType) { 24 | networkActivityClosure(.began, target) 25 | } 26 | 27 | /// Called by the provider as soon as a response arrives, even if the request is canceled. 28 | public func didReceive(_ result: Result, target: TargetType) { 29 | networkActivityClosure(.ended, target) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/jinyuannan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Alamofire.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | Kingfisher.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | MBProgressHUD.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 6 21 | 22 | Moya.xcscheme_^#shared#^_ 23 | 24 | orderHint 25 | 2 26 | 27 | Pods-HttpRequest.xcscheme_^#shared#^_ 28 | 29 | orderHint 30 | 3 31 | 32 | Result.xcscheme_^#shared#^_ 33 | 34 | orderHint 35 | 7 36 | 37 | SnapKit.xcscheme_^#shared#^_ 38 | 39 | orderHint 40 | 5 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /HttpRequest.xcworkspace/xcuserdata/yj.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 12 | 13 | 14 | 16 | 22 | 23 | 24 | 25 | 26 | 28 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/TargetType.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// The protocol used to define the specifications necessary for a `MoyaProvider`. 4 | public protocol TargetType { 5 | 6 | /// The target's base `URL`. 7 | var baseURL: URL { get } 8 | 9 | /// The path to be appended to `baseURL` to form the full `URL`. 10 | var path: String { get } 11 | 12 | /// The HTTP method used in the request. 13 | var method: Moya.Method { get } 14 | 15 | /// Provides stub data for use in testing. 16 | var sampleData: Data { get } 17 | 18 | /// The type of HTTP task to be performed. 19 | var task: Task { get } 20 | 21 | /// The type of validation to perform on the request. Default is `.none`. 22 | var validationType: ValidationType { get } 23 | 24 | /// The headers to be used in the request. 25 | var headers: [String: String]? { get } 26 | } 27 | 28 | public extension TargetType { 29 | 30 | /// The type of validation to perform on the request. Default is `.none`. 31 | var validationType: ValidationType { 32 | return .none 33 | } 34 | } 35 | 36 | // MARK: - Deprecated 37 | 38 | extension TargetType { 39 | @available(*, deprecated: 11.0, message: 40 | "TargetType's validate property has been deprecated in 11.0. Please use validationType: ValidationType.") 41 | var validate: Bool { 42 | return false 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /HttpRequestUITests/HttpRequestUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HttpRequestUITests.swift 3 | // HttpRequestUITests 4 | // 5 | // Created by 易金 on 2018/1/5. 6 | // Copyright © 2018年 jin. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class HttpRequestUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/ValidationType.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Represents the status codes to validate through Alamofire. 4 | public enum ValidationType { 5 | 6 | /// No validation. 7 | case none 8 | 9 | /// Validate success codes (only 2xx). 10 | case successCodes 11 | 12 | /// Validate success codes and redirection codes (only 2xx and 3xx). 13 | case successAndRedirectCodes 14 | 15 | /// Validate only the given status codes. 16 | case customCodes([Int]) 17 | 18 | /// The list of HTTP status codes to validate. 19 | var statusCodes: [Int] { 20 | switch self { 21 | case .successCodes: 22 | return Array(200..<300) 23 | case .successAndRedirectCodes: 24 | return Array(200..<400) 25 | case .customCodes(let codes): 26 | return codes 27 | case .none: 28 | return [] 29 | } 30 | } 31 | } 32 | 33 | extension ValidationType: Equatable { 34 | 35 | public static func == (lhs: ValidationType, rhs: ValidationType) -> Bool { 36 | switch (lhs, rhs) { 37 | case (.none, .none), 38 | (.successCodes, .successCodes), 39 | (.successAndRedirectCodes, .successAndRedirectCodes): 40 | return true 41 | case (.customCodes(let code1), .customCodes(let code2)): 42 | return code1 == code2 43 | default: 44 | return false 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pods/Kingfisher/Sources/Box.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Box.swift 3 | // Kingfisher 4 | // 5 | // Created by Wei Wang on 2018/3/17. 6 | // Copyright (c) 2018 Wei Wang 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | import Foundation 27 | 28 | class Box { 29 | let value: T 30 | 31 | init(_ value: T) { 32 | self.value = value 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Pods-HttpRequest.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher" "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher/Kingfisher.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD/MBProgressHUD.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Result/Result.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "CFNetwork" -framework "CoreGraphics" -framework "Foundation" -framework "Kingfisher" -framework "MBProgressHUD" -framework "Moya" -framework "QuartzCore" -framework "Result" -framework "SnapKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HttpRequest/Pods-HttpRequest.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher" "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher/Kingfisher.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD/MBProgressHUD.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Result/Result.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "CFNetwork" -framework "CoreGraphics" -framework "Foundation" -framework "Kingfisher" -framework "MBProgressHUD" -framework "Moya" -framework "QuartzCore" -framework "Result" -framework "SnapKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Alamofire.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Kingfisher.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | MBProgressHUD.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | Moya.xcscheme 29 | 30 | isShown 31 | 32 | orderHint 33 | 3 34 | 35 | Pods-HttpRequest.xcscheme 36 | 37 | isShown 38 | 39 | orderHint 40 | 4 41 | 42 | Result.xcscheme 43 | 44 | isShown 45 | 46 | orderHint 47 | 5 48 | 49 | SnapKit.xcscheme 50 | 51 | isShown 52 | 53 | orderHint 54 | 6 55 | 56 | 57 | SuppressBuildableAutocreation 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintView = UIView 33 | #else 34 | public typealias ConstraintView = NSView 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Alamofire.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Kingfisher.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | MBProgressHUD.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | Moya.xcscheme 29 | 30 | isShown 31 | 32 | orderHint 33 | 3 34 | 35 | Pods-HttpRequest.xcscheme 36 | 37 | isShown 38 | 39 | orderHint 40 | 4 41 | 42 | Result.xcscheme 43 | 44 | isShown 45 | 46 | orderHint 47 | 5 48 | 49 | SnapKit.xcscheme 50 | 51 | isShown 52 | 53 | orderHint 54 | 6 55 | 56 | 57 | SuppressBuildableAutocreation 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /HttpRequest/DMAPI.swift: -------------------------------------------------------------------------------- 1 | // moya的一个具体的接口实现 2 | 3 | import Foundation 4 | import Moya 5 | 6 | enum DMAPI { 7 | //排行榜 8 | case rankList 9 | 10 | ///其他接口... 11 | case other1(p1: String, p2: Int, p3: String, p4: String) 12 | 13 | case other2 14 | 15 | } 16 | 17 | // 补全【MoyaConfig 3:配置TargetType协议可以一次性处理的参数】中没有处理的参数 18 | extension DMAPI: TargetType { 19 | //1. 每个接口的相对路径 20 | //请求时的绝对路径是 baseURL + path 21 | var path: String { 22 | switch self { 23 | case .rankList: 24 | return "rank/list" 25 | case let .other1(p1, p2, _, _): 26 | return "rank/list?pid=\(p1)&page=\(p2)" 27 | case .other2: 28 | return "" 29 | } 30 | } 31 | 32 | //2. 每个接口要使用的请求方式 33 | var method: Moya.Method { 34 | switch self { 35 | case .rankList: 36 | return .post 37 | case .other1: 38 | return .post 39 | case .other2: 40 | return .get 41 | } 42 | } 43 | 44 | //3. Task是一个枚举值,根据后台需要的数据,选择不同的http task。 45 | var task: Task { 46 | var params: [String: Any] = [:] 47 | switch self { 48 | case .rankList: 49 | return .requestPlain 50 | case let .other1(_, _, p3, p4): 51 | params["p3"] = p3 52 | params["p4"] = p4 53 | default: 54 | //不需要传参数的接口走这里 55 | return .requestPlain 56 | } 57 | return .requestParameters(parameters: params, encoding: URLEncoding.default) 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintInsets.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintInsets = UIEdgeInsets 33 | #else 34 | public typealias ConstraintInsets = NSEdgeInsets 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/MultiTarget.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A `TargetType` used to enable `MoyaProvider` to process multiple `TargetType`s. 4 | public enum MultiTarget: TargetType { 5 | /// The embedded `TargetType`. 6 | case target(TargetType) 7 | 8 | /// Initializes a `MultiTarget`. 9 | public init(_ target: TargetType) { 10 | self = MultiTarget.target(target) 11 | } 12 | 13 | /// The embedded target's base `URL`. 14 | public var path: String { 15 | return target.path 16 | } 17 | 18 | /// The baseURL of the embedded target. 19 | public var baseURL: URL { 20 | return target.baseURL 21 | } 22 | 23 | /// The HTTP method of the embedded target. 24 | public var method: Moya.Method { 25 | return target.method 26 | } 27 | 28 | /// The sampleData of the embedded target. 29 | public var sampleData: Data { 30 | return target.sampleData 31 | } 32 | 33 | /// The `Task` of the embedded target. 34 | public var task: Task { 35 | return target.task 36 | } 37 | 38 | /// The `ValidationType` of the embedded target. 39 | public var validationType: ValidationType { 40 | return target.validationType 41 | } 42 | 43 | /// The headers of the embedded target. 44 | public var headers: [String: String]? { 45 | return target.headers 46 | } 47 | 48 | /// The embedded `TargetType`. 49 | public var target: TargetType { 50 | switch self { 51 | case .target(let target): return target 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// These functions are default mappings to `MoyaProvider`'s properties: endpoints, requests, manager, etc. 4 | public extension MoyaProvider { 5 | public final class func defaultEndpointMapping(for target: Target) -> Endpoint { 6 | return Endpoint( 7 | url: URL(target: target).absoluteString, 8 | sampleResponseClosure: { .networkResponse(200, target.sampleData) }, 9 | method: target.method, 10 | task: target.task, 11 | httpHeaderFields: target.headers 12 | ) 13 | } 14 | 15 | public final class func defaultRequestMapping(for endpoint: Endpoint, closure: RequestResultClosure) { 16 | do { 17 | let urlRequest = try endpoint.urlRequest() 18 | closure(.success(urlRequest)) 19 | } catch MoyaError.requestMapping(let url) { 20 | closure(.failure(MoyaError.requestMapping(url))) 21 | } catch MoyaError.parameterEncoding(let error) { 22 | closure(.failure(MoyaError.parameterEncoding(error))) 23 | } catch { 24 | closure(.failure(MoyaError.underlying(error, nil))) 25 | } 26 | } 27 | 28 | public final class func defaultAlamofireManager() -> Manager { 29 | let configuration = URLSessionConfiguration.default 30 | configuration.httpAdditionalHeaders = Manager.defaultHTTPHeaders 31 | 32 | let manager = Manager(configuration: configuration) 33 | manager.startRequestsImmediately = false 34 | return manager 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 8.0, *) 33 | public typealias ConstraintLayoutSupport = UILayoutSupport 34 | #else 35 | public class ConstraintLayoutSupport {} 36 | #endif 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/UILayoutSupport+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 8.0, *) 30 | public extension ConstraintLayoutSupport { 31 | 32 | public var snp: ConstraintLayoutSupportDSL { 33 | return ConstraintLayoutSupportDSL(support: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 9.0, OSX 10.11, *) 30 | public extension ConstraintLayoutGuide { 31 | 32 | public var snp: ConstraintLayoutGuideDSL { 33 | return ConstraintLayoutGuideDSL(guide: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuide.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 9.0, *) 33 | public typealias ConstraintLayoutGuide = UILayoutGuide 34 | #else 35 | @available(OSX 10.11, *) 36 | public typealias ConstraintLayoutGuide = NSLayoutGuide 37 | #endif 38 | -------------------------------------------------------------------------------- /HttpRequest/Base.lproj/Main.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 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Task.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Represents an HTTP task. 4 | public enum Task { 5 | 6 | /// A request with no additional data. 7 | case requestPlain 8 | 9 | /// A requests body set with data. 10 | case requestData(Data) 11 | 12 | /// A request body set with `Encodable` type 13 | case requestJSONEncodable(Encodable) 14 | 15 | /// A request body set with `Encodable` type and custom encoder 16 | case requestCustomJSONEncodable(Encodable, encoder: JSONEncoder) 17 | 18 | /// A requests body set with encoded parameters. 19 | case requestParameters(parameters: [String: Any], encoding: ParameterEncoding) 20 | 21 | /// A requests body set with data, combined with url parameters. 22 | case requestCompositeData(bodyData: Data, urlParameters: [String: Any]) 23 | 24 | /// A requests body set with encoded parameters combined with url parameters. 25 | case requestCompositeParameters(bodyParameters: [String: Any], bodyEncoding: ParameterEncoding, urlParameters: [String: Any]) 26 | 27 | /// A file upload task. 28 | case uploadFile(URL) 29 | 30 | /// A "multipart/form-data" upload task. 31 | case uploadMultipart([MultipartFormData]) 32 | 33 | /// A "multipart/form-data" upload task combined with url parameters. 34 | case uploadCompositeMultipart([MultipartFormData], urlParameters: [String: Any]) 35 | 36 | /// A file download task to a destination. 37 | case downloadDestination(DownloadDestination) 38 | 39 | /// A file download task to a destination with extra parameters using the given encoding. 40 | case downloadParameters(parameters: [String: Any], encoding: ParameterEncoding, destination: DownloadDestination) 41 | } 42 | -------------------------------------------------------------------------------- /HttpRequest/Utils/HUD.swift: -------------------------------------------------------------------------------- 1 | // 弹窗提示 2 | import MBProgressHUD 3 | import Foundation 4 | 5 | class Alert: NSObject { 6 | enum AlertType { 7 | case success 8 | case info 9 | case error 10 | case warning 11 | } 12 | 13 | class func show(type: AlertType, text: String) { 14 | if let window = UIApplication.shared.delegate?.window { 15 | var image: UIImage 16 | switch type { 17 | case .success: 18 | image = #imageLiteral(resourceName: "Alert_success") 19 | case .info: 20 | image = #imageLiteral(resourceName: "Alert_info") 21 | case .error: 22 | image = #imageLiteral(resourceName: "Alert_error") 23 | case .warning: 24 | image = #imageLiteral(resourceName: "Alert_warning") 25 | } 26 | let hud = MBProgressHUD.showAdded(to: window!, animated: true) 27 | hud.backgroundColor = UIColor.gray.withAlphaComponent(0.2) 28 | hud.mode = .customView 29 | hud.customView = UIImageView(image:image) 30 | hud.label.text = text 31 | hud.hide(animated: true, afterDelay: 1.2) 32 | } 33 | } 34 | } 35 | 36 | class ProgressHUD { 37 | class func show() { 38 | if let window = UIApplication.shared.delegate?.window { 39 | MBProgressHUD.showAdded(to: window!, animated: true) 40 | } 41 | } 42 | 43 | class func hide() { 44 | if let window = UIApplication.shared.delegate?.window { 45 | MBProgressHUD.hide(for: window!, animated: true) 46 | // MBProgressHUD.hideAllHUDs(for: window!, animated: true) 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintConfig.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection 27 | #else 28 | import AppKit 29 | public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection 30 | #endif 31 | 32 | 33 | public struct ConstraintConfig { 34 | 35 | public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Pods/Kingfisher/Sources/Kingfisher.h: -------------------------------------------------------------------------------- 1 | // 2 | // Kingfisher.h 3 | // Kingfisher 4 | // 5 | // Created by Wei Wang on 15/4/6. 6 | // 7 | // Copyright (c) 2018 Wei Wang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | #import 28 | 29 | //! Project version number for Kingfisher. 30 | FOUNDATION_EXPORT double KingfisherVersionNumber; 31 | 32 | //! Project version string for Kingfisher. 33 | FOUNDATION_EXPORT const unsigned char KingfisherVersionString[]; 34 | 35 | // In this header, you should import all the public headers of your framework using statements like #import 36 | 37 | 38 | -------------------------------------------------------------------------------- /HttpRequest/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 | 2.3 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSAppTransportSecurity 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | 28 | UILaunchStoryboardName 29 | LaunchScreen 30 | UIMainStoryboardFile 31 | Main 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /HttpRequest/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 | -------------------------------------------------------------------------------- /HttpRequest/Utils/SaveFiles.swift: -------------------------------------------------------------------------------- 1 | // 文件保存 2 | 3 | import Foundation 4 | 5 | class SaveFiles { 6 | 7 | static let systemCache: URL? = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first?.appendingPathComponent("netCache", isDirectory: true) 8 | 9 | class func getPath(path: String) -> URL? { 10 | let pathURL = handlePathUrl(path) 11 | let manager = FileManager.default 12 | var url = systemCache 13 | if let urlStr = systemCache?.absoluteString, manager.isExecutableFile(atPath: urlStr) == false { 14 | try? manager.createDirectory(at: url!, withIntermediateDirectories: true, attributes: nil) 15 | } 16 | url?.appendPathComponent(pathURL) 17 | return url 18 | } 19 | 20 | class func save(path: String, data: Data) { 21 | if let url = getPath(path: path) { 22 | do { 23 | try data.write(to: url) 24 | print("保存成功") 25 | } catch { 26 | print("保存到本地文件失败") 27 | } 28 | } 29 | } 30 | 31 | class func read(path: String) -> Data? { 32 | if let url = getPath(path: path), let dataRead = try? Data(contentsOf: url) { 33 | print("读取本地文件成功") 34 | return dataRead 35 | } else { 36 | print("文件不存在,读取本地文件失败") 37 | } 38 | return nil 39 | } 40 | 41 | class func clearCache() { 42 | // 取出cache文件夹目录 缓存文件都在这个目录下 43 | if let url = systemCache { 44 | do { 45 | try? FileManager.default.removeItem(at: url) 46 | } 47 | } 48 | 49 | } 50 | 51 | class func handlePathUrl(_ url: String) -> String { 52 | return url.replacingOccurrences(of: "/", with: "") 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Pods/Kingfisher/Sources/ThreadHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreadHelper.swift 3 | // Kingfisher 4 | // 5 | // Created by Wei Wang on 15/10/9. 6 | // 7 | // Copyright (c) 2018 Wei Wang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | import Foundation 28 | 29 | extension DispatchQueue { 30 | // This method will dispatch the `block` to self. 31 | // If `self` is the main queue, and current thread is main thread, the block 32 | // will be invoked immediately instead of being dispatched. 33 | func safeAsync(_ block: @escaping ()->()) { 34 | if self === DispatchQueue.main && Thread.isMainThread { 35 | block() 36 | } else { 37 | async { block() } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintRelation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | internal enum ConstraintRelation : Int { 32 | case equal = 1 33 | case lessThanOrEqual 34 | case greaterThanOrEqual 35 | 36 | internal var layoutRelation: LayoutRelation { 37 | get { 38 | switch(self) { 39 | case .equal: 40 | return .equal 41 | case .lessThanOrEqual: 42 | return .lessThanOrEqual 43 | case .greaterThanOrEqual: 44 | return .greaterThanOrEqual 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/Typealiases.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | import Foundation 25 | 26 | #if os(iOS) || os(tvOS) 27 | import UIKit 28 | #if swift(>=4.2) 29 | typealias LayoutRelation = NSLayoutConstraint.Relation 30 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 31 | #else 32 | typealias LayoutRelation = NSLayoutRelation 33 | typealias LayoutAttribute = NSLayoutAttribute 34 | #endif 35 | typealias LayoutPriority = UILayoutPriority 36 | #else 37 | import AppKit 38 | typealias LayoutRelation = NSLayoutConstraint.Relation 39 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 40 | typealias LayoutPriority = NSLayoutConstraint.Priority 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerFinalizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerFinalizable { 32 | 33 | internal let description: ConstraintDescription 34 | 35 | internal init(_ description: ConstraintDescription) { 36 | self.description = description 37 | } 38 | 39 | @discardableResult 40 | public func labeled(_ label: String) -> ConstraintMakerFinalizable { 41 | self.description.label = label 42 | return self 43 | } 44 | 45 | public var constraint: Constraint { 46 | return self.description.constraint! 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Pods/Alamofire/Source/DispatchQueue+Alamofire.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DispatchQueue+Alamofire.swift 3 | // 4 | // Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | import Dispatch 26 | import Foundation 27 | 28 | extension DispatchQueue { 29 | static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) } 30 | static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) } 31 | static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) } 32 | static var background: DispatchQueue { return DispatchQueue.global(qos: .background) } 33 | 34 | func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) { 35 | asyncAfter(deadline: .now() + delay, execute: closure) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /HttpRequest/Moya/MoyaConfig.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Moya 3 | 4 | #warning("下面的代码需要根据项目进行更改") 5 | /** 6 | 1.配置TargetType协议可以一次性处理的参数 7 | 8 | - Todo: 根据自己的需要更改,不能统一处理的移除下面的代码,并在DMAPI中实现 9 | 10 | **/ 11 | public extension TargetType { 12 | var baseURL: URL { 13 | return URL(string: "http://app.u17.com/v3/appV3_3/ios/phone/")! 14 | } 15 | 16 | var headers: [String : String]? { 17 | return nil 18 | } 19 | 20 | var sampleData: Data { 21 | return "{}".data(using: String.Encoding.utf8)! 22 | } 23 | } 24 | 25 | /** 26 | 2.公共参数 27 | 28 | - Todo: 配置公共参数,例如所有接口都需要传token,version,time等,就可以在这里统一处理 29 | 30 | - Note: 接口传参时可以覆盖公共参数。下面的代码只需要更改 【private var commonParams: [String: Any]?】 31 | 32 | **/ 33 | extension URLRequest { 34 | //TODO:处理公共参数 35 | private var commonParams: [String: Any]? { 36 | //所有接口的公共参数添加在这里例如: 37 | // return ["token": "", 38 | // "version": "ios 1.0.0" 39 | // ] 40 | return nil 41 | } 42 | } 43 | 44 | //下面的代码不更改 45 | class RequestHandlingPlugin: PluginType { 46 | public func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { 47 | var mutateableRequest = request 48 | return mutateableRequest.appendCommonParams(); 49 | } 50 | } 51 | 52 | //下面的代码不更改 53 | extension URLRequest { 54 | mutating func appendCommonParams() -> URLRequest { 55 | let request = try? encoded(parameters: commonParams, parameterEncoding: URLEncoding(destination: .queryString)) 56 | assert(request != nil, "append common params failed, please check common params value") 57 | return request! 58 | } 59 | 60 | func encoded(parameters: [String: Any]?, parameterEncoding: ParameterEncoding) throws -> URLRequest { 61 | do { 62 | return try parameterEncoding.encode(self, with: parameters) 63 | } catch { 64 | throw MoyaError.parameterEncoding(error) 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /HttpRequest/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 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftHttpRequest(Swift5) 2 | ![](https://img.shields.io/badge/Swift-4.2-green.svg?style=flat) 3 | ![](https://img.shields.io/badge/Swift-5.0-green.svg?style=flat) 4 | 5 | 6 | 这里主要介绍了swift版本的网络请求,封装中带有Progress及错误信息处理,缓存等的统一解决方案 7 | 8 | [简书地址https://www.jianshu.com/p/caa1a57e7423](https://www.jianshu.com/p/caa1a57e7423) 9 | 10 | --------- 11 | 12 |

Demo说明

13 | Demo主要介绍Swift的网络部分,代码已更新到swift5.0 14 | 15 | **本demo内容可直接用于项目开发** 16 | 17 | 1. Moya文件夹中:MoyaBase是对Moya的封装。/Moya/MoyaBase/组建是可以不用更改的,当然,你也可以自定义组件 18 | 2. MoyaConfig.swift需要根据项目进行配置。每一项代码中都有明确的注释。 19 | 3. HttpRequest.swift需要自己重写跳转登录的代码,如果用不到可以删除或者将HttpCode.needLogin改为不可能用到的值 20 | 4. MoyaAPI里是后台接口及model文件 21 | 5. 提供跨类型解析方案,提供codable默认值解决方案 22 | 23 | 24 |
一. 网络部分
25 | 26 | 请求均采用 `Alamofire` 27 | 28 | 请求封装方式分为: 29 | - **1.Moya(一个star很多的`Alamofire`的上层封装,为本demo推荐方式。我在使用过程中发现moya是极其优美的网络请求方式)** 30 | - **2.链式请求(如果你刚刚从OC转到swift,可能还不适应moya的方式,那么也可以用这种请求方式)** 31 | - **3.仿AFN式请求(这应该是OC中常见的封装方式)** 32 | 33 | 34 |
二. Progress及信息处理
35 | 36 | 加载动画及弹出框采用 `MBProgressHUD` 37 | 38 | 39 |
三. 数据解析
40 | 41 | 在swift4之前,我一直用的是`HandyJSON`(下面有介绍)。在swift4之后我把model的解析转到到官方的Codable。 42 | 43 | 44 |
四. 缓存
45 | 46 | 缓存部分没有接入数据库,而是直接用了`write to file`,并将缓存封装到网络请求方法中 47 | 48 |
Demo所用接口
49 | 50 | 接口:http://app.u17.com/v3/appV3_3/ios/phone/rank/list 51 | 请求方式:get 52 | 53 | 54 |

作者语:

55 | 56 | 希望能达到抛砖引玉的效果 57 | 58 | 也给新学习swift的朋友一个简单的网络处理的方式 59 | 60 | 大家互相帮助,互相学习 61 | 62 | 如果对你有帮助还请给个Star,谢谢🙏 63 | 64 | ---- 65 |
版本:
66 | 67 | * 2.3 更新到Swift5 68 | 69 | * 2.2 修改文件结构。使用moya时请配置MoyaConfig和HttpRequest文件。这是一个demo,不是一个拿来即用的三方库,所以请认真阅读代码,根据自己的项目做出更改和优化 70 | 71 | * 2.1 `Codable`跨类型解析:`Int`解析成`String`, `String`解析成`Int` 72 | 73 | * 2.0 更新到swift4,重新整理代码 74 | 75 | * 1.2 新增`moya`的demo 76 | 77 | * 1.1 新增链式请求的封装 78 | 链式请求可以只组合需要的函数,本身默认为常用方式,简化常用的链式调用; 79 | 对于非默认值的请求可以自定义进行设置; 80 | 方便添加自定义行为,利于扩展; 81 | 82 | * 1.0 类OC中的AFN封装 83 | 利于OC转swift的同学学习。 84 | 其中对返回值做了JSON和String两种解析,String是为了方便实用HandyJSON,不使用HandyJSON可以自行删除部分代码 85 | -------------------------------------------------------------------------------- /Pods/Kingfisher/Sources/RequestModifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RequestModifier.swift 3 | // Kingfisher 4 | // 5 | // Created by Wei Wang on 2016/09/05. 6 | // 7 | // Copyright (c) 2018 Wei Wang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | import Foundation 28 | 29 | /// Request modifier of image downloader. 30 | public protocol ImageDownloadRequestModifier { 31 | func modified(for request: URLRequest) -> URLRequest? 32 | } 33 | 34 | struct NoModifier: ImageDownloadRequestModifier { 35 | static let `default` = NoModifier() 36 | private init() {} 37 | func modified(for request: URLRequest) -> URLRequest? { 38 | return request 39 | } 40 | } 41 | 42 | public struct AnyModifier: ImageDownloadRequestModifier { 43 | 44 | let block: (URLRequest) -> URLRequest? 45 | 46 | public func modified(for request: URLRequest) -> URLRequest? { 47 | return block(request) 48 | } 49 | 50 | public init(modify: @escaping (URLRequest) -> URLRequest? ) { 51 | block = modify 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /HttpRequest/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @UIApplicationMain 4 | class AppDelegate: UIResponder, UIApplicationDelegate { 5 | 6 | var window: UIWindow? 7 | 8 | 9 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 10 | // Override point for customization after application launch. 11 | return true 12 | } 13 | 14 | func applicationWillResignActive(_ application: UIApplication) { 15 | // 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. 16 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 17 | } 18 | 19 | func applicationDidEnterBackground(_ application: UIApplication) { 20 | // 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. 21 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 22 | } 23 | 24 | func applicationWillEnterForeground(_ application: UIApplication) { 25 | // 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. 26 | } 27 | 28 | func applicationDidBecomeActive(_ application: UIApplication) { 29 | // 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. 30 | } 31 | 32 | func applicationWillTerminate(_ application: UIApplication) { 33 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 34 | } 35 | 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintRelatableTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintRelatableTarget { 32 | } 33 | 34 | extension Int: ConstraintRelatableTarget { 35 | } 36 | 37 | extension UInt: ConstraintRelatableTarget { 38 | } 39 | 40 | extension Float: ConstraintRelatableTarget { 41 | } 42 | 43 | extension Double: ConstraintRelatableTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintRelatableTarget { 47 | } 48 | 49 | extension CGSize: ConstraintRelatableTarget { 50 | } 51 | 52 | extension CGPoint: ConstraintRelatableTarget { 53 | } 54 | 55 | extension ConstraintInsets: ConstraintRelatableTarget { 56 | } 57 | 58 | extension ConstraintItem: ConstraintRelatableTarget { 59 | } 60 | 61 | extension ConstraintView: ConstraintRelatableTarget { 62 | } 63 | 64 | @available(iOS 9.0, OSX 10.11, *) 65 | extension ConstraintLayoutGuide: ConstraintRelatableTarget { 66 | } 67 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/LayoutConstraint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class LayoutConstraint : NSLayoutConstraint { 32 | 33 | public var label: String? { 34 | get { 35 | return self.identifier 36 | } 37 | set { 38 | self.identifier = newValue 39 | } 40 | } 41 | 42 | internal weak var constraint: Constraint? = nil 43 | 44 | } 45 | 46 | internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool { 47 | guard lhs.firstItem === rhs.firstItem && 48 | lhs.secondItem === rhs.secondItem && 49 | lhs.firstAttribute == rhs.firstAttribute && 50 | lhs.secondAttribute == rhs.secondAttribute && 51 | lhs.relation == rhs.relation && 52 | lhs.priority == rhs.priority && 53 | lhs.multiplier == rhs.multiplier else { 54 | return false 55 | } 56 | return true 57 | } 58 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 8.0, *) 32 | public struct ConstraintLayoutSupportDSL: ConstraintDSL { 33 | 34 | public var target: AnyObject? { 35 | return self.support 36 | } 37 | 38 | internal let support: ConstraintLayoutSupport 39 | 40 | internal init(support: ConstraintLayoutSupport) { 41 | self.support = support 42 | 43 | } 44 | 45 | public var top: ConstraintItem { 46 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top) 47 | } 48 | 49 | public var bottom: ConstraintItem { 50 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom) 51 | } 52 | 53 | public var height: ConstraintItem { 54 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Plugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | /// A Moya Plugin receives callbacks to perform side effects wherever a request is sent or received. 5 | /// 6 | /// for example, a plugin may be used to 7 | /// - log network requests 8 | /// - hide and show a network activity indicator 9 | /// - inject additional information into a request 10 | public protocol PluginType { 11 | /// Called to modify a request before sending. 12 | func prepare(_ request: URLRequest, target: TargetType) -> URLRequest 13 | 14 | /// Called immediately before a request is sent over the network (or stubbed). 15 | func willSend(_ request: RequestType, target: TargetType) 16 | 17 | /// Called after a response has been received, but before the MoyaProvider has invoked its completion handler. 18 | func didReceive(_ result: Result, target: TargetType) 19 | 20 | /// Called to modify a result before completion. 21 | func process(_ result: Result, target: TargetType) -> Result 22 | } 23 | 24 | public extension PluginType { 25 | func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { return request } 26 | func willSend(_ request: RequestType, target: TargetType) { } 27 | func didReceive(_ result: Result, target: TargetType) { } 28 | func process(_ result: Result, target: TargetType) -> Result { return result } 29 | } 30 | 31 | /// Request type used by `willSend` plugin function. 32 | public protocol RequestType { 33 | 34 | // Note: 35 | // 36 | // We use this protocol instead of the Alamofire request to avoid leaking that abstraction. 37 | // A plugin should not know about Alamofire at all. 38 | 39 | /// Retrieve an `NSURLRequest` representation. 40 | var request: URLRequest? { get } 41 | 42 | /// Authenticates the request with a username and password. 43 | func authenticate(user: String, password: String, persistence: URLCredential.Persistence) -> Self 44 | 45 | /// Authenticates the request with an `NSURLCredential` instance. 46 | func authenticate(usingCredential credential: URLCredential) -> Self 47 | } 48 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public final class ConstraintItem { 32 | 33 | internal weak var target: AnyObject? 34 | internal let attributes: ConstraintAttributes 35 | 36 | internal init(target: AnyObject?, attributes: ConstraintAttributes) { 37 | self.target = target 38 | self.attributes = attributes 39 | } 40 | 41 | internal var layoutConstraintItem: LayoutConstraintItem? { 42 | return self.target as? LayoutConstraintItem 43 | } 44 | 45 | } 46 | 47 | public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool { 48 | // pointer equality 49 | guard lhs !== rhs else { 50 | return true 51 | } 52 | 53 | // must both have valid targets and identical attributes 54 | guard let target1 = lhs.target, 55 | let target2 = rhs.target, 56 | target1 === target2 && lhs.attributes == rhs.attributes else { 57 | return false 58 | } 59 | 60 | return true 61 | } 62 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/Moya.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/Moya.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/Result.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/SnapKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/Result.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/SnapKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/Alamofire.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/Kingfisher.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerEditable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerEditable: ConstraintMakerPriortizable { 32 | 33 | @discardableResult 34 | public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 35 | self.description.multiplier = amount 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 41 | return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue) 42 | } 43 | 44 | @discardableResult 45 | public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable { 46 | self.description.constant = amount.constraintOffsetTargetValue 47 | return self 48 | } 49 | 50 | @discardableResult 51 | public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable { 52 | self.description.constant = amount.constraintInsetTargetValue 53 | return self 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/Alamofire.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/Kingfisher.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/MBProgressHUD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/MBProgressHUD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMultiplierTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintMultiplierTarget { 32 | 33 | var constraintMultiplierTargetValue: CGFloat { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintMultiplierTarget { 38 | 39 | public var constraintMultiplierTargetValue: CGFloat { 40 | return CGFloat(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintMultiplierTarget { 46 | 47 | public var constraintMultiplierTargetValue: CGFloat { 48 | return CGFloat(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintMultiplierTarget { 54 | 55 | public var constraintMultiplierTargetValue: CGFloat { 56 | return CGFloat(self) 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintMultiplierTarget { 62 | 63 | public var constraintMultiplierTargetValue: CGFloat { 64 | return CGFloat(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintMultiplierTarget { 70 | 71 | public var constraintMultiplierTargetValue: CGFloat { 72 | return self 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintOffsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintOffsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintOffsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintOffsetTarget { 38 | } 39 | 40 | extension Float: ConstraintOffsetTarget { 41 | } 42 | 43 | extension Double: ConstraintOffsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintOffsetTarget { 47 | } 48 | 49 | extension ConstraintOffsetTarget { 50 | 51 | internal var constraintOffsetTargetValue: CGFloat { 52 | let offset: CGFloat 53 | if let amount = self as? Float { 54 | offset = CGFloat(amount) 55 | } else if let amount = self as? Double { 56 | offset = CGFloat(amount) 57 | } else if let amount = self as? CGFloat { 58 | offset = CGFloat(amount) 59 | } else if let amount = self as? Int { 60 | offset = CGFloat(amount) 61 | } else if let amount = self as? UInt { 62 | offset = CGFloat(amount) 63 | } else { 64 | offset = 0.0 65 | } 66 | return offset 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /HttpRequest/Moya/HttpRequest.swift: -------------------------------------------------------------------------------- 1 | // moya封装 2 | 3 | import Foundation 4 | import Moya 5 | import MBProgressHUD 6 | 7 | public class HttpRequest { 8 | /// 使用moya的请求封装 9 | /// 10 | /// - Parameters: 11 | /// - target: TargetType里的枚举值 12 | /// - model: model类型 13 | /// - cache: 需要单独处理缓存的数据时使用 14 | /// - success: 成功的回调 15 | /// - error: 连接服务器成功但是数据获取失败 16 | /// - failure: 连接服务器失败 17 | public class func loadData(target: T, model: D.Type?, cache: ((D?) -> Void)? = nil, success: @escaping((D?) -> Void), failure: ((Int?, String) ->Void)?) { 18 | let provider = MoyaProvider(plugins: [ 19 | RequestHandlingPlugin(), 20 | networkLoggerPlugin 21 | ]) 22 | //如果需要读取缓存,则优先读取缓存内容 23 | if let cache = cache, let data = SaveFiles.read(path: target.path) { 24 | let model = try? JSONDecoder().decode(D.self, from: data) 25 | cache(model) 26 | }else { 27 | //读取缓存速度较快,无需显示hud;仅从网络加载数据时,显示hud。 28 | ProgressHUD.show() 29 | } 30 | 31 | provider.request(target) { result in 32 | ProgressHUD.hide() 33 | switch result { 34 | case let .success(response): 35 | let model = try? response.map(D.self) 36 | success(model) 37 | case let .failure(error): 38 | let statusCode = error.response?.statusCode ?? 0 39 | let errorCode = "请求出错,错误码:" + String(statusCode) 40 | failureHandle(failure: failure, stateCode: statusCode, message: error.errorDescription ?? errorCode) 41 | } 42 | } 43 | 44 | //错误处理 - 弹出错误信息 45 | func failureHandle(failure: ((Int?, String) ->Void)? , stateCode: Int?, message: String) { 46 | Alert.show(type: .error, text: message) 47 | failure?(stateCode ,message) 48 | } 49 | 50 | } 51 | 52 | ///打印日志 53 | static let networkLoggerPlugin = NetworkLoggerPlugin(verbose: true, cURL: true, requestDataFormatter: { data -> String in 54 | return String(data: data, encoding: .utf8) ?? "" 55 | }) { data -> (Data) in 56 | do { 57 | let dataAsJSON = try JSONSerialization.jsonObject(with: data) 58 | let prettyData = try JSONSerialization.data(withJSONObject: dataAsJSON, options: .prettyPrinted) 59 | return prettyData 60 | } catch { 61 | return data 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintPriorityTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintPriorityTarget { 32 | 33 | var constraintPriorityTargetValue: Float { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintPriorityTarget { 38 | 39 | public var constraintPriorityTargetValue: Float { 40 | return Float(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintPriorityTarget { 46 | 47 | public var constraintPriorityTargetValue: Float { 48 | return Float(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintPriorityTarget { 54 | 55 | public var constraintPriorityTargetValue: Float { 56 | return self 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintPriorityTarget { 62 | 63 | public var constraintPriorityTargetValue: Float { 64 | return Float(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintPriorityTarget { 70 | 71 | public var constraintPriorityTargetValue: Float { 72 | return Float(self) 73 | } 74 | 75 | } 76 | 77 | #if os(iOS) || os(tvOS) 78 | extension UILayoutPriority: ConstraintPriorityTarget { 79 | 80 | public var constraintPriorityTargetValue: Float { 81 | return self.rawValue 82 | } 83 | 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /HttpRequest/DMCell.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | import SnapKit 4 | import Kingfisher 5 | class DMCell: UITableViewCell { 6 | 7 | var model: DMModel.DMRankingList? { 8 | didSet { 9 | uploadUI() 10 | } 11 | } 12 | 13 | let iconImageView: UIImageView = UIImageView() 14 | let nameLabel: UILabel = UILabel() 15 | let descLabel: UILabel = UILabel() 16 | 17 | func UISet() { 18 | iconImageView.backgroundColor = UIColor.lightGray 19 | nameLabel.textColor = UIColor.black 20 | descLabel.textColor = UIColor.gray 21 | descLabel.numberOfLines = 0 22 | } 23 | 24 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 25 | super.init(style: style, reuseIdentifier: reuseIdentifier) 26 | UISet() 27 | self.contentView.addSubview(iconImageView) 28 | self.contentView.addSubview(nameLabel) 29 | self.contentView.addSubview(descLabel) 30 | makeConstraints() 31 | } 32 | 33 | required init?(coder aDecoder: NSCoder) { 34 | fatalError("init(coder:) has not been implemented") 35 | } 36 | 37 | override func awakeFromNib() { 38 | super.awakeFromNib() 39 | // Initialization code 40 | } 41 | 42 | override func setSelected(_ selected: Bool, animated: Bool) { 43 | super.setSelected(selected, animated: animated) 44 | 45 | // Configure the view for the selected state 46 | } 47 | 48 | func makeConstraints() { 49 | iconImageView.snp.makeConstraints { (maker) in 50 | maker.left.top.equalToSuperview().offset(10) 51 | maker.bottom.equalToSuperview().offset(-10) 52 | maker.width.equalTo(130) 53 | } 54 | 55 | nameLabel.snp.makeConstraints { (maker) in 56 | maker.left.equalTo(iconImageView.snp.right).offset(10) 57 | maker.right.equalToSuperview().offset(-10) 58 | maker.top.equalTo(iconImageView).offset(10) 59 | } 60 | 61 | descLabel.snp.makeConstraints { (maker) in 62 | maker.left.equalTo(iconImageView.snp.right).offset(10) 63 | maker.right.equalToSuperview().offset(-10) 64 | maker.bottom.equalTo(iconImageView).offset(-10) 65 | } 66 | } 67 | 68 | } 69 | 70 | extension DMCell { 71 | 72 | func uploadUI() { 73 | guard let model = model else { 74 | return 75 | } 76 | let url = URL(string: model.cover) 77 | iconImageView.kf.setImage(with: url) 78 | 79 | nameLabel.text = model.title + "榜" 80 | 81 | descLabel.text = model.subTitle 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/MultipartFormData.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Alamofire 3 | 4 | /// Represents "multipart/form-data" for an upload. 5 | public struct MultipartFormData { 6 | 7 | /// Method to provide the form data. 8 | public enum FormDataProvider { 9 | case data(Foundation.Data) 10 | case file(URL) 11 | case stream(InputStream, UInt64) 12 | } 13 | 14 | public init(provider: FormDataProvider, name: String, fileName: String? = nil, mimeType: String? = nil) { 15 | self.provider = provider 16 | self.name = name 17 | self.fileName = fileName 18 | self.mimeType = mimeType 19 | } 20 | 21 | /// The method being used for providing form data. 22 | public let provider: FormDataProvider 23 | 24 | /// The name. 25 | public let name: String 26 | 27 | /// The file name. 28 | public let fileName: String? 29 | 30 | /// The MIME type 31 | public let mimeType: String? 32 | 33 | } 34 | 35 | // MARK: RequestMultipartFormData appending 36 | internal extension RequestMultipartFormData { 37 | func append(data: Data, bodyPart: MultipartFormData) { 38 | if let mimeType = bodyPart.mimeType { 39 | if let fileName = bodyPart.fileName { 40 | append(data, withName: bodyPart.name, fileName: fileName, mimeType: mimeType) 41 | } else { 42 | append(data, withName: bodyPart.name, mimeType: mimeType) 43 | } 44 | } else { 45 | append(data, withName: bodyPart.name) 46 | } 47 | } 48 | 49 | func append(fileURL url: URL, bodyPart: MultipartFormData) { 50 | if let fileName = bodyPart.fileName, let mimeType = bodyPart.mimeType { 51 | append(url, withName: bodyPart.name, fileName: fileName, mimeType: mimeType) 52 | } else { 53 | append(url, withName: bodyPart.name) 54 | } 55 | } 56 | 57 | func append(stream: InputStream, length: UInt64, bodyPart: MultipartFormData) { 58 | append(stream, withLength: length, name: bodyPart.name, fileName: bodyPart.fileName ?? "", mimeType: bodyPart.mimeType ?? "") 59 | } 60 | 61 | func applyMoyaMultipartFormData(_ multipartBody: [Moya.MultipartFormData]) { 62 | for bodyPart in multipartBody { 63 | switch bodyPart.provider { 64 | case .data(let data): 65 | append(data: data, bodyPart: bodyPart) 66 | case .file(let url): 67 | append(fileURL: url, bodyPart: bodyPart) 68 | case .stream(let stream, let length): 69 | append(stream: stream, length: length, bodyPart: bodyPart) 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 9.0, OSX 10.11, *) 32 | public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL { 33 | 34 | @discardableResult 35 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 36 | return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure) 37 | } 38 | 39 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 40 | ConstraintMaker.makeConstraints(item: self.guide, closure: closure) 41 | } 42 | 43 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 44 | ConstraintMaker.remakeConstraints(item: self.guide, closure: closure) 45 | } 46 | 47 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 48 | ConstraintMaker.updateConstraints(item: self.guide, closure: closure) 49 | } 50 | 51 | public func removeConstraints() { 52 | ConstraintMaker.removeConstraints(item: self.guide) 53 | } 54 | 55 | public var target: AnyObject? { 56 | return self.guide 57 | } 58 | 59 | internal let guide: ConstraintLayoutGuide 60 | 61 | internal init(guide: ConstraintLayoutGuide) { 62 | self.guide = guide 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Pods/Kingfisher/Sources/Kingfisher.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Kingfisher.swift 3 | // Kingfisher 4 | // 5 | // Created by Wei Wang on 16/9/14. 6 | // 7 | // Copyright (c) 2018 Wei Wang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | import Foundation 28 | import ImageIO 29 | 30 | #if os(macOS) 31 | import AppKit 32 | public typealias Image = NSImage 33 | public typealias View = NSView 34 | public typealias Color = NSColor 35 | public typealias ImageView = NSImageView 36 | public typealias Button = NSButton 37 | #else 38 | import UIKit 39 | public typealias Image = UIImage 40 | public typealias Color = UIColor 41 | #if !os(watchOS) 42 | public typealias ImageView = UIImageView 43 | public typealias View = UIView 44 | public typealias Button = UIButton 45 | #else 46 | import WatchKit 47 | #endif 48 | #endif 49 | 50 | public final class Kingfisher { 51 | public let base: Base 52 | public init(_ base: Base) { 53 | self.base = base 54 | } 55 | } 56 | 57 | /** 58 | A type that has Kingfisher extensions. 59 | */ 60 | public protocol KingfisherCompatible { 61 | associatedtype CompatibleType 62 | var kf: CompatibleType { get } 63 | } 64 | 65 | public extension KingfisherCompatible { 66 | public var kf: Kingfisher { 67 | return Kingfisher(self) 68 | } 69 | } 70 | 71 | extension Image: KingfisherCompatible { } 72 | #if !os(watchOS) 73 | extension ImageView: KingfisherCompatible { } 74 | extension Button: KingfisherCompatible { } 75 | #else 76 | extension WKInterfaceImage: KingfisherCompatible { } 77 | #endif 78 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintPriority.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable { 31 | public typealias FloatLiteralType = Float 32 | 33 | public let value: Float 34 | 35 | public init(floatLiteral value: Float) { 36 | self.value = value 37 | } 38 | 39 | public init(_ value: Float) { 40 | self.value = value 41 | } 42 | 43 | public static var required: ConstraintPriority { 44 | return 1000.0 45 | } 46 | 47 | public static var high: ConstraintPriority { 48 | return 750.0 49 | } 50 | 51 | public static var medium: ConstraintPriority { 52 | #if os(OSX) 53 | return 501.0 54 | #else 55 | return 500.0 56 | #endif 57 | 58 | } 59 | 60 | public static var low: ConstraintPriority { 61 | return 250.0 62 | } 63 | 64 | public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool { 65 | return lhs.value == rhs.value 66 | } 67 | 68 | // MARK: Strideable 69 | 70 | public func advanced(by n: FloatLiteralType) -> ConstraintPriority { 71 | return ConstraintPriority(floatLiteral: value + n) 72 | } 73 | 74 | public func distance(to other: ConstraintPriority) -> FloatLiteralType { 75 | return other.value - value 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerPriortizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerPriortizable: ConstraintMakerFinalizable { 32 | 33 | @discardableResult 34 | public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable { 35 | self.description.priority = amount.value 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable { 41 | self.description.priority = amount 42 | return self 43 | } 44 | 45 | @available(*, deprecated:3.0, message:"Use priority(.required) instead.") 46 | @discardableResult 47 | public func priorityRequired() -> ConstraintMakerFinalizable { 48 | return self.priority(.required) 49 | } 50 | 51 | @available(*, deprecated:3.0, message:"Use priority(.high) instead.") 52 | @discardableResult 53 | public func priorityHigh() -> ConstraintMakerFinalizable { 54 | return self.priority(.high) 55 | } 56 | 57 | @available(*, deprecated:3.0, message:"Use priority(.medium) instead.") 58 | @discardableResult 59 | public func priorityMedium() -> ConstraintMakerFinalizable { 60 | return self.priority(.medium) 61 | } 62 | 63 | @available(*, deprecated:3.0, message:"Use priority(.low) instead.") 64 | @discardableResult 65 | public func priorityLow() -> ConstraintMakerFinalizable { 66 | return self.priority(.low) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/Plugins/AccessTokenPlugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | // MARK: - AccessTokenAuthorizable 5 | 6 | /// A protocol for controlling the behavior of `AccessTokenPlugin`. 7 | public protocol AccessTokenAuthorizable { 8 | 9 | /// Represents the authorization header to use for requests. 10 | var authorizationType: AuthorizationType { get } 11 | } 12 | 13 | // MARK: - AuthorizationType 14 | 15 | /// An enum representing the header to use with an `AccessTokenPlugin` 16 | public enum AuthorizationType { 17 | /// No header. 18 | case none 19 | 20 | /// The `"Basic"` header. 21 | case basic 22 | 23 | /// The `"Bearer"` header. 24 | case bearer 25 | 26 | /// Custom header implementation. 27 | case custom(String) 28 | 29 | public var value: String? { 30 | switch self { 31 | case .none: return nil 32 | case .basic: return "Basic" 33 | case .bearer: return "Bearer" 34 | case .custom(let customValue): return customValue 35 | } 36 | } 37 | } 38 | 39 | // MARK: - AccessTokenPlugin 40 | 41 | /** 42 | A plugin for adding basic or bearer-type authorization headers to requests. Example: 43 | 44 | ``` 45 | Authorization: Basic 46 | Authorization: Bearer 47 | Authorization: <Сustom> 48 | ``` 49 | 50 | */ 51 | public struct AccessTokenPlugin: PluginType { 52 | 53 | /// A closure returning the access token to be applied in the header. 54 | public let tokenClosure: () -> String 55 | 56 | /** 57 | Initialize a new `AccessTokenPlugin`. 58 | 59 | - parameters: 60 | - tokenClosure: A closure returning the token to be applied in the pattern `Authorization: ` 61 | */ 62 | public init(tokenClosure: @escaping () -> String) { 63 | self.tokenClosure = tokenClosure 64 | } 65 | 66 | /** 67 | Prepare a request by adding an authorization header if necessary. 68 | 69 | - parameters: 70 | - request: The request to modify. 71 | - target: The target of the request. 72 | - returns: The modified `URLRequest`. 73 | */ 74 | public func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { 75 | 76 | guard let authorizable = target as? AccessTokenAuthorizable else { return request } 77 | 78 | let authorizationType = authorizable.authorizationType 79 | var request = request 80 | 81 | switch authorizationType { 82 | case .basic, .bearer, .custom: 83 | if let value = authorizationType.value { 84 | let authValue = value + " " + tokenClosure() 85 | request.addValue(authValue, forHTTPHeaderField: "Authorization") 86 | } 87 | case .none: 88 | break 89 | } 90 | 91 | return request 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/duodiankeji.xcuserdatad/xcschemes/Pods-HttpRequest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintDescription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintDescription { 32 | 33 | internal let item: LayoutConstraintItem 34 | internal var attributes: ConstraintAttributes 35 | internal var relation: ConstraintRelation? = nil 36 | internal var sourceLocation: (String, UInt)? = nil 37 | internal var label: String? = nil 38 | internal var related: ConstraintItem? = nil 39 | internal var multiplier: ConstraintMultiplierTarget = 1.0 40 | internal var constant: ConstraintConstantTarget = 0.0 41 | internal var priority: ConstraintPriorityTarget = 1000.0 42 | internal lazy var constraint: Constraint? = { 43 | guard let relation = self.relation, 44 | let related = self.related, 45 | let sourceLocation = self.sourceLocation else { 46 | return nil 47 | } 48 | let from = ConstraintItem(target: self.item, attributes: self.attributes) 49 | 50 | return Constraint( 51 | from: from, 52 | to: related, 53 | relation: relation, 54 | sourceLocation: sourceLocation, 55 | label: self.label, 56 | multiplier: self.multiplier, 57 | constant: self.constant, 58 | priority: self.priority 59 | ) 60 | }() 61 | 62 | // MARK: Initialization 63 | 64 | internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) { 65 | self.item = item 66 | self.attributes = attributes 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/yijin.xcuserdatad/xcschemes/Pods-HttpRequest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 68 | 69 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Pods/Moya/Sources/Moya/MoyaError.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A type representing possible errors Moya can throw. 4 | public enum MoyaError: Swift.Error { 5 | 6 | /// Indicates a response failed to map to an image. 7 | case imageMapping(Response) 8 | 9 | /// Indicates a response failed to map to a JSON structure. 10 | case jsonMapping(Response) 11 | 12 | /// Indicates a response failed to map to a String. 13 | case stringMapping(Response) 14 | 15 | /// Indicates a response failed to map to a Decodable object. 16 | case objectMapping(Swift.Error, Response) 17 | 18 | /// Indicates that Encodable couldn't be encoded into Data 19 | case encodableMapping(Swift.Error) 20 | 21 | /// Indicates a response failed with an invalid HTTP status code. 22 | case statusCode(Response) 23 | 24 | /// Indicates a response failed due to an underlying `Error`. 25 | case underlying(Swift.Error, Response?) 26 | 27 | /// Indicates that an `Endpoint` failed to map to a `URLRequest`. 28 | case requestMapping(String) 29 | 30 | /// Indicates that an `Endpoint` failed to encode the parameters for the `URLRequest`. 31 | case parameterEncoding(Swift.Error) 32 | } 33 | 34 | public extension MoyaError { 35 | /// Depending on error type, returns a `Response` object. 36 | var response: Moya.Response? { 37 | switch self { 38 | case .imageMapping(let response): return response 39 | case .jsonMapping(let response): return response 40 | case .stringMapping(let response): return response 41 | case .objectMapping(_, let response): return response 42 | case .statusCode(let response): return response 43 | case .underlying(_, let response): return response 44 | case .encodableMapping: return nil 45 | case .requestMapping: return nil 46 | case .parameterEncoding: return nil 47 | } 48 | } 49 | } 50 | 51 | // MARK: - Error Descriptions 52 | 53 | extension MoyaError: LocalizedError { 54 | public var errorDescription: String? { 55 | switch self { 56 | case .imageMapping: 57 | return "Failed to map data to an Image." 58 | case .jsonMapping: 59 | return "Failed to map data to JSON." 60 | case .stringMapping: 61 | return "Failed to map data to a String." 62 | case .objectMapping: 63 | return "Failed to map data to a Decodable object." 64 | case .encodableMapping: 65 | return "Failed to encode Encodable object into data." 66 | case .statusCode: 67 | return "Status code didn't fall within the given range." 68 | case .requestMapping: 69 | return "Failed to map Endpoint to a URLRequest." 70 | case .parameterEncoding(let error): 71 | return "Failed to encode parameters for URLRequest. \(error.localizedDescription)" 72 | case .underlying(let error, _): 73 | return error.localizedDescription 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Pods/Kingfisher/Sources/Resource.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Resource.swift 3 | // Kingfisher 4 | // 5 | // Created by Wei Wang on 15/4/6. 6 | // 7 | // Copyright (c) 2018 Wei Wang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | import Foundation 28 | 29 | 30 | /// `Resource` protocol defines how to download and cache a resource from network. 31 | public protocol Resource { 32 | /// The key used in cache. 33 | var cacheKey: String { get } 34 | 35 | /// The target image URL. 36 | var downloadURL: URL { get } 37 | } 38 | 39 | /** 40 | ImageResource is a simple combination of `downloadURL` and `cacheKey`. 41 | 42 | When passed to image view set methods, Kingfisher will try to download the target 43 | image from the `downloadURL`, and then store it with the `cacheKey` as the key in cache. 44 | */ 45 | public struct ImageResource: Resource { 46 | /// The key used in cache. 47 | public let cacheKey: String 48 | 49 | /// The target image URL. 50 | public let downloadURL: URL 51 | 52 | /** 53 | Create a resource. 54 | 55 | - parameter downloadURL: The target image URL. 56 | - parameter cacheKey: The cache key. If `nil`, Kingfisher will use the `absoluteString` of `downloadURL` as the key. 57 | 58 | - returns: A resource. 59 | */ 60 | public init(downloadURL: URL, cacheKey: String? = nil) { 61 | self.downloadURL = downloadURL 62 | self.cacheKey = cacheKey ?? downloadURL.absoluteString 63 | } 64 | } 65 | 66 | /** 67 | URL conforms to `Resource` in Kingfisher. 68 | The `absoluteString` of this URL is used as `cacheKey`. And the URL itself will be used as `downloadURL`. 69 | If you need customize the url and/or cache key, use `ImageResource` instead. 70 | */ 71 | extension URL: Resource { 72 | public var cacheKey: String { return absoluteString } 73 | public var downloadURL: URL { return self } 74 | } 75 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintInsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintInsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintInsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintInsetTarget { 38 | } 39 | 40 | extension Float: ConstraintInsetTarget { 41 | } 42 | 43 | extension Double: ConstraintInsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintInsetTarget { 47 | } 48 | 49 | extension ConstraintInsets: ConstraintInsetTarget { 50 | } 51 | 52 | extension ConstraintInsetTarget { 53 | 54 | internal var constraintInsetTargetValue: ConstraintInsets { 55 | if let amount = self as? ConstraintInsets { 56 | return amount 57 | } else if let amount = self as? Float { 58 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 59 | } else if let amount = self as? Double { 60 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 61 | } else if let amount = self as? CGFloat { 62 | return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount) 63 | } else if let amount = self as? Int { 64 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 65 | } else if let amount = self as? UInt { 66 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 67 | } else { 68 | return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0) 69 | } 70 | } 71 | 72 | } 73 | --------------------------------------------------------------------------------