From 4705acdaa7ebf1fcf82710e2079cae511ced66bd Mon Sep 17 00:00:00 2001 From: Jobs Date: Sat, 30 Dec 2017 20:27:01 +0800 Subject: [PATCH 1/6] Change domain name --- BinanceApi/Base.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BinanceApi/Base.swift b/BinanceApi/Base.swift index 045fddc..0704c8e 100644 --- a/BinanceApi/Base.swift +++ b/BinanceApi/Base.swift @@ -92,7 +92,7 @@ public enum BinanceCandlesticksInterval: String, Codable { } public struct BinanceApi { - static let baseUrl = URL(string: "https://www.binance.com/api/")! + static let baseUrl = URL(string: "https://api.binance.com/api/")! let session: SessionManager @@ -190,7 +190,7 @@ public protocol BinanceRequest: Encodable, URLConvertible, URLRequestConvertible public extension BinanceRequest { public func asURL() throws -> URL { - let baseUrl = URL(string: "https://www.binance.com/api/")! + let baseUrl = URL(string: "https://api.binance.com/api/")! return URL(string: Self.endpoint, relativeTo: baseUrl)! } From dfb43114469415edd76d96c59068b7c2c8758bf6 Mon Sep 17 00:00:00 2001 From: Evgen Bodunov Date: Tue, 16 Jan 2018 17:16:00 +0300 Subject: [PATCH 2/6] Updated Cartfile Removed Signing settings from .xcodeproj General .xcodeproj cleanup Added iOS target --- BinanceApi.xcodeproj/project.pbxproj | 210 ++++++++++++++---- .../xcschemes/BinanceApi.xcscheme | 101 --------- BinanceApi/BinanceApi.h | 2 +- Cartfile | 2 +- Cartfile.resolved | 2 +- 5 files changed, 170 insertions(+), 147 deletions(-) delete mode 100644 BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi.xcscheme diff --git a/BinanceApi.xcodeproj/project.pbxproj b/BinanceApi.xcodeproj/project.pbxproj index 26b8f7e..cef5b4f 100644 --- a/BinanceApi.xcodeproj/project.pbxproj +++ b/BinanceApi.xcodeproj/project.pbxproj @@ -7,6 +7,13 @@ objects = { /* Begin PBXBuildFile section */ + 6C380927200E3FCA00670C25 /* BinanceObjCApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9320E541FA4EA4100BA2B05 /* BinanceObjCApi.swift */; }; + 6C380928200E3FCA00670C25 /* DataRequest+BinanceRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E92A053F1FA1C7A400906A7A /* DataRequest+BinanceRequest.swift */; }; + 6C380929200E3FCA00670C25 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9CAF1881F9D5B15006A7A7D /* Base.swift */; }; + 6C38092A200E3FCA00670C25 /* BinanceApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = E928A4851F9A03C30078BA33 /* BinanceApi.swift */; }; + 6C38092C200E3FCA00670C25 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E928A4891F9A083E0078BA33 /* Alamofire.framework */; }; + 6C38092D200E3FCA00670C25 /* CommonCrypto.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E92C42611F9E72A90079AA2B /* CommonCrypto.framework */; }; + 6C38092F200E3FCA00670C25 /* BinanceApi.h in Headers */ = {isa = PBXBuildFile; fileRef = E928A46E1F9A03AD0078BA33 /* BinanceApi.h */; settings = {ATTRIBUTES = (Public, ); }; }; E928A4751F9A03AD0078BA33 /* BinanceApi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E928A46B1F9A03AD0078BA33 /* BinanceApi.framework */; }; E928A47A1F9A03AD0078BA33 /* BinanceApiTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E928A4791F9A03AD0078BA33 /* BinanceApiTests.swift */; }; E928A47C1F9A03AD0078BA33 /* BinanceApi.h in Headers */ = {isa = PBXBuildFile; fileRef = E928A46E1F9A03AD0078BA33 /* BinanceApi.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -32,6 +39,15 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 6C380931200E3FCA00670C25 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; E9D593E11F9E7CC600368371 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -44,6 +60,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 6C380935200E3FCA00670C25 /* BinanceApi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BinanceApi.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E928A46B1F9A03AD0078BA33 /* BinanceApi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BinanceApi.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E928A46E1F9A03AD0078BA33 /* BinanceApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BinanceApi.h; sourceTree = ""; }; E928A46F1F9A03AD0078BA33 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -67,6 +84,15 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 6C38092B200E3FCA00670C25 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C38092C200E3FCA00670C25 /* Alamofire.framework in Frameworks */, + 6C38092D200E3FCA00670C25 /* CommonCrypto.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; E928A4671F9A03AD0078BA33 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -109,6 +135,7 @@ children = ( E928A46B1F9A03AD0078BA33 /* BinanceApi.framework */, E928A4741F9A03AD0078BA33 /* BinanceApiTests.xctest */, + 6C380935200E3FCA00670C25 /* BinanceApi.framework */, ); name = Products; sourceTree = ""; @@ -150,6 +177,14 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 6C38092E200E3FCA00670C25 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C38092F200E3FCA00670C25 /* BinanceApi.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; E928A4681F9A03AD0078BA33 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -161,9 +196,28 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - E928A46A1F9A03AD0078BA33 /* BinanceApi */ = { + 6C380925200E3FCA00670C25 /* BinanceApi iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = E928A47F1F9A03AD0078BA33 /* Build configuration list for PBXNativeTarget "BinanceApi" */; + buildConfigurationList = 6C380932200E3FCA00670C25 /* Build configuration list for PBXNativeTarget "BinanceApi iOS" */; + buildPhases = ( + 6C380926200E3FCA00670C25 /* Sources */, + 6C38092B200E3FCA00670C25 /* Frameworks */, + 6C38092E200E3FCA00670C25 /* Headers */, + 6C380930200E3FCA00670C25 /* Resources */, + 6C380931200E3FCA00670C25 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "BinanceApi iOS"; + productName = BinanceApi; + productReference = 6C380935200E3FCA00670C25 /* BinanceApi.framework */; + productType = "com.apple.product-type.framework"; + }; + E928A46A1F9A03AD0078BA33 /* BinanceApi macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = E928A47F1F9A03AD0078BA33 /* Build configuration list for PBXNativeTarget "BinanceApi macOS" */; buildPhases = ( E928A4661F9A03AD0078BA33 /* Sources */, E928A4671F9A03AD0078BA33 /* Frameworks */, @@ -175,7 +229,7 @@ ); dependencies = ( ); - name = BinanceApi; + name = "BinanceApi macOS"; productName = BinanceApi; productReference = E928A46B1F9A03AD0078BA33 /* BinanceApi.framework */; productType = "com.apple.product-type.framework"; @@ -233,13 +287,21 @@ projectDirPath = ""; projectRoot = ""; targets = ( - E928A46A1F9A03AD0078BA33 /* BinanceApi */, + 6C380925200E3FCA00670C25 /* BinanceApi iOS */, + E928A46A1F9A03AD0078BA33 /* BinanceApi macOS */, E928A4731F9A03AD0078BA33 /* BinanceApiTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 6C380930200E3FCA00670C25 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; E928A4691F9A03AD0078BA33 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -277,6 +339,17 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 6C380926200E3FCA00670C25 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C380927200E3FCA00670C25 /* BinanceObjCApi.swift in Sources */, + 6C380928200E3FCA00670C25 /* DataRequest+BinanceRequest.swift in Sources */, + 6C380929200E3FCA00670C25 /* Base.swift in Sources */, + 6C38092A200E3FCA00670C25 /* BinanceApi.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; E928A4661F9A03AD0078BA33 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -302,28 +375,74 @@ /* Begin PBXTargetDependency section */ E928A4771F9A03AD0078BA33 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = E928A46A1F9A03AD0078BA33 /* BinanceApi */; + target = E928A46A1F9A03AD0078BA33 /* BinanceApi macOS */; targetProxy = E928A4761F9A03AD0078BA33 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 6C380933200E3FCA00670C25 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = BinanceApi/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = eth.shadilay.BinanceApi; + PRODUCT_NAME = BinanceApi; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 6C380934200E3FCA00670C25 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = BinanceApi/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = eth.shadilay.BinanceApi; + PRODUCT_NAME = BinanceApi; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; E928A47D1F9A03AD0078BA33 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES; + CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -334,16 +453,15 @@ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -351,21 +469,26 @@ "DEBUG=1", "$(inherited)", ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; @@ -373,18 +496,18 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES; + CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -395,16 +518,15 @@ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -412,25 +534,26 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; E928A4801F9A03AD0078BA33 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = A9HC2E63HU; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -443,23 +566,16 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = eth.shadilay.BinanceApi; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PRODUCT_NAME = BinanceApi; + SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_OBJC_BRIDGING_HEADER = ""; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; }; name = Debug; }; E928A4811F9A03AD0078BA33 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = A9HC2E63HU; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -472,10 +588,9 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = eth.shadilay.BinanceApi; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PRODUCT_NAME = BinanceApi; + SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_OBJC_BRIDGING_HEADER = ""; - SWIFT_VERSION = 4.0; }; name = Release; }; @@ -533,6 +648,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 6C380932200E3FCA00670C25 /* Build configuration list for PBXNativeTarget "BinanceApi iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6C380933200E3FCA00670C25 /* Debug */, + 6C380934200E3FCA00670C25 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; E928A4651F9A03AD0078BA33 /* Build configuration list for PBXProject "BinanceApi" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -542,7 +666,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E928A47F1F9A03AD0078BA33 /* Build configuration list for PBXNativeTarget "BinanceApi" */ = { + E928A47F1F9A03AD0078BA33 /* Build configuration list for PBXNativeTarget "BinanceApi macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( E928A4801F9A03AD0078BA33 /* Debug */, diff --git a/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi.xcscheme b/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi.xcscheme deleted file mode 100644 index 490c70f..0000000 --- a/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi.xcscheme +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BinanceApi/BinanceApi.h b/BinanceApi/BinanceApi.h index 2842213..9d21d49 100644 --- a/BinanceApi/BinanceApi.h +++ b/BinanceApi/BinanceApi.h @@ -6,7 +6,7 @@ // Copyright © 2017 Sumant Manne. All rights reserved. // -#import +@import Foundation; //! Project version number for BinanceApi. FOUNDATION_EXPORT double BinanceApiVersionNumber; diff --git a/Cartfile b/Cartfile index 654a517..7faa8c2 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "Alamofire/Alamofire" ~> 4.5 +github "Alamofire/Alamofire" github "soffes/CommonCrypto" diff --git a/Cartfile.resolved b/Cartfile.resolved index 5332c08..b2a0e66 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "Alamofire/Alamofire" "4.5.1" +github "Alamofire/Alamofire" "4.6.0" github "soffes/CommonCrypto" "v1.1.0" From 79e61a8fddde4a522093d1395dadee33edbc714a Mon Sep 17 00:00:00 2001 From: Evgen Bodunov Date: Tue, 16 Jan 2018 17:22:15 +0300 Subject: [PATCH 3/6] Schemes for Carthage --- .../xcschemes/BinanceApi iOS.xcscheme | 82 ++++++++++++++ .../xcschemes/BinanceApi macOS.xcscheme | 101 ++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi iOS.xcscheme create mode 100644 BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi macOS.xcscheme diff --git a/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi iOS.xcscheme b/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi iOS.xcscheme new file mode 100644 index 0000000..97c1fcc --- /dev/null +++ b/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi iOS.xcscheme @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi macOS.xcscheme b/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi macOS.xcscheme new file mode 100644 index 0000000..f82286a --- /dev/null +++ b/BinanceApi.xcodeproj/xcshareddata/xcschemes/BinanceApi macOS.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 71a105c942d3716759b2ff8d6bb74887d8bcb45a Mon Sep 17 00:00:00 2001 From: Evgen Bodunov Date: Wed, 17 Jan 2018 12:21:11 +0300 Subject: [PATCH 4/6] Small fixes --- BinanceApi/Base.swift | 2 +- BinanceApi/BinanceApi.swift | 8 +++++--- README.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/BinanceApi/Base.swift b/BinanceApi/Base.swift index 0704c8e..9b87bc1 100644 --- a/BinanceApi/Base.swift +++ b/BinanceApi/Base.swift @@ -191,7 +191,7 @@ public protocol BinanceRequest: Encodable, URLConvertible, URLRequestConvertible public extension BinanceRequest { public func asURL() throws -> URL { let baseUrl = URL(string: "https://api.binance.com/api/")! - return URL(string: Self.endpoint, relativeTo: baseUrl)! + return URL(string: Self.endpoint, relativeTo: baseUrl)!.absoluteURL } public func asURLRequest() throws -> URLRequest { diff --git a/BinanceApi/BinanceApi.swift b/BinanceApi/BinanceApi.swift index 5f829f0..7c2926c 100644 --- a/BinanceApi/BinanceApi.swift +++ b/BinanceApi/BinanceApi.swift @@ -13,7 +13,7 @@ import Alamofire public struct BinancePingRequest: BinanceRequest, Codable { public static let endpoint = "v1/ping" public static let method: HTTPMethod = .get - + public struct Response: Codable {} } @@ -199,11 +199,13 @@ public struct Binance24HourTickerRequest: BinanceRequest, Codable { /// Latest `price` for all `symbol`s. public struct BinanceAllPricesRequest: BinanceRequest, Codable { - public static let endpoint = "v1/ticker/allPrices" + public static let endpoint = "v3/ticker/price" public static let method: HTTPMethod = .get + public init () {} + public struct Response: Decodable { - let elements: [String: Decimal] + public let elements: [String: Decimal] public init(from decoder: Decoder) throws { var dict = [String: Decimal]() diff --git a/README.md b/README.md index 15e3de4..356c9b2 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ let api = BinanceApi() let request = BinanceAllPricesRequest() api.send(request) { response in - assert(request.result.isSuccess) + assert(response.result.isSuccess) let elements = response.result.value!.elements for (symbol, price) in elements { From 3c6c8b718be2fd9c55e70b36478776b0d1ad305c Mon Sep 17 00:00:00 2001 From: Evgen Bodunov Date: Wed, 17 Jan 2018 15:38:16 +0300 Subject: [PATCH 5/6] Updated Binance24HourTickerRequest to match current API --- BinanceApi/BinanceApi.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BinanceApi/BinanceApi.swift b/BinanceApi/BinanceApi.swift index 7c2926c..f502b79 100644 --- a/BinanceApi/BinanceApi.swift +++ b/BinanceApi/BinanceApi.swift @@ -176,6 +176,10 @@ public struct Binance24HourTickerRequest: BinanceRequest, Codable { public static let endpoint = "v1/ticker/24hr" public static let method: HTTPMethod = .get + public init(symbol: String) { + self.symbol = symbol + } + public let symbol: String public struct Response: Codable { @@ -189,6 +193,8 @@ public struct Binance24HourTickerRequest: BinanceRequest, Codable { public let openPrice: Decimal public let highPrice: Decimal public let lowPrice: Decimal + public let volume: Decimal + public let quoteVolume: Decimal public let openTime: Date public let closeTime: Date public let firstId: UInt64 From b9e1187a04f7b18296dfd47649cbc84b7642cc97 Mon Sep 17 00:00:00 2001 From: Evgen Bodunov Date: Thu, 18 Jan 2018 14:32:27 +0300 Subject: [PATCH 6/6] There should be at least one public init in every request. --- BinanceApi/BinanceApi.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BinanceApi/BinanceApi.swift b/BinanceApi/BinanceApi.swift index f502b79..6c123e8 100644 --- a/BinanceApi/BinanceApi.swift +++ b/BinanceApi/BinanceApi.swift @@ -14,6 +14,8 @@ public struct BinancePingRequest: BinanceRequest, Codable { public static let endpoint = "v1/ping" public static let method: HTTPMethod = .get + public init () {} + public struct Response: Codable {} } @@ -22,6 +24,8 @@ public struct BinanceTimeRequest: BinanceRequest { public static let endpoint = "v1/time" public static let method: HTTPMethod = .get + public init () {} + public struct Response: Decodable { public let localTime = Date() public let serverTime: Date @@ -238,6 +242,8 @@ public struct BinanceAllBookTickersRequest: BinanceRequest, Codable { public static let endpoint = "v1/ticker/allBookTickers" public static let method: HTTPMethod = .get + public init () {} + public struct Element: Codable { public let bidPrice: Decimal public let bidQuantity: Decimal @@ -284,7 +290,7 @@ public struct BinanceAllBookTickersRequest: BinanceRequest, Codable { public struct BinanceNewOrderRequest: BinanceSignedRequest, Codable { public static let endpoint = "v3/order" public static let method = HTTPMethod.post - + public let symbol: String public let side: BinanceOrderSide public let type: BinanceOrderType