├── .gitignore ├── .swift-version ├── .travis.yml ├── Example ├── .swift-version ├── Podfile ├── Podfile.lock ├── Pods │ ├── CryptoSwift │ │ ├── LICENSE │ │ ├── README.md │ │ └── Sources │ │ │ └── CryptoSwift │ │ │ ├── AES.Cryptors.swift │ │ │ ├── AES.swift │ │ │ ├── Array+Extension.swift │ │ │ ├── Array+Extensions.swift │ │ │ ├── Authenticator.swift │ │ │ ├── BatchedCollection.swift │ │ │ ├── Bit.swift │ │ │ ├── BlockCipher.swift │ │ │ ├── BlockMode │ │ │ ├── BlockMode.swift │ │ │ ├── BlockModeOptions.swift │ │ │ ├── BlockModeWorker.swift │ │ │ ├── CBC.swift │ │ │ ├── CFB.swift │ │ │ ├── CTR.swift │ │ │ ├── ECB.swift │ │ │ ├── OFB.swift │ │ │ ├── PCBC.swift │ │ │ └── RandomAccessBlockModeWorker.swift │ │ │ ├── Blowfish.swift │ │ │ ├── ChaCha20.swift │ │ │ ├── Checksum.swift │ │ │ ├── Cipher.swift │ │ │ ├── Collection+Extension.swift │ │ │ ├── Cryptors.swift │ │ │ ├── Digest.swift │ │ │ ├── DigestType.swift │ │ │ ├── Foundation │ │ │ ├── AES+Foundation.swift │ │ │ ├── Array+Foundation.swift │ │ │ ├── Blowfish+Foundation.swift │ │ │ ├── ChaCha20+Foundation.swift │ │ │ ├── Data+Extension.swift │ │ │ ├── HMAC+Foundation.swift │ │ │ ├── Rabbit+Foundation.swift │ │ │ ├── String+FoundationExtension.swift │ │ │ └── Utils+Foundation.swift │ │ │ ├── Generics.swift │ │ │ ├── HKDF.swift │ │ │ ├── HMAC.swift │ │ │ ├── Int+Extension.swift │ │ │ ├── MD5.swift │ │ │ ├── NoPadding.swift │ │ │ ├── Operators.swift │ │ │ ├── PKCS │ │ │ ├── PBKDF1.swift │ │ │ ├── PBKDF2.swift │ │ │ ├── PKCS5.swift │ │ │ ├── PKCS7.swift │ │ │ └── PKCS7Padding.swift │ │ │ ├── Padding.swift │ │ │ ├── Poly1305.swift │ │ │ ├── Rabbit.swift │ │ │ ├── RandomAccessCryptor.swift │ │ │ ├── RandomBytesSequence.swift │ │ │ ├── SHA1.swift │ │ │ ├── SHA2.swift │ │ │ ├── SHA3.swift │ │ │ ├── SecureBytes.swift │ │ │ ├── String+Extension.swift │ │ │ ├── UInt16+Extension.swift │ │ │ ├── UInt32+Extension.swift │ │ │ ├── UInt64+Extension.swift │ │ │ ├── UInt8+Extension.swift │ │ │ ├── Updatable.swift │ │ │ ├── Utils.swift │ │ │ └── ZeroPadding.swift │ ├── Local Podspecs │ │ └── SwiftFlyer.podspec.json │ ├── Manifest.lock │ ├── Nimble │ │ ├── LICENSE │ │ ├── README.md │ │ └── Sources │ │ │ ├── Nimble │ │ │ ├── Adapters │ │ │ │ ├── AdapterProtocols.swift │ │ │ │ ├── AssertionDispatcher.swift │ │ │ │ ├── AssertionRecorder.swift │ │ │ │ ├── NMBExpectation.swift │ │ │ │ ├── NMBObjCMatcher.swift │ │ │ │ ├── NimbleEnvironment.swift │ │ │ │ └── NimbleXCTestHandler.swift │ │ │ ├── DSL+Wait.swift │ │ │ ├── DSL.swift │ │ │ ├── Expectation.swift │ │ │ ├── ExpectationMessage.swift │ │ │ ├── Expression.swift │ │ │ ├── FailureMessage.swift │ │ │ ├── Matchers │ │ │ │ ├── AllPass.swift │ │ │ │ ├── AsyncMatcherWrapper.swift │ │ │ │ ├── BeAKindOf.swift │ │ │ │ ├── BeAnInstanceOf.swift │ │ │ │ ├── BeCloseTo.swift │ │ │ │ ├── BeEmpty.swift │ │ │ │ ├── BeGreaterThan.swift │ │ │ │ ├── BeGreaterThanOrEqualTo.swift │ │ │ │ ├── BeIdenticalTo.swift │ │ │ │ ├── BeLessThan.swift │ │ │ │ ├── BeLessThanOrEqual.swift │ │ │ │ ├── BeLogical.swift │ │ │ │ ├── BeNil.swift │ │ │ │ ├── BeVoid.swift │ │ │ │ ├── BeginWith.swift │ │ │ │ ├── Contain.swift │ │ │ │ ├── ContainElementSatisfying.swift │ │ │ │ ├── EndWith.swift │ │ │ │ ├── Equal.swift │ │ │ │ ├── HaveCount.swift │ │ │ │ ├── Match.swift │ │ │ │ ├── MatchError.swift │ │ │ │ ├── MatcherFunc.swift │ │ │ │ ├── MatcherProtocols.swift │ │ │ │ ├── PostNotification.swift │ │ │ │ ├── Predicate.swift │ │ │ │ ├── RaisesException.swift │ │ │ │ ├── SatisfyAnyOf.swift │ │ │ │ ├── ThrowAssertion.swift │ │ │ │ ├── ThrowError.swift │ │ │ │ └── ToSucceed.swift │ │ │ ├── Nimble.h │ │ │ └── Utils │ │ │ │ ├── Async.swift │ │ │ │ ├── Errors.swift │ │ │ │ ├── Functional.swift │ │ │ │ ├── SourceLocation.swift │ │ │ │ └── Stringers.swift │ │ │ └── NimbleObjectiveC │ │ │ ├── CurrentTestCaseTracker.h │ │ │ ├── DSL.h │ │ │ ├── DSL.m │ │ │ ├── NMBExceptionCapture.h │ │ │ ├── NMBExceptionCapture.m │ │ │ ├── NMBStringify.h │ │ │ ├── NMBStringify.m │ │ │ └── XCTestObservationCenter+Register.m │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── SwiftFlyer.xcscheme │ ├── Quick │ │ ├── LICENSE │ │ ├── README.md │ │ └── Sources │ │ │ ├── Quick │ │ │ ├── Behavior.swift │ │ │ ├── Callsite.swift │ │ │ ├── Configuration │ │ │ │ └── Configuration.swift │ │ │ ├── DSL │ │ │ │ ├── DSL.swift │ │ │ │ └── World+DSL.swift │ │ │ ├── ErrorUtility.swift │ │ │ ├── Example.swift │ │ │ ├── ExampleGroup.swift │ │ │ ├── ExampleMetadata.swift │ │ │ ├── Filter.swift │ │ │ ├── Hooks │ │ │ │ ├── Closures.swift │ │ │ │ ├── ExampleHooks.swift │ │ │ │ ├── HooksPhase.swift │ │ │ │ └── SuiteHooks.swift │ │ │ ├── NSBundle+CurrentTestBundle.swift │ │ │ ├── NSString+C99ExtendedIdentifier.swift │ │ │ ├── QuickSelectedTestSuiteBuilder.swift │ │ │ ├── QuickTestSuite.swift │ │ │ ├── URL+FileName.swift │ │ │ └── World.swift │ │ │ ├── QuickObjectiveC │ │ │ ├── Configuration │ │ │ │ ├── QuickConfiguration.h │ │ │ │ └── QuickConfiguration.m │ │ │ ├── DSL │ │ │ │ ├── QCKDSL.h │ │ │ │ ├── QCKDSL.m │ │ │ │ └── World+DSL.h │ │ │ ├── Quick.h │ │ │ ├── QuickSpec.h │ │ │ ├── QuickSpec.m │ │ │ ├── World.h │ │ │ └── XCTestSuite+QuickTestSuiteBuilder.m │ │ │ └── QuickSpecBase │ │ │ ├── QuickSpecBase.m │ │ │ └── include │ │ │ └── QuickSpecBase.h │ ├── Starscream │ │ ├── LICENSE │ │ ├── README.md │ │ ├── Sources │ │ │ ├── Compression.swift │ │ │ ├── SSLSecurity.swift │ │ │ └── WebSocket.swift │ │ └── zlib │ │ │ ├── include.h │ │ │ └── module.modulemap │ └── Target Support Files │ │ ├── CryptoSwift │ │ ├── CryptoSwift-dummy.m │ │ ├── CryptoSwift-prefix.pch │ │ ├── CryptoSwift-umbrella.h │ │ ├── CryptoSwift.modulemap │ │ ├── CryptoSwift.xcconfig │ │ └── Info.plist │ │ ├── Nimble │ │ ├── Info.plist │ │ ├── Nimble-dummy.m │ │ ├── Nimble-prefix.pch │ │ ├── Nimble-umbrella.h │ │ ├── Nimble.modulemap │ │ └── Nimble.xcconfig │ │ ├── Pods-SwiftFlyer_Example │ │ ├── Info.plist │ │ ├── Pods-SwiftFlyer_Example-acknowledgements.markdown │ │ ├── Pods-SwiftFlyer_Example-acknowledgements.plist │ │ ├── Pods-SwiftFlyer_Example-dummy.m │ │ ├── Pods-SwiftFlyer_Example-frameworks.sh │ │ ├── Pods-SwiftFlyer_Example-resources.sh │ │ ├── Pods-SwiftFlyer_Example-umbrella.h │ │ ├── Pods-SwiftFlyer_Example.debug.xcconfig │ │ ├── Pods-SwiftFlyer_Example.modulemap │ │ └── Pods-SwiftFlyer_Example.release.xcconfig │ │ ├── Pods-SwiftFlyer_Tests │ │ ├── Info.plist │ │ ├── Pods-SwiftFlyer_Tests-acknowledgements.markdown │ │ ├── Pods-SwiftFlyer_Tests-acknowledgements.plist │ │ ├── Pods-SwiftFlyer_Tests-dummy.m │ │ ├── Pods-SwiftFlyer_Tests-frameworks.sh │ │ ├── Pods-SwiftFlyer_Tests-resources.sh │ │ ├── Pods-SwiftFlyer_Tests-umbrella.h │ │ ├── Pods-SwiftFlyer_Tests.debug.xcconfig │ │ ├── Pods-SwiftFlyer_Tests.modulemap │ │ └── Pods-SwiftFlyer_Tests.release.xcconfig │ │ ├── Quick │ │ ├── Info.plist │ │ ├── Quick-dummy.m │ │ ├── Quick-prefix.pch │ │ ├── Quick-umbrella.h │ │ ├── Quick.modulemap │ │ └── Quick.xcconfig │ │ ├── Starscream │ │ ├── Info.plist │ │ ├── Starscream-dummy.m │ │ ├── Starscream-prefix.pch │ │ ├── Starscream-umbrella.h │ │ ├── Starscream.modulemap │ │ └── Starscream.xcconfig │ │ └── SwiftFlyer │ │ ├── Info.plist │ │ ├── SwiftFlyer-dummy.m │ │ ├── SwiftFlyer-prefix.pch │ │ ├── SwiftFlyer-umbrella.h │ │ ├── SwiftFlyer.modulemap │ │ └── SwiftFlyer.xcconfig ├── SwiftFlyer.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── SwiftFlyer-Example.xcscheme ├── SwiftFlyer.xcworkspace │ └── contents.xcworkspacedata ├── SwiftFlyer │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── ExecutionHistoryCell.swift │ ├── ExecutionHistoryCell.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift └── Tests │ ├── Info.plist │ └── Tests.swift ├── LICENSE ├── README.md ├── SwiftFlyer.podspec ├── SwiftFlyer ├── ApiSession.swift ├── Assets │ └── .gitkeep ├── BitFlyer.swift ├── Extensions │ ├── DictionaryExtensions.swift │ └── RequestableExtensions.swift ├── HTTPMethod.swift ├── Models │ ├── Address.swift │ ├── Balance.swift │ ├── BankAccount.swift │ ├── Board.swift │ ├── BoarderStatus.swift │ ├── Chat.swift │ ├── ChildOrderResult.swift │ ├── ChildOrderType.swift │ ├── ChildOrders.swift │ ├── CoinHistory.swift │ ├── CoinStatus.swift │ ├── Collateral.swift │ ├── CollateralHistory.swift │ ├── ConditionType.swift │ ├── Contract.swift │ ├── CurrencyCode.swift │ ├── DepositHistory.swift │ ├── Executions.swift │ ├── HealthState.swift │ ├── Market.swift │ ├── MessageID.swift │ ├── OnlyStatusCodeResponse.swift │ ├── Order.swift │ ├── OrderState.swift │ ├── ParentOrderDetail.swift │ ├── ParentOrderResult.swift │ ├── ParentOrderType.swift │ ├── ParentOrders.swift │ ├── Permission.swift │ ├── Position.swift │ ├── PositionSide.swift │ ├── ProductCode.swift │ ├── Ticker.swift │ ├── TimeInForce.swift │ ├── TradeHealth.swift │ ├── TradeState.swift │ ├── TradingCommission.swift │ └── WithdrawHistory.swift ├── RealTimeAPI.swift ├── RealTimeAPIDelegate.swift ├── Requestable.swift ├── Requests │ ├── GetAddressRequest.swift │ ├── GetBalanceRequest.swift │ ├── GetBankAccountsRequest.swift │ ├── GetBoardRequest.swift │ ├── GetBoarderStatusRequest.swift │ ├── GetChatsRequest.swift │ ├── GetChildOrdersRequest.swift │ ├── GetCollateralHistoriesRequest.swift │ ├── GetCollateralRequest.swift │ ├── GetContractsRequest.swift │ ├── GetDepositCoinHistoriesRequest.swift │ ├── GetDepositsRequest.swift │ ├── GetExecutionsRequest.swift │ ├── GetHelthStateRequest.swift │ ├── GetMarketListRequest.swift │ ├── GetParentOrderDetailRequest.swift │ ├── GetParentOrdersRequest.swift │ ├── GetPermissionsRequest.swift │ ├── GetPositionsRequest.swift │ ├── GetTickerRequest.swift │ ├── GetTraidingCommissionRequest.swift │ ├── GetTransferCoinHistoriesRequest.swift │ ├── GetWithdrawsRequest.swift │ ├── PostCancelAllChildOrdersRequest.swift │ ├── PostCancelChildOrderRequest.swift │ ├── PostCancelParentOrderRequest.swift │ ├── PostChildOrderRequest.swift │ ├── PostIFDOCOOrderRequest.swift │ ├── PostIFDOrderRequest.swift │ ├── PostOCOOrderRequest.swift │ ├── PostSimpleOrderRequest.swift │ └── PostWithdrawRequest.swift ├── ResponseError.swift └── Result.swift └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | # Pods/ 34 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/SwiftFlyer.xcworkspace -scheme SwiftFlyer-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'SwiftFlyer_Example' do 4 | pod 'SwiftFlyer', :path => '../' 5 | 6 | target 'SwiftFlyer_Tests' do 7 | inherit! :search_paths 8 | 9 | pod 'Quick', '~> 1.2.0' 10 | pod 'Nimble', '~> 7.0.2' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CryptoSwift (0.8.3) 3 | - Nimble (7.0.3) 4 | - Quick (1.2.0) 5 | - Starscream (3.0.5) 6 | - SwiftFlyer (0.2.1): 7 | - CryptoSwift (~> 0.8.3) 8 | - Starscream (~> 3.0.5) 9 | 10 | DEPENDENCIES: 11 | - Nimble (~> 7.0.2) 12 | - Quick (~> 1.2.0) 13 | - SwiftFlyer (from `../`) 14 | 15 | EXTERNAL SOURCES: 16 | SwiftFlyer: 17 | :path: ../ 18 | 19 | SPEC CHECKSUMS: 20 | CryptoSwift: 033efc3523865d19cc6ab6612fa17a62613b5dfa 21 | Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac 22 | Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 23 | Starscream: faf918b2f2eff7d5dd21180646bf015a669673bd 24 | SwiftFlyer: d0489dd470b4f30eacec1986e2f4898f5eaa00e8 25 | 26 | PODFILE CHECKSUM: 0e2e09933c4a5d391753b4d68ab707c15f8357d7 27 | 28 | COCOAPODS: 1.4.0 29 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2017 Marcin Krzyżanowski 2 | This software is provided 'as-is', without any express or implied warranty. 3 | 4 | In no event will the authors be held liable for any damages arising from the use of this software. 5 | 6 | Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 7 | 8 | - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 9 | - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 10 | - This notice may not be removed or altered from any source or binary distribution. 11 | - Redistributions of any form whatsoever must retain the following acknowledgment: 'This product includes software developed by the "Marcin Krzyzanowski" (http://krzyzanowskim.com/).' -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Authenticator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | /// Message authentication code. 17 | public protocol Authenticator { 18 | /// Calculate Message Authentication Code (MAC) for message. 19 | func authenticate(_ bytes: Array) throws -> Array 20 | } 21 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Bit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | public enum Bit: Int { 17 | case zero 18 | case one 19 | } 20 | 21 | extension Bit { 22 | 23 | func inverted() -> Bit { 24 | return self == .zero ? .one : .zero 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockCipher.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | protocol BlockCipher: Cipher { 17 | static var blockSize: Int { get } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | struct BlockModeOptions: OptionSet { 17 | let rawValue: Int 18 | 19 | static let none = BlockModeOptions(rawValue: 1 << 0) 20 | static let initializationVectorRequired = BlockModeOptions(rawValue: 1 << 1) 21 | static let paddingRequired = BlockModeOptions(rawValue: 1 << 2) 22 | } 23 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockModeWorker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | protocol BlockModeWorker { 17 | var cipherOperation: CipherOperationOnBlock { get } 18 | mutating func encrypt(_ plaintext: ArraySlice) -> Array 19 | mutating func decrypt(_ ciphertext: ArraySlice) -> Array 20 | } 21 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/CBC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | // Cipher-block chaining (CBC) 17 | // 18 | 19 | struct CBCModeWorker: BlockModeWorker { 20 | let cipherOperation: CipherOperationOnBlock 21 | private let iv: ArraySlice 22 | private var prev: ArraySlice? 23 | 24 | init(iv: ArraySlice, cipherOperation: @escaping CipherOperationOnBlock) { 25 | self.iv = iv 26 | self.cipherOperation = cipherOperation 27 | } 28 | 29 | mutating func encrypt(_ plaintext: ArraySlice) -> Array { 30 | guard let ciphertext = cipherOperation(xor(prev ?? iv, plaintext)) else { 31 | return Array(plaintext) 32 | } 33 | prev = ciphertext.slice 34 | return ciphertext 35 | } 36 | 37 | mutating func decrypt(_ ciphertext: ArraySlice) -> Array { 38 | guard let plaintext = cipherOperation(ciphertext) else { 39 | return Array(ciphertext) 40 | } 41 | let result: Array = xor(prev ?? iv, plaintext) 42 | prev = ciphertext 43 | return result 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/CFB.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | // Cipher feedback (CFB) 17 | // 18 | 19 | struct CFBModeWorker: BlockModeWorker { 20 | let cipherOperation: CipherOperationOnBlock 21 | private let iv: ArraySlice 22 | private var prev: ArraySlice? 23 | 24 | init(iv: ArraySlice, cipherOperation: @escaping CipherOperationOnBlock) { 25 | self.iv = iv 26 | self.cipherOperation = cipherOperation 27 | } 28 | 29 | mutating func encrypt(_ plaintext: ArraySlice) -> Array { 30 | guard let ciphertext = cipherOperation(prev ?? iv) else { 31 | return Array(plaintext) 32 | } 33 | prev = xor(plaintext, ciphertext.slice) 34 | return Array(prev ?? []) 35 | } 36 | 37 | mutating func decrypt(_ ciphertext: ArraySlice) -> Array { 38 | guard let plaintext = cipherOperation(prev ?? iv) else { 39 | return Array(ciphertext) 40 | } 41 | let result: Array = xor(plaintext, ciphertext) 42 | prev = ciphertext 43 | return result 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/ECB.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | // Electronic codebook (ECB) 17 | // 18 | 19 | struct ECBModeWorker: BlockModeWorker { 20 | typealias Element = Array 21 | let cipherOperation: CipherOperationOnBlock 22 | 23 | init(cipherOperation: @escaping CipherOperationOnBlock) { 24 | self.cipherOperation = cipherOperation 25 | } 26 | 27 | mutating func encrypt(_ plaintext: ArraySlice) -> Array { 28 | guard let ciphertext = cipherOperation(plaintext) else { 29 | return Array(plaintext) 30 | } 31 | return ciphertext 32 | } 33 | 34 | mutating func decrypt(_ ciphertext: ArraySlice) -> Array { 35 | return encrypt(ciphertext) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/OFB.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | // Output Feedback (OFB) 17 | // 18 | 19 | struct OFBModeWorker: BlockModeWorker { 20 | let cipherOperation: CipherOperationOnBlock 21 | private let iv: ArraySlice 22 | private var prev: ArraySlice? 23 | 24 | init(iv: ArraySlice, cipherOperation: @escaping CipherOperationOnBlock) { 25 | self.iv = iv 26 | self.cipherOperation = cipherOperation 27 | } 28 | 29 | mutating func encrypt(_ plaintext: ArraySlice) -> Array { 30 | guard let ciphertext = cipherOperation(prev ?? iv) else { 31 | return Array(plaintext) 32 | } 33 | prev = ciphertext.slice 34 | return xor(plaintext, ciphertext) 35 | } 36 | 37 | mutating func decrypt(_ ciphertext: ArraySlice) -> Array { 38 | guard let decrypted = cipherOperation(prev ?? iv) else { 39 | return Array(ciphertext) 40 | } 41 | let plaintext: Array = xor(decrypted, ciphertext) 42 | prev = decrypted.slice 43 | return plaintext 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/PCBC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | // Propagating Cipher Block Chaining (PCBC) 17 | // 18 | 19 | struct PCBCModeWorker: BlockModeWorker { 20 | let cipherOperation: CipherOperationOnBlock 21 | private let iv: ArraySlice 22 | private var prev: ArraySlice? 23 | 24 | init(iv: ArraySlice, cipherOperation: @escaping CipherOperationOnBlock) { 25 | self.iv = iv 26 | self.cipherOperation = cipherOperation 27 | } 28 | 29 | mutating func encrypt(_ plaintext: ArraySlice) -> Array { 30 | guard let ciphertext = cipherOperation(xor(prev ?? iv, plaintext)) else { 31 | return Array(plaintext) 32 | } 33 | prev = xor(plaintext, ciphertext.slice) 34 | return ciphertext 35 | } 36 | 37 | mutating func decrypt(_ ciphertext: ArraySlice) -> Array { 38 | guard let plaintext = cipherOperation(ciphertext) else { 39 | return Array(ciphertext) 40 | } 41 | let result: Array = xor(prev ?? iv, plaintext) 42 | prev = xor(plaintext.slice, ciphertext) 43 | return result 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/BlockMode/RandomAccessBlockModeWorker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | protocol RandomAccessBlockModeWorker: BlockModeWorker { 17 | var counter: UInt { set get } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Cipher.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | public enum CipherError: Error { 17 | case encrypt 18 | case decrypt 19 | } 20 | 21 | public protocol Cipher: class { 22 | /// Encrypt given bytes at once 23 | /// 24 | /// - parameter bytes: Plaintext data 25 | /// - returns: Encrypted data 26 | func encrypt(_ bytes: ArraySlice) throws -> Array 27 | func encrypt(_ bytes: Array) throws -> Array 28 | 29 | /// Decrypt given bytes at once 30 | /// 31 | /// - parameter bytes: Ciphertext data 32 | /// - returns: Plaintext data 33 | func decrypt(_ bytes: ArraySlice) throws -> Array 34 | func decrypt(_ bytes: Array) throws -> Array 35 | } 36 | 37 | extension Cipher { 38 | public func encrypt(_ bytes: Array) throws -> Array { 39 | return try encrypt(bytes.slice) 40 | } 41 | 42 | public func decrypt(_ bytes: Array) throws -> Array { 43 | return try decrypt(bytes.slice) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Collection+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | extension Collection where Self.Element == UInt8, Self.Index == Int { 16 | 17 | // Big endian order 18 | func toUInt32Array() -> Array { 19 | if isEmpty { 20 | return [] 21 | } 22 | 23 | var result = Array(reserveCapacity: 16) 24 | for idx in stride(from: startIndex, to: endIndex, by: 4) { 25 | let val = UInt32(bytes: self, fromIndex: idx).bigEndian 26 | result.append(val) 27 | } 28 | 29 | return result 30 | } 31 | 32 | // Big endian order 33 | func toUInt64Array() -> Array { 34 | if isEmpty { 35 | return [] 36 | } 37 | 38 | var result = Array(reserveCapacity: 32) 39 | for idx in stride(from: startIndex, to: endIndex, by: 8) { 40 | let val = UInt64(bytes: self, fromIndex: idx).bigEndian 41 | result.append(val) 42 | } 43 | 44 | return result 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Cryptors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | #if os(Linux) || os(Android) || os(FreeBSD) 17 | import Glibc 18 | #else 19 | import Darwin 20 | #endif 21 | 22 | /// Worker cryptor/decryptor of `Updatable` types 23 | public protocol Cryptors: class { 24 | associatedtype EncryptorType: Updatable 25 | associatedtype DecryptorType: Updatable 26 | 27 | /// Cryptor suitable for encryption 28 | func makeEncryptor() throws -> EncryptorType 29 | 30 | /// Cryptor suitable for decryption 31 | func makeDecryptor() throws -> DecryptorType 32 | 33 | /// Generate array of random bytes. Helper function. 34 | static func randomIV(_ blockSize: Int) -> Array 35 | } 36 | 37 | extension Cryptors { 38 | 39 | public static func randomIV(_ blockSize: Int) -> Array { 40 | var randomIV: Array = Array() 41 | randomIV.reserveCapacity(blockSize) 42 | for randomByte in RandomBytesSequence(size: blockSize) { 43 | randomIV.append(randomByte) 44 | } 45 | return randomIV 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/DigestType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | internal protocol DigestType { 17 | func calculate(for bytes: Array) -> Array 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/AES+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | extension AES { 19 | 20 | /// Initialize with CBC block mode. 21 | public convenience init(key: String, iv: String, padding: Padding = .pkcs7) throws { 22 | try self.init(key: key.bytes, blockMode: .CBC(iv: iv.bytes), padding: padding) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/Array+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | public extension Array where Element == UInt8 { 19 | 20 | public func toBase64() -> String? { 21 | return Data(bytes: self).base64EncodedString() 22 | } 23 | 24 | public init(base64: String) { 25 | self.init() 26 | 27 | guard let decodedData = Data(base64Encoded: base64) else { 28 | return 29 | } 30 | 31 | append(contentsOf: decodedData.bytes) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | extension Blowfish { 19 | 20 | /// Initialize with CBC block mode. 21 | public convenience init(key: String, iv: String, padding: Padding = .pkcs7) throws { 22 | try self.init(key: key.bytes, blockMode: .CBC(iv: iv.bytes), padding: padding) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | extension ChaCha20 { 19 | 20 | public convenience init(key: String, iv: String) throws { 21 | try self.init(key: key.bytes, iv: iv.bytes) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | extension HMAC { 19 | 20 | public convenience init(key: String, variant: HMAC.Variant = .md5) throws { 21 | self.init(key: key.bytes, variant: variant) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | extension Rabbit { 19 | 20 | public convenience init(key: String) throws { 21 | try self.init(key: key.bytes) 22 | } 23 | 24 | public convenience init(key: String, iv: String) throws { 25 | try self.init(key: key.bytes, iv: iv.bytes) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | extension String { 19 | 20 | /// Return Base64 back to String 21 | public func decryptBase64ToString(cipher: Cipher) throws -> String { 22 | guard let decodedData = Data(base64Encoded: self, options: []) else { 23 | throw CipherError.decrypt 24 | } 25 | 26 | let decrypted = try decodedData.decrypt(cipher: cipher) 27 | 28 | if let decryptedString = String(data: decrypted, encoding: String.Encoding.utf8) { 29 | return decryptedString 30 | } 31 | 32 | throw CipherError.decrypt 33 | } 34 | 35 | public func decryptBase64(cipher: Cipher) throws -> Array { 36 | guard let decodedData = Data(base64Encoded: self, options: []) else { 37 | throw CipherError.decrypt 38 | } 39 | 40 | return try decodedData.decrypt(cipher: cipher).bytes 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Foundation/Utils+Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | import Foundation 17 | 18 | func perf(_ text: String, closure: () -> Void) { 19 | let measurementStart = Date() 20 | 21 | closure() 22 | 23 | let measurementStop = Date() 24 | let executionTime = measurementStop.timeIntervalSince(measurementStart) 25 | 26 | print("\(text) \(executionTime)") 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Int+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Created by Marcin Krzyzanowski on 12/08/14. 5 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // 8 | // In no event will the authors be held liable for any damages arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 11 | // 12 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 13 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 14 | // - This notice may not be removed or altered from any source or binary distribution. 15 | // 16 | 17 | #if os(Linux) || os(Android) || os(FreeBSD) 18 | import Glibc 19 | #else 20 | import Darwin 21 | #endif 22 | 23 | /* array of bits */ 24 | extension Int { 25 | init(bits: [Bit]) { 26 | self.init(bitPattern: integerFrom(bits) as UInt) 27 | } 28 | } 29 | 30 | extension FixedWidthInteger { 31 | @_transparent 32 | func bytes(totalBytes: Int = MemoryLayout.size) -> Array { 33 | return arrayOfBytes(value: self, length: totalBytes) 34 | // TODO: adjust bytes order 35 | // var value = self 36 | // return withUnsafeBytes(of: &value, Array.init).reversed() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/NoPadding.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | struct NoPadding: PaddingProtocol { 17 | 18 | init() { 19 | } 20 | 21 | func add(to data: Array, blockSize _: Int) -> Array { 22 | return data 23 | } 24 | 25 | func remove(from data: Array, blockSize _: Int?) -> Array { 26 | return data 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/Operators.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | /* 17 | Bit shifting with overflow protection using overflow operator "&". 18 | Approach is consistent with standard overflow operators &+, &-, &*, &/ 19 | and introduce new overflow operators for shifting: &<<, &>> 20 | 21 | Note: Works with unsigned integers values only 22 | 23 | Usage 24 | 25 | var i = 1 // init 26 | var j = i &<< 2 //shift left 27 | j &<<= 2 //shift left and assign 28 | 29 | @see: https://medium.com/@krzyzanowskim/swiftly-shift-bits-and-protect-yourself-be33016ce071 30 | 31 | This fuctonality is now implemented as part of Swift 3, SE-0104 https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md 32 | */ 33 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS5.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | // PKCS is a group of public-key cryptography standards devised 17 | // and published by RSA Security Inc, starting in the early 1990s. 18 | // 19 | 20 | public enum PKCS5 { 21 | typealias Padding = PKCS7Padding 22 | } 23 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | public enum PKCS7 { 17 | typealias Padding = PKCS7Padding 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/RandomAccessCryptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | /// Random access cryptor 17 | public protocol RandomAccessCryptor: Updatable { 18 | /// Seek to position in file, if block mode allows random access. 19 | /// 20 | /// - parameter to: new value of counter 21 | /// 22 | /// - returns: true if seek succeed 23 | @discardableResult mutating func seek(to: Int) -> Bool 24 | } 25 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/RandomBytesSequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | #if os(Linux) || os(Android) || os(FreeBSD) 17 | import Glibc 18 | #else 19 | import Darwin 20 | #endif 21 | 22 | struct RandomBytesSequence: Sequence { 23 | let size: Int 24 | 25 | func makeIterator() -> AnyIterator { 26 | var count = 0 27 | return AnyIterator.init({ () -> UInt8? in 28 | if count >= self.size { 29 | return nil 30 | } 31 | count = count + 1 32 | 33 | #if os(Linux) || os(Android) || os(FreeBSD) 34 | let fd = open("/dev/urandom", O_RDONLY) 35 | if fd <= 0 { 36 | return nil 37 | } 38 | 39 | var value: UInt8 = 0 40 | let result = read(fd, &value, MemoryLayout.size) 41 | precondition(result == 1) 42 | 43 | close(fd) 44 | return value 45 | #else 46 | return UInt8(arc4random_uniform(UInt32(UInt8.max) + 1)) 47 | #endif 48 | }) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/UInt16+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | /** array of bytes */ 17 | extension UInt16 { 18 | 19 | @_specialize(exported: true, where T == ArraySlice) 20 | init(bytes: T) where T.Element == UInt8, T.Index == Int { 21 | self = UInt16(bytes: bytes, fromIndex: bytes.startIndex) 22 | } 23 | 24 | @_specialize(exported: true, where T == ArraySlice) 25 | init(bytes: T, fromIndex index: T.Index) where T.Element == UInt8, T.Index == Int { 26 | if bytes.isEmpty { 27 | self = 0 28 | return 29 | } 30 | 31 | let count = bytes.count 32 | 33 | let val0 = count > 0 ? UInt16(bytes[index.advanced(by: 0)]) << 8 : 0 34 | let val1 = count > 1 ? UInt16(bytes[index.advanced(by: 1)]) : 0 35 | 36 | self = val0 | val1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/UInt32+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | #if os(Linux) || os(Android) || os(FreeBSD) 17 | import Glibc 18 | #else 19 | import Darwin 20 | #endif 21 | 22 | protocol _UInt32Type {} 23 | extension UInt32: _UInt32Type {} 24 | 25 | /** array of bytes */ 26 | extension UInt32 { 27 | 28 | @_specialize(exported: true, where T == ArraySlice) 29 | init(bytes: T) where T.Element == UInt8, T.Index == Int { 30 | self = UInt32(bytes: bytes, fromIndex: bytes.startIndex) 31 | } 32 | 33 | @_specialize(exported: true, where T == ArraySlice) 34 | init(bytes: T, fromIndex index: T.Index) where T.Element == UInt8, T.Index == Int { 35 | if bytes.isEmpty { 36 | self = 0 37 | return 38 | } 39 | 40 | let count = bytes.count 41 | 42 | let val0 = count > 0 ? UInt32(bytes[index.advanced(by: 0)]) << 24 : 0 43 | let val1 = count > 1 ? UInt32(bytes[index.advanced(by: 1)]) << 16 : 0 44 | let val2 = count > 2 ? UInt32(bytes[index.advanced(by: 2)]) << 8 : 0 45 | let val3 = count > 3 ? UInt32(bytes[index.advanced(by: 3)]) : 0 46 | 47 | self = val0 | val1 | val2 | val3 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Example/Pods/CryptoSwift/Sources/CryptoSwift/ZeroPadding.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoSwift 3 | // 4 | // Copyright (C) 2014-2017 Marcin Krzyżanowski 5 | // This software is provided 'as-is', without any express or implied warranty. 6 | // 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 10 | // 11 | // - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required. 12 | // - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | // - This notice may not be removed or altered from any source or binary distribution. 14 | // 15 | 16 | /// All the bytes that are required to be padded are padded with zero. 17 | /// Zero padding may not be reversible if the original file ends with one or more zero bytes. 18 | struct ZeroPadding: PaddingProtocol { 19 | 20 | init() { 21 | } 22 | 23 | func add(to bytes: Array, blockSize: Int) -> Array { 24 | let paddingCount = blockSize - (bytes.count % blockSize) 25 | if paddingCount > 0 { 26 | return bytes + Array(repeating: 0, count: paddingCount) 27 | } 28 | return bytes 29 | } 30 | 31 | func remove(from bytes: Array, blockSize _: Int?) -> Array { 32 | for (idx, value) in bytes.reversed().enumerated() { 33 | if value != 0 { 34 | return Array(bytes[0.. 0.8.3" 26 | ], 27 | "Starscream": [ 28 | "~> 3.0.5" 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CryptoSwift (0.8.3) 3 | - Nimble (7.0.3) 4 | - Quick (1.2.0) 5 | - Starscream (3.0.5) 6 | - SwiftFlyer (0.2.1): 7 | - CryptoSwift (~> 0.8.3) 8 | - Starscream (~> 3.0.5) 9 | 10 | DEPENDENCIES: 11 | - Nimble (~> 7.0.2) 12 | - Quick (~> 1.2.0) 13 | - SwiftFlyer (from `../`) 14 | 15 | EXTERNAL SOURCES: 16 | SwiftFlyer: 17 | :path: ../ 18 | 19 | SPEC CHECKSUMS: 20 | CryptoSwift: 033efc3523865d19cc6ab6612fa17a62613b5dfa 21 | Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac 22 | Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 23 | Starscream: faf918b2f2eff7d5dd21180646bf015a669673bd 24 | SwiftFlyer: d0489dd470b4f30eacec1986e2f4898f5eaa00e8 25 | 26 | PODFILE CHECKSUM: 0e2e09933c4a5d391753b4d68ab707c15f8357d7 27 | 28 | COCOAPODS: 1.4.0 29 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Protocol for the assertion handler that Nimble uses for all expectations. 4 | public protocol AssertionHandler { 5 | func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) 6 | } 7 | 8 | /// Global backing interface for assertions that Nimble creates. 9 | /// Defaults to a private test handler that passes through to XCTest. 10 | /// 11 | /// If XCTest is not available, you must assign your own assertion handler 12 | /// before using any matchers, otherwise Nimble will abort the program. 13 | /// 14 | /// @see AssertionHandler 15 | public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in 16 | return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() 17 | }() 18 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift: -------------------------------------------------------------------------------- 1 | /// AssertionDispatcher allows multiple AssertionHandlers to receive 2 | /// assertion messages. 3 | /// 4 | /// @warning Does not fully dispatch if one of the handlers raises an exception. 5 | /// This is possible with XCTest-based assertion handlers. 6 | /// 7 | public class AssertionDispatcher: AssertionHandler { 8 | let handlers: [AssertionHandler] 9 | 10 | public init(handlers: [AssertionHandler]) { 11 | self.handlers = handlers 12 | } 13 | 14 | public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { 15 | for handler in handlers { 16 | handler.assert(assertion, message: message, location: location) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift: -------------------------------------------------------------------------------- 1 | import Dispatch 2 | import Foundation 3 | 4 | /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this 5 | /// class' existence 6 | internal class NimbleEnvironment { 7 | static var activeInstance: NimbleEnvironment { 8 | get { 9 | let env = Thread.current.threadDictionary["NimbleEnvironment"] 10 | if let env = env as? NimbleEnvironment { 11 | return env 12 | } else { 13 | let newEnv = NimbleEnvironment() 14 | self.activeInstance = newEnv 15 | return newEnv 16 | } 17 | } 18 | set { 19 | Thread.current.threadDictionary["NimbleEnvironment"] = newValue 20 | } 21 | } 22 | 23 | // TODO: eventually migrate the global to this environment value 24 | var assertionHandler: AssertionHandler { 25 | get { return NimbleAssertionHandler } 26 | set { NimbleAssertionHandler = newValue } 27 | } 28 | 29 | var suppressTVOSAssertionWarning: Bool = false 30 | var awaiter: Awaiter 31 | 32 | init() { 33 | let timeoutQueue: DispatchQueue 34 | if #available(OSX 10.10, *) { 35 | timeoutQueue = DispatchQueue.global(qos: .userInitiated) 36 | } else { 37 | timeoutQueue = DispatchQueue.global(priority: .high) 38 | } 39 | 40 | awaiter = Awaiter( 41 | waitLock: AssertionWaitLock(), 42 | asyncQueue: .main, 43 | timeoutQueue: timeoutQueue) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is greater than the expected value. 4 | public func beGreaterThan(_ expectedValue: T?) -> Predicate { 5 | let errorMessage = "be greater than <\(stringify(expectedValue))>" 6 | return Predicate.simple(errorMessage) { actualExpression in 7 | if let actual = try actualExpression.evaluate(), let expected = expectedValue { 8 | return PredicateStatus(bool: actual > expected) 9 | } 10 | return .fail 11 | } 12 | } 13 | 14 | /// A Nimble matcher that succeeds when the actual value is greater than the expected value. 15 | public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { 16 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 17 | failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" 18 | let actualValue = try actualExpression.evaluate() 19 | let matches = actualValue != nil 20 | && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending 21 | return matches 22 | }.requireNonNil 23 | } 24 | 25 | public func >(lhs: Expectation, rhs: T) { 26 | lhs.to(beGreaterThan(rhs)) 27 | } 28 | 29 | public func > (lhs: Expectation, rhs: NMBComparable?) { 30 | lhs.to(beGreaterThan(rhs)) 31 | } 32 | 33 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 34 | extension NMBObjCMatcher { 35 | @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 36 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 37 | let expr = actualExpression.cast { $0 as? NMBComparable } 38 | return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) 39 | } 40 | } 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is greater than 4 | /// or equal to the expected value. 5 | public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { 6 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 7 | failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" 8 | let actualValue = try actualExpression.evaluate() 9 | if let actual = actualValue, let expected = expectedValue { 10 | return actual >= expected 11 | } 12 | return false 13 | }.requireNonNil 14 | } 15 | 16 | /// A Nimble matcher that succeeds when the actual value is greater than 17 | /// or equal to the expected value. 18 | public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { 19 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 20 | failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" 21 | let actualValue = try actualExpression.evaluate() 22 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending 23 | return matches 24 | }.requireNonNil 25 | } 26 | 27 | public func >=(lhs: Expectation, rhs: T) { 28 | lhs.to(beGreaterThanOrEqualTo(rhs)) 29 | } 30 | 31 | public func >=(lhs: Expectation, rhs: T) { 32 | lhs.to(beGreaterThanOrEqualTo(rhs)) 33 | } 34 | 35 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 36 | extension NMBObjCMatcher { 37 | @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 38 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 39 | let expr = actualExpression.cast { $0 as? NMBComparable } 40 | return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) 41 | } 42 | } 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is the same instance 4 | /// as the expected instance. 5 | public func beIdenticalTo(_ expected: Any?) -> Predicate { 6 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 7 | #if os(Linux) 8 | let actual = try actualExpression.evaluate() as? AnyObject 9 | #else 10 | let actual = try actualExpression.evaluate() as AnyObject? 11 | #endif 12 | failureMessage.actualValue = "\(identityAsString(actual))" 13 | failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" 14 | #if os(Linux) 15 | return actual === (expected as? AnyObject) && actual !== nil 16 | #else 17 | return actual === (expected as AnyObject?) && actual !== nil 18 | #endif 19 | }.requireNonNil 20 | } 21 | 22 | public func === (lhs: Expectation, rhs: Any?) { 23 | lhs.to(beIdenticalTo(rhs)) 24 | } 25 | public func !== (lhs: Expectation, rhs: Any?) { 26 | lhs.toNot(beIdenticalTo(rhs)) 27 | } 28 | 29 | /// A Nimble matcher that succeeds when the actual value is the same instance 30 | /// as the expected instance. 31 | /// 32 | /// Alias for "beIdenticalTo". 33 | public func be(_ expected: Any?) -> Predicate { 34 | return beIdenticalTo(expected) 35 | } 36 | 37 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 38 | extension NMBObjCMatcher { 39 | @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { 40 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 41 | let aExpr = actualExpression.cast { $0 as Any? } 42 | return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) 43 | } 44 | } 45 | } 46 | #endif 47 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is less than the expected value. 4 | public func beLessThan(_ expectedValue: T?) -> Predicate { 5 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 6 | failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" 7 | if let actual = try actualExpression.evaluate(), let expected = expectedValue { 8 | return actual < expected 9 | } 10 | return false 11 | }.requireNonNil 12 | } 13 | 14 | /// A Nimble matcher that succeeds when the actual value is less than the expected value. 15 | public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { 16 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 17 | failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" 18 | let actualValue = try actualExpression.evaluate() 19 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending 20 | return matches 21 | }.requireNonNil 22 | } 23 | 24 | public func <(lhs: Expectation, rhs: T) { 25 | lhs.to(beLessThan(rhs)) 26 | } 27 | 28 | public func < (lhs: Expectation, rhs: NMBComparable?) { 29 | lhs.to(beLessThan(rhs)) 30 | } 31 | 32 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 33 | extension NMBObjCMatcher { 34 | @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 35 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 36 | let expr = actualExpression.cast { $0 as? NMBComparable } 37 | return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) 38 | } 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is less than 4 | /// or equal to the expected value. 5 | public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { 6 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 7 | failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" 8 | if let actual = try actualExpression.evaluate(), let expected = expectedValue { 9 | return actual <= expected 10 | } 11 | return false 12 | }.requireNonNil 13 | } 14 | 15 | /// A Nimble matcher that succeeds when the actual value is less than 16 | /// or equal to the expected value. 17 | public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { 18 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 19 | failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" 20 | let actualValue = try actualExpression.evaluate() 21 | return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending 22 | }.requireNonNil 23 | } 24 | 25 | public func <=(lhs: Expectation, rhs: T) { 26 | lhs.to(beLessThanOrEqualTo(rhs)) 27 | } 28 | 29 | public func <=(lhs: Expectation, rhs: T) { 30 | lhs.to(beLessThanOrEqualTo(rhs)) 31 | } 32 | 33 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 34 | extension NMBObjCMatcher { 35 | @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 36 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 37 | let expr = actualExpression.cast { $0 as? NMBComparable } 38 | return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) 39 | } 40 | } 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is nil. 4 | public func beNil() -> Predicate { 5 | return Predicate.simpleNilable("be nil") { actualExpression in 6 | let actualValue = try actualExpression.evaluate() 7 | return PredicateStatus(bool: actualValue == nil) 8 | } 9 | } 10 | 11 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 12 | extension NMBObjCMatcher { 13 | @objc public class func beNilMatcher() -> NMBObjCMatcher { 14 | return NMBObjCMatcher { actualExpression, failureMessage in 15 | return try! beNil().matches(actualExpression, failureMessage: failureMessage) 16 | } 17 | } 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is Void. 4 | public func beVoid() -> Predicate<()> { 5 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 6 | failureMessage.postfixMessage = "be void" 7 | let actualValue: ()? = try actualExpression.evaluate() 8 | return actualValue != nil 9 | } 10 | } 11 | 12 | public func == (lhs: Expectation<()>, rhs: ()) { 13 | lhs.to(beVoid()) 14 | } 15 | 16 | public func != (lhs: Expectation<()>, rhs: ()) { 17 | lhs.toNot(beVoid()) 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/Match.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual string satisfies the regular expression 4 | /// described by the expected string. 5 | public func match(_ expectedValue: String?) -> Predicate { 6 | return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in 7 | failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" 8 | 9 | if let actual = try actualExpression.evaluate() { 10 | if let regexp = expectedValue { 11 | return actual.range(of: regexp, options: .regularExpression) != nil 12 | } 13 | } 14 | 15 | return false 16 | }.requireNonNil 17 | } 18 | 19 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 20 | 21 | extension NMBObjCMatcher { 22 | @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { 23 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 24 | let actual = actualExpression.cast { $0 as? String } 25 | return try! match(expected.description).matches(actual, failureMessage: failureMessage) 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/ToSucceed.swift: -------------------------------------------------------------------------------- 1 | /** 2 | Used by the `toSucceed` matcher. 3 | 4 | This is the return type for the closure. 5 | */ 6 | public enum ToSucceedResult { 7 | case succeeded 8 | case failed(reason: String) 9 | } 10 | 11 | /** 12 | A Nimble matcher that takes in a closure for validation. 13 | 14 | Return `.succeeded` when the validation succeeds. 15 | Return `.failed` with a failure reason when the validation fails. 16 | */ 17 | public func succeed() -> Predicate<() -> ToSucceedResult> { 18 | return Predicate.define { actualExpression in 19 | let optActual = try actualExpression.evaluate() 20 | guard let actual = optActual else { 21 | return PredicateResult(status: .fail, message: .fail("expected a closure, got ")) 22 | } 23 | 24 | switch actual() { 25 | case .succeeded: 26 | return PredicateResult( 27 | bool: true, 28 | message: .expectedCustomValueTo("succeed", "") 29 | ) 30 | case .failed(let reason): 31 | return PredicateResult( 32 | bool: false, 33 | message: .expectedCustomValueTo("succeed", " because <\(reason)>") 34 | ) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Nimble.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NMBExceptionCapture.h" 3 | #import "NMBStringify.h" 4 | #import "DSL.h" 5 | 6 | #if TARGET_OS_TV 7 | #import "CwlPreconditionTesting_POSIX.h" 8 | #else 9 | #import "CwlPreconditionTesting.h" 10 | #endif 11 | 12 | FOUNDATION_EXPORT double NimbleVersionNumber; 13 | FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; 14 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Utils/Errors.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // Generic 4 | 5 | internal func setFailureMessageForError( 6 | _ failureMessage: FailureMessage, 7 | postfixMessageVerb: String = "throw", 8 | actualError: Error?, 9 | error: T? = nil, 10 | errorType: T.Type? = nil, 11 | closure: ((T) -> Void)? = nil) { 12 | failureMessage.postfixMessage = "\(postfixMessageVerb) error" 13 | 14 | if let error = error { 15 | failureMessage.postfixMessage += " <\(error)>" 16 | } else if errorType != nil || closure != nil { 17 | failureMessage.postfixMessage += " from type <\(T.self)>" 18 | } 19 | if closure != nil { 20 | failureMessage.postfixMessage += " that satisfies block" 21 | } 22 | if error == nil && errorType == nil && closure == nil { 23 | failureMessage.postfixMessage = "\(postfixMessageVerb) any error" 24 | } 25 | 26 | if let actualError = actualError { 27 | failureMessage.actualValue = "<\(actualError)>" 28 | } else { 29 | failureMessage.actualValue = "no error" 30 | } 31 | } 32 | 33 | internal func errorMatchesExpectedError( 34 | _ actualError: Error, 35 | expectedError: T) -> Bool { 36 | return actualError._domain == expectedError._domain 37 | && actualError._code == expectedError._code 38 | } 39 | 40 | // Non-generic 41 | 42 | internal func setFailureMessageForError( 43 | _ failureMessage: FailureMessage, 44 | actualError: Error?, 45 | closure: ((Error) -> Void)?) { 46 | failureMessage.postfixMessage = "throw error" 47 | 48 | if closure != nil { 49 | failureMessage.postfixMessage += " that satisfies block" 50 | } else { 51 | failureMessage.postfixMessage = "throw any error" 52 | } 53 | 54 | if let actualError = actualError { 55 | failureMessage.actualValue = "<\(actualError)>" 56 | } else { 57 | failureMessage.actualValue = "no error" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Utils/Functional.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension Sequence { 4 | internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { 5 | for item in self { 6 | if !fn(item) { 7 | return false 8 | } 9 | } 10 | return true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // Ideally we would always use `StaticString` as the type for tracking the file name 4 | // that expectations originate from, for consistency with `assert` etc. from the 5 | // stdlib, and because recent versions of the XCTest overlay require `StaticString` 6 | // when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we 7 | // have to use `String` instead because StaticString can't be generated from Objective-C 8 | #if SWIFT_PACKAGE 9 | public typealias FileString = StaticString 10 | #else 11 | public typealias FileString = String 12 | #endif 13 | 14 | public final class SourceLocation: NSObject { 15 | public let file: FileString 16 | public let line: UInt 17 | 18 | override init() { 19 | file = "Unknown File" 20 | line = 0 21 | } 22 | 23 | init(file: FileString, line: UInt) { 24 | self.file = file 25 | self.line = line 26 | } 27 | 28 | override public var description: String { 29 | return "\(file):\(line)" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | SWIFT_CLASS("_TtC6Nimble22CurrentTestCaseTracker") 5 | @interface CurrentTestCaseTracker : NSObject 6 | + (CurrentTestCaseTracker *)sharedInstance; 7 | @end 8 | 9 | @interface CurrentTestCaseTracker (Register) @end 10 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NMBExceptionCapture : NSObject 5 | 6 | - (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)(void))finally; 7 | - (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)(void))unsafeBlock NS_SWIFT_NAME(tryBlock(_:)); 8 | 9 | @end 10 | 11 | typedef void(^NMBSourceCallbackBlock)(BOOL successful); 12 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m: -------------------------------------------------------------------------------- 1 | #import "NMBExceptionCapture.h" 2 | 3 | @interface NMBExceptionCapture () 4 | @property (nonatomic, copy) void(^ _Nullable handler)(NSException * _Nullable); 5 | @property (nonatomic, copy) void(^ _Nullable finally)(void); 6 | @end 7 | 8 | @implementation NMBExceptionCapture 9 | 10 | - (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)(void))finally { 11 | self = [super init]; 12 | if (self) { 13 | self.handler = handler; 14 | self.finally = finally; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)tryBlock:(void(^ _Nonnull)(void))unsafeBlock { 20 | @try { 21 | unsafeBlock(); 22 | } 23 | @catch (NSException *exception) { 24 | if (self.handler) { 25 | self.handler(exception); 26 | } 27 | } 28 | @finally { 29 | if (self.finally) { 30 | self.finally(); 31 | } 32 | } 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h: -------------------------------------------------------------------------------- 1 | @class NSString; 2 | 3 | /** 4 | * Returns a string appropriate for displaying in test output 5 | * from the provided value. 6 | * 7 | * @param anyObject A value that will show up in a test's output. 8 | * 9 | * @return The string that is returned can be 10 | * customized per type by conforming a type to the `TestOutputStringConvertible` 11 | * protocol. When stringifying a non-`TestOutputStringConvertible` type, this 12 | * function will return the value's debug description and then its 13 | * normal description if available and in that order. Otherwise it 14 | * will return the result of constructing a string from the value. 15 | * 16 | * @see `TestOutputStringConvertible` 17 | */ 18 | extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); 19 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m: -------------------------------------------------------------------------------- 1 | #import "NMBStringify.h" 2 | #import 3 | 4 | NSString *_Nonnull NMBStringify(id _Nullable anyObject) { 5 | return [NMBStringer stringify:anyObject]; 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Behavior.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A `Behavior` encapsulates a set of examples that can be re-used in several locations using the `itBehavesLike` function with a context instance of the generic type. 3 | */ 4 | 5 | open class Behavior { 6 | 7 | open static var name: String { return String(describing: self) } 8 | /** 9 | override this method in your behavior to define a set of reusable examples. 10 | 11 | This behaves just like an example group defines using `describe` or `context`--it may contain any number of `beforeEach` 12 | and `afterEach` closures, as well as any number of examples (defined using `it`). 13 | 14 | - parameter aContext: A closure that, when evaluated, returns a `Context` instance that provide the information on the subject. 15 | */ 16 | open class func spec(_ aContext: @escaping () -> Context) {} 17 | } 18 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Callsite.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` 4 | // does not work as expected. 5 | #if swift(>=3.2) 6 | #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE 7 | @objcMembers 8 | public class _CallsiteBase: NSObject {} 9 | #else 10 | public class _CallsiteBase: NSObject {} 11 | #endif 12 | #else 13 | public class _CallsiteBase: NSObject {} 14 | #endif 15 | 16 | /** 17 | An object encapsulating the file and line number at which 18 | a particular example is defined. 19 | */ 20 | final public class Callsite: _CallsiteBase { 21 | /** 22 | The absolute path of the file in which an example is defined. 23 | */ 24 | public let file: String 25 | 26 | /** 27 | The line number on which an example is defined. 28 | */ 29 | public let line: UInt 30 | 31 | internal init(file: String, line: UInt) { 32 | self.file = file 33 | self.line = line 34 | } 35 | } 36 | 37 | extension Callsite { 38 | /** 39 | Returns a boolean indicating whether two Callsite objects are equal. 40 | If two callsites are in the same file and on the same line, they must be equal. 41 | */ 42 | @nonobjc public static func == (lhs: Callsite, rhs: Callsite) -> Bool { 43 | return lhs.file == rhs.file && lhs.line == rhs.line 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/ErrorUtility.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal func raiseError(_ message: String) -> Never { 4 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 5 | NSException(name: .internalInconsistencyException, reason: message, userInfo: nil).raise() 6 | #endif 7 | 8 | // This won't be reached when ObjC is available and the exception above is raisd 9 | fatalError(message) 10 | } 11 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/ExampleMetadata.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` 4 | // does not work as expected. 5 | #if swift(>=3.2) 6 | #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE 7 | @objcMembers 8 | public class _ExampleMetadataBase: NSObject {} 9 | #else 10 | public class _ExampleMetadataBase: NSObject {} 11 | #endif 12 | #else 13 | public class _ExampleMetadataBase: NSObject {} 14 | #endif 15 | 16 | /** 17 | A class that encapsulates information about an example, 18 | including the index at which the example was executed, as 19 | well as the example itself. 20 | */ 21 | final public class ExampleMetadata: _ExampleMetadataBase { 22 | /** 23 | The example for which this metadata was collected. 24 | */ 25 | public let example: Example 26 | 27 | /** 28 | The index at which this example was executed in the 29 | test suite. 30 | */ 31 | public let exampleIndex: Int 32 | 33 | internal init(example: Example, exampleIndex: Int) { 34 | self.example = example 35 | self.exampleIndex = exampleIndex 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Filter.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` 4 | // does not work as expected. 5 | #if swift(>=3.2) 6 | #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE 7 | @objcMembers 8 | public class _FilterBase: NSObject {} 9 | #else 10 | public class _FilterBase: NSObject {} 11 | #endif 12 | #else 13 | public class _FilterBase: NSObject {} 14 | #endif 15 | 16 | /** 17 | A mapping of string keys to booleans that can be used to 18 | filter examples or example groups. For example, a "focused" 19 | example would have the flags [Focused: true]. 20 | */ 21 | public typealias FilterFlags = [String: Bool] 22 | 23 | /** 24 | A namespace for filter flag keys, defined primarily to make the 25 | keys available in Objective-C. 26 | */ 27 | final public class Filter: _FilterBase { 28 | /** 29 | Example and example groups with [Focused: true] are included in test runs, 30 | excluding all other examples without this flag. Use this to only run one or 31 | two tests that you're currently focusing on. 32 | */ 33 | public class var focused: String { 34 | return "focused" 35 | } 36 | 37 | /** 38 | Example and example groups with [Pending: true] are excluded from test runs. 39 | Use this to temporarily suspend examples that you know do not pass yet. 40 | */ 41 | public class var pending: String { 42 | return "pending" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Hooks/Closures.swift: -------------------------------------------------------------------------------- 1 | // MARK: Example Hooks 2 | 3 | /** 4 | A closure executed before an example is run. 5 | */ 6 | public typealias BeforeExampleClosure = () -> Void 7 | 8 | /** 9 | A closure executed before an example is run. The closure is given example metadata, 10 | which contains information about the example that is about to be run. 11 | */ 12 | public typealias BeforeExampleWithMetadataClosure = (_ exampleMetadata: ExampleMetadata) -> Void 13 | 14 | /** 15 | A closure executed after an example is run. 16 | */ 17 | public typealias AfterExampleClosure = BeforeExampleClosure 18 | 19 | /** 20 | A closure executed after an example is run. The closure is given example metadata, 21 | which contains information about the example that has just finished running. 22 | */ 23 | public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClosure 24 | 25 | // MARK: Suite Hooks 26 | 27 | /** 28 | A closure executed before any examples are run. 29 | */ 30 | public typealias BeforeSuiteClosure = () -> Void 31 | 32 | /** 33 | A closure executed after all examples have finished running. 34 | */ 35 | public typealias AfterSuiteClosure = BeforeSuiteClosure 36 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A container for closures to be executed before and after each example. 3 | */ 4 | final internal class ExampleHooks { 5 | internal var befores: [BeforeExampleWithMetadataClosure] = [] 6 | internal var afters: [AfterExampleWithMetadataClosure] = [] 7 | internal var phase: HooksPhase = .nothingExecuted 8 | 9 | internal func appendBefore(_ closure: @escaping BeforeExampleWithMetadataClosure) { 10 | befores.append(closure) 11 | } 12 | 13 | internal func appendBefore(_ closure: @escaping BeforeExampleClosure) { 14 | befores.append { (_: ExampleMetadata) in closure() } 15 | } 16 | 17 | internal func appendAfter(_ closure: @escaping AfterExampleWithMetadataClosure) { 18 | afters.append(closure) 19 | } 20 | 21 | internal func appendAfter(_ closure: @escaping AfterExampleClosure) { 22 | afters.append { (_: ExampleMetadata) in closure() } 23 | } 24 | 25 | internal func executeBefores(_ exampleMetadata: ExampleMetadata) { 26 | phase = .beforesExecuting 27 | for before in befores { 28 | before(exampleMetadata) 29 | } 30 | 31 | phase = .beforesFinished 32 | } 33 | 34 | internal func executeAfters(_ exampleMetadata: ExampleMetadata) { 35 | phase = .aftersExecuting 36 | for after in afters { 37 | after(exampleMetadata) 38 | } 39 | 40 | phase = .aftersFinished 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A description of the execution cycle of the current example with 3 | respect to the hooks of that example. 4 | */ 5 | internal enum HooksPhase { 6 | case nothingExecuted 7 | case beforesExecuting 8 | case beforesFinished 9 | case aftersExecuting 10 | case aftersFinished 11 | } 12 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A container for closures to be executed before and after all examples. 3 | */ 4 | final internal class SuiteHooks { 5 | internal var befores: [BeforeSuiteClosure] = [] 6 | internal var afters: [AfterSuiteClosure] = [] 7 | internal var phase: HooksPhase = .nothingExecuted 8 | 9 | internal func appendBefore(_ closure: @escaping BeforeSuiteClosure) { 10 | befores.append(closure) 11 | } 12 | 13 | internal func appendAfter(_ closure: @escaping AfterSuiteClosure) { 14 | afters.append(closure) 15 | } 16 | 17 | internal func executeBefores() { 18 | phase = .beforesExecuting 19 | for before in befores { 20 | before() 21 | } 22 | phase = .beforesFinished 23 | } 24 | 25 | internal func executeAfters() { 26 | phase = .aftersExecuting 27 | for after in afters { 28 | after() 29 | } 30 | phase = .aftersFinished 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift: -------------------------------------------------------------------------------- 1 | #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) 2 | 3 | import Foundation 4 | 5 | extension Bundle { 6 | 7 | /** 8 | Locates the first bundle with a '.xctest' file extension. 9 | */ 10 | internal static var currentTestBundle: Bundle? { 11 | return allBundles.first { $0.bundlePath.hasSuffix(".xctest") } 12 | } 13 | 14 | /** 15 | Return the module name of the bundle. 16 | Uses the bundle filename and transform it to match Xcode's transformation. 17 | Module name has to be a valid "C99 extended identifier". 18 | */ 19 | internal var moduleName: String { 20 | let fileName = bundleURL.fileName as NSString 21 | return fileName.c99ExtendedIdentifier 22 | } 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift: -------------------------------------------------------------------------------- 1 | #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) 2 | import Foundation 3 | 4 | public extension NSString { 5 | 6 | private static var invalidCharacters: CharacterSet = { 7 | var invalidCharacters = CharacterSet() 8 | 9 | let invalidCharacterSets: [CharacterSet] = [ 10 | .whitespacesAndNewlines, 11 | .illegalCharacters, 12 | .controlCharacters, 13 | .punctuationCharacters, 14 | .nonBaseCharacters, 15 | .symbols 16 | ] 17 | 18 | for invalidSet in invalidCharacterSets { 19 | invalidCharacters.formUnion(invalidSet) 20 | } 21 | 22 | return invalidCharacters 23 | }() 24 | 25 | @objc(qck_c99ExtendedIdentifier) 26 | var c99ExtendedIdentifier: String { 27 | let validComponents = components(separatedBy: NSString.invalidCharacters) 28 | let result = validComponents.joined(separator: "_") 29 | 30 | return result.isEmpty ? "_" : result 31 | } 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/QuickTestSuite.swift: -------------------------------------------------------------------------------- 1 | #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) 2 | 3 | import XCTest 4 | 5 | /** 6 | This protocol defines the role of an object that builds test suites. 7 | */ 8 | internal protocol QuickTestSuiteBuilder { 9 | 10 | /** 11 | Construct a `QuickTestSuite` instance with the appropriate test cases added as tests. 12 | 13 | Subsequent calls to this method should return equivalent test suites. 14 | */ 15 | func buildTestSuite() -> QuickTestSuite 16 | 17 | } 18 | 19 | /** 20 | A base class for a class cluster of Quick test suites, that should correctly 21 | build dynamic test suites for XCTest to execute. 22 | */ 23 | public class QuickTestSuite: XCTestSuite { 24 | 25 | private static var builtTestSuites: Set = Set() 26 | 27 | /** 28 | Construct a test suite for a specific, selected subset of test cases (rather 29 | than the default, which as all test cases). 30 | 31 | If this method is called multiple times for the same test case class, e.g.. 32 | 33 | FooSpec/testFoo 34 | FooSpec/testBar 35 | 36 | It is expected that the first call should return a valid test suite, and 37 | all subsequent calls should return `nil`. 38 | */ 39 | @objc 40 | public static func selectedTestSuite(forTestCaseWithName name: String) -> QuickTestSuite? { 41 | guard let builder = QuickSelectedTestSuiteBuilder(forTestCaseWithName: name) else { return nil } 42 | 43 | let (inserted, _) = builtTestSuites.insert(builder.testSuiteClassName) 44 | if inserted { 45 | return builder.buildTestSuite() 46 | } else { 47 | return nil 48 | } 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/Quick/URL+FileName.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension URL { 4 | 5 | /** 6 | Returns the path file name without file extension. 7 | */ 8 | var fileName: String { 9 | return self.deletingPathExtension().lastPathComponent 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class Configuration; 4 | 5 | /** 6 | Subclass QuickConfiguration and override the +[QuickConfiguration configure:] 7 | method in order to configure how Quick behaves when running specs, or to define 8 | shared examples that are used across spec files. 9 | */ 10 | @interface QuickConfiguration : NSObject 11 | 12 | /** 13 | This method is executed on each subclass of this class before Quick runs 14 | any examples. You may override this method on as many subclasses as you like, but 15 | there is no guarantee as to the order in which these methods are executed. 16 | 17 | You can override this method in order to: 18 | 19 | 1. Configure how Quick behaves, by modifying properties on the Configuration object. 20 | Setting the same properties in several methods has undefined behavior. 21 | 22 | 2. Define shared examples using `sharedExamples`. 23 | 24 | @param configuration A mutable object that is used to configure how Quick behaves on 25 | a framework level. For details on all the options, see the 26 | documentation in Configuration.swift. 27 | */ 28 | + (void)configure:(Configuration *)configuration; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface World (SWIFT_EXTENSION(Quick)) 4 | - (void)beforeSuite:(void (^ __nonnull)(void))closure; 5 | - (void)afterSuite:(void (^ __nonnull)(void))closure; 6 | - (void)sharedExamples:(NSString * __nonnull)name closure:(void (^ __nonnull)(NSDictionary * __nonnull (^ __nonnull)(void)))closure; 7 | - (void)describe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 8 | - (void)context:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 9 | - (void)fdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 10 | - (void)xdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 11 | - (void)beforeEach:(void (^ __nonnull)(void))closure; 12 | - (void)beforeEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; 13 | - (void)afterEach:(void (^ __nonnull)(void))closure; 14 | - (void)afterEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; 15 | - (void)itWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; 16 | - (void)fitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; 17 | - (void)xitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; 18 | - (void)itBehavesLikeSharedExampleNamed:(NSString * __nonnull)name sharedExampleContext:(NSDictionary * __nonnull (^ __nonnull)(void))sharedExampleContext flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line; 19 | - (void)pending:(NSString * __nonnull)description closure:(void (^ __nonnull)(void))closure; 20 | @end 21 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickObjectiveC/Quick.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for Quick. 4 | FOUNDATION_EXPORT double QuickVersionNumber; 5 | 6 | //! Project version string for Quick. 7 | FOUNDATION_EXPORT const unsigned char QuickVersionString[]; 8 | 9 | #import "QuickSpec.h" 10 | #import "QCKDSL.h" 11 | #import "QuickConfiguration.h" 12 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | QuickSpec is a base class all specs written in Quick inherit from. 5 | They need to inherit from QuickSpec, a subclass of XCTestCase, in 6 | order to be discovered by the XCTest framework. 7 | 8 | XCTest automatically compiles a list of XCTestCase subclasses included 9 | in the test target. It iterates over each class in that list, and creates 10 | a new instance of that class for each test method. It then creates an 11 | "invocation" to execute that test method. The invocation is an instance of 12 | NSInvocation, which represents a single message send in Objective-C. 13 | The invocation is set on the XCTestCase instance, and the test is run. 14 | 15 | Most of the code in QuickSpec is dedicated to hooking into XCTest events. 16 | First, when the spec is first loaded and before it is sent any messages, 17 | the +[NSObject initialize] method is called. QuickSpec overrides this method 18 | to call +[QuickSpec spec]. This builds the example group stacks and 19 | registers them with Quick.World, a global register of examples. 20 | 21 | Then, XCTest queries QuickSpec for a list of test methods. Normally, XCTest 22 | automatically finds all methods whose selectors begin with the string "test". 23 | However, QuickSpec overrides this default behavior by implementing the 24 | +[XCTestCase testInvocations] method. This method iterates over each example 25 | registered in Quick.World, defines a new method for that example, and 26 | returns an invocation to call that method to XCTest. Those invocations are 27 | the tests that are run by XCTest. Their selector names are displayed in 28 | the Xcode test navigation bar. 29 | */ 30 | @interface QuickSpec : XCTestCase 31 | 32 | /** 33 | Override this method in your spec to define a set of example groups 34 | and examples. 35 | 36 | @code 37 | override func spec() { 38 | describe("winter") { 39 | it("is coming") { 40 | // ... 41 | } 42 | } 43 | } 44 | @endcode 45 | 46 | See DSL.swift for more information on what syntax is available. 47 | */ 48 | - (void)spec; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickObjectiveC/World.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class ExampleGroup; 4 | @class ExampleMetadata; 5 | 6 | SWIFT_CLASS("_TtC5Quick5World") 7 | @interface World 8 | 9 | @property (nonatomic) ExampleGroup * __nullable currentExampleGroup; 10 | @property (nonatomic) ExampleMetadata * __nullable currentExampleMetadata; 11 | @property (nonatomic) BOOL isRunningAdditionalSuites; 12 | + (World * __nonnull)sharedWorld; 13 | - (void)configure:(void (^ __nonnull)(Configuration * __nonnull))closure; 14 | - (void)finalizeConfiguration; 15 | - (ExampleGroup * __nonnull)rootExampleGroupForSpecClass:(Class __nonnull)cls; 16 | - (NSArray * __nonnull)examplesForSpecClass:(Class __nonnull)specClass; 17 | - (void)performWithCurrentExampleGroup:(ExampleGroup * __nonnull)group closure:(void (^ __nonnull)(void))closure; 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface XCTestSuite (QuickTestSuiteBuilder) 6 | @end 7 | 8 | @implementation XCTestSuite (QuickTestSuiteBuilder) 9 | 10 | /** 11 | In order to ensure we can correctly build dynamic test suites, we need to 12 | replace some of the default test suite constructors. 13 | */ 14 | + (void)load { 15 | Method testCaseWithName = class_getClassMethod(self, @selector(testSuiteForTestCaseWithName:)); 16 | Method hooked_testCaseWithName = class_getClassMethod(self, @selector(qck_hooked_testSuiteForTestCaseWithName:)); 17 | method_exchangeImplementations(testCaseWithName, hooked_testCaseWithName); 18 | } 19 | 20 | /** 21 | The `+testSuiteForTestCaseWithName:` method is called when a specific test case 22 | class is run from the Xcode test navigator. If the built test suite is `nil`, 23 | Xcode will not run any tests for that test case. 24 | 25 | Given if the following test case class is run from the Xcode test navigator: 26 | 27 | FooSpec 28 | testFoo 29 | testBar 30 | 31 | XCTest will invoke this once per test case, with test case names following this format: 32 | 33 | FooSpec/testFoo 34 | FooSpec/testBar 35 | */ 36 | + (nullable instancetype)qck_hooked_testSuiteForTestCaseWithName:(nonnull NSString *)name { 37 | return [QuickTestSuite selectedTestSuiteForTestCaseWithName:name]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickSpecBase/QuickSpecBase.m: -------------------------------------------------------------------------------- 1 | #import "QuickSpecBase.h" 2 | 3 | #pragma mark - _QuickSelectorWrapper 4 | 5 | @interface _QuickSelectorWrapper () 6 | @property(nonatomic, assign) SEL selector; 7 | @end 8 | 9 | @implementation _QuickSelectorWrapper 10 | 11 | - (instancetype)initWithSelector:(SEL)selector { 12 | self = [super init]; 13 | _selector = selector; 14 | return self; 15 | } 16 | 17 | @end 18 | 19 | 20 | #pragma mark - _QuickSpecBase 21 | 22 | @implementation _QuickSpecBase 23 | 24 | - (instancetype)init { 25 | self = [super initWithInvocation: nil]; 26 | return self; 27 | } 28 | 29 | /** 30 | Invocations for each test method in the test case. QuickSpec overrides this method to define a 31 | new method for each example defined in +[QuickSpec spec]. 32 | 33 | @return An array of invocations that execute the newly defined example methods. 34 | */ 35 | + (NSArray *)testInvocations { 36 | NSArray<_QuickSelectorWrapper *> *wrappers = [self _qck_testMethodSelectors]; 37 | NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:wrappers.count]; 38 | 39 | for (_QuickSelectorWrapper *wrapper in wrappers) { 40 | SEL selector = wrapper.selector; 41 | NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; 42 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 43 | invocation.selector = selector; 44 | 45 | [invocations addObject:invocation]; 46 | } 47 | 48 | return invocations; 49 | } 50 | 51 | + (NSArray<_QuickSelectorWrapper *> *)_qck_testMethodSelectors { 52 | return @[]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Example/Pods/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface _QuickSelectorWrapper : NSObject 5 | - (instancetype)initWithSelector:(SEL)selector; 6 | @end 7 | 8 | @interface _QuickSpecBase : XCTestCase 9 | + (NSArray<_QuickSelectorWrapper *> *)_qck_testMethodSelectors; 10 | - (instancetype)init NS_DESIGNATED_INITIALIZER; 11 | @end 12 | -------------------------------------------------------------------------------- /Example/Pods/Starscream/zlib/include.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | -------------------------------------------------------------------------------- /Example/Pods/Starscream/zlib/module.modulemap: -------------------------------------------------------------------------------- 1 | module SSCZLib [system] { 2 | header "include.h" 3 | link "z" 4 | export * 5 | } 6 | module SSCommonCrypto [system] { 7 | header "include.h" 8 | export * 9 | } 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CryptoSwift/CryptoSwift-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_CryptoSwift : NSObject 3 | @end 4 | @implementation PodsDummy_CryptoSwift 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CryptoSwift/CryptoSwift-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CryptoSwift/CryptoSwift-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 CryptoSwiftVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char CryptoSwiftVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CryptoSwift/CryptoSwift.modulemap: -------------------------------------------------------------------------------- 1 | framework module CryptoSwift { 2 | umbrella header "CryptoSwift-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CryptoSwift/CryptoSwift.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | GCC_UNROLL_LOOPS = YES 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 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}/CryptoSwift 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | SWIFT_DISABLE_SAFETY_CHECKS = YES 13 | SWIFT_ENFORCE_EXCLUSIVE_ACCESS = compile-time 14 | SWIFT_OPTIMIZATION_LEVEL = -Owholemodule 15 | SWIFT_VERSION = 4.0 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CryptoSwift/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 | 0.8.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/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 | 7.0.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Nimble : NSObject 3 | @end 4 | @implementation PodsDummy_Nimble 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-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 "Nimble.h" 14 | #import "DSL.h" 15 | #import "NMBExceptionCapture.h" 16 | #import "NMBStringify.h" 17 | #import "CwlCatchException.h" 18 | #import "CwlMachBadInstructionHandler.h" 19 | #import "mach_excServer.h" 20 | #import "CwlPreconditionTesting.h" 21 | 22 | FOUNDATION_EXPORT double NimbleVersionNumber; 23 | FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble.modulemap: -------------------------------------------------------------------------------- 1 | framework module Nimble { 2 | umbrella header "Nimble-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Nimble 2 | ENABLE_BITCODE = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 6 | OTHER_LDFLAGS = -weak-lswiftXCTest -weak_framework "XCTest" 7 | OTHER_SWIFT_FLAGS = $(inherited) -suppress-warnings $(inherited) "-D" "COCOAPODS" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Nimble 12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 13 | SKIP_INSTALL = YES 14 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Example/Pods-SwiftFlyer_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_SwiftFlyer_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_SwiftFlyer_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Example/Pods-SwiftFlyer_Example-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_SwiftFlyer_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_SwiftFlyer_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Example/Pods-SwiftFlyer_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift/CryptoSwift.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer/SwiftFlyer.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "CryptoSwift" -framework "Starscream" -framework "SwiftFlyer" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Example/Pods-SwiftFlyer_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_SwiftFlyer_Example { 2 | umbrella header "Pods-SwiftFlyer_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Example/Pods-SwiftFlyer_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift/CryptoSwift.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer/SwiftFlyer.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "CryptoSwift" -framework "Starscream" -framework "SwiftFlyer" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Tests/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Tests/Pods-SwiftFlyer_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_SwiftFlyer_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_SwiftFlyer_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Tests/Pods-SwiftFlyer_Tests-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_SwiftFlyer_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_SwiftFlyer_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Tests/Pods-SwiftFlyer_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "${PODS_CONFIGURATION_BUILD_DIR}/Nimble" "${PODS_CONFIGURATION_BUILD_DIR}/Quick" "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Nimble/Nimble.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Quick/Quick.framework/Headers" $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift/CryptoSwift.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer/SwiftFlyer.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "Nimble" -framework "Quick" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Tests/Pods-SwiftFlyer_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_SwiftFlyer_Tests { 2 | umbrella header "Pods-SwiftFlyer_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-SwiftFlyer_Tests/Pods-SwiftFlyer_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "${PODS_CONFIGURATION_BUILD_DIR}/Nimble" "${PODS_CONFIGURATION_BUILD_DIR}/Quick" "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Nimble/Nimble.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Quick/Quick.framework/Headers" $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift/CryptoSwift.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer/SwiftFlyer.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "Nimble" -framework "Quick" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Quick/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.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Quick/Quick-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Quick : NSObject 3 | @end 4 | @implementation PodsDummy_Quick 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Quick/Quick-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Quick/Quick-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 "QuickConfiguration.h" 14 | #import "QCKDSL.h" 15 | #import "Quick.h" 16 | #import "QuickSpec.h" 17 | 18 | FOUNDATION_EXPORT double QuickVersionNumber; 19 | FOUNDATION_EXPORT const unsigned char QuickVersionString[]; 20 | 21 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Quick/Quick.modulemap: -------------------------------------------------------------------------------- 1 | framework module Quick { 2 | umbrella header "Quick-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Quick/Quick.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Quick 2 | ENABLE_BITCODE = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 6 | OTHER_LDFLAGS = -framework "XCTest" 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_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Quick 12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 13 | SKIP_INSTALL = YES 14 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Starscream/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.0.5 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Starscream/Starscream-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Starscream : NSObject 3 | @end 4 | @implementation PodsDummy_Starscream 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Starscream/Starscream-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Starscream/Starscream-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 StarscreamVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char StarscreamVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Starscream/Starscream.modulemap: -------------------------------------------------------------------------------- 1 | framework module Starscream { 2 | umbrella header "Starscream-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Starscream/Starscream.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Starscream 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_LDFLAGS = -l"z" 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}/Starscream 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | SWIFT_INCLUDE_PATHS = $(PODS_ROOT)/Starscream/zlib 13 | SWIFT_VERSION = 4.1 14 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftFlyer/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 | 0.2.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftFlyer/SwiftFlyer-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SwiftFlyer : NSObject 3 | @end 4 | @implementation PodsDummy_SwiftFlyer 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftFlyer/SwiftFlyer-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftFlyer/SwiftFlyer-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 SwiftFlyerVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char SwiftFlyerVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftFlyer/SwiftFlyer.modulemap: -------------------------------------------------------------------------------- 1 | framework module SwiftFlyer { 2 | umbrella header "SwiftFlyer-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftFlyer/SwiftFlyer.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftFlyer 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 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}/../.. 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Example/SwiftFlyer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/SwiftFlyer.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/SwiftFlyer/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/27. 6 | // Copyright (c) 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftFlyer 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | 19 | // (Optional) Set your API keys, if you access to private API. 20 | BitFlyer.apiKey = "Your API Key" 21 | BitFlyer.apiSecretKey = "Your API Secret Key" 22 | 23 | // (Optional) If you want retrive realtime information, set channels and call `subscribe` of RealTimeAPI. 24 | typealias Channel = RealTimeAPI.SubscribeChannel 25 | 26 | // Set channels for subscribing realtime api from bitFlyer RealTimeAPI by using JSON RPC over WebSocket. 27 | let subscribeChannels: [String] = [ 28 | Channel.SnapShot.boardSnap_fx_btc_jpy.targetChannel, 29 | Channel.Board.board_fx_btc_jpy.targetChannel, 30 | Channel.Ticker.ticker_fx_btc_jpy.targetChannel, 31 | Channel.Execution.execution_fx_btc_jpy.targetChannel 32 | ] 33 | 34 | // Set subscribe channels. 35 | RealTimeAPI.shared.setSubscribeChannels(with: subscribeChannels) 36 | 37 | // Start observing realtime API 38 | RealTimeAPI.shared.connect() 39 | 40 | return true 41 | } 42 | 43 | func applicationWillResignActive(_ application: UIApplication) {} 44 | 45 | func applicationDidEnterBackground(_ application: UIApplication) {} 46 | 47 | func applicationWillEnterForeground(_ application: UIApplication) {} 48 | 49 | func applicationDidBecomeActive(_ application: UIApplication) {} 50 | 51 | func applicationWillTerminate(_ application: UIApplication) {} 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Example/SwiftFlyer/ExecutionHistoryCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExecutionHistoryCell.swift 3 | // SwiftFlyer_Example 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2018年 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | final class ExecutionHistoryCell: UITableViewCell { 13 | @IBOutlet weak var side: UILabel! 14 | @IBOutlet weak var price: UILabel! 15 | @IBOutlet weak var size: UILabel! 16 | @IBOutlet weak var execDate: UILabel! 17 | 18 | override func awakeFromNib() { 19 | super.awakeFromNib() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Example/SwiftFlyer/Images.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" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/SwiftFlyer/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/Tests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | // https://github.com/Quick/Quick 2 | 3 | import Quick 4 | import Nimble 5 | 6 | class TableOfContentsSpec: QuickSpec { 7 | override func spec() { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Ryo Ishikawa 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 | -------------------------------------------------------------------------------- /SwiftFlyer.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'SwiftFlyer' 3 | s.version = '0.2.2' 4 | s.summary = 'An API wrapper for bitFlyer written in Swift.' 5 | 6 | s.description = <<-DESC 7 | An API wrapper for bitFlyer that supports all providing API. 8 | DESC 9 | 10 | s.homepage = "https://github.com/rinov/SwiftFlyer" 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { 'rinov' => 'rinov@rinov.jp' } 13 | s.source = { :git => 'https://github.com/rinov/SwiftFlyer.git', :tag => s.version.to_s } 14 | s.ios.deployment_target = '9.0' 15 | s.osx.deployment_target = '10.11' 16 | s.source_files = 'SwiftFlyer/**/*' 17 | s.dependency 'CryptoSwift', '~> 0.8.3' 18 | s.dependency 'Starscream', '~> 3.0.5' 19 | end 20 | -------------------------------------------------------------------------------- /SwiftFlyer/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rinov/SwiftFlyer/9d5cb4993a44c4588870ed7f1ce4c11a9c2f6d02/SwiftFlyer/Assets/.gitkeep -------------------------------------------------------------------------------- /SwiftFlyer/BitFlyer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BitFlyer.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class BitFlyer { 12 | 13 | public enum Const { 14 | public static let maximumPrivateApiCallPerMinute = 200 15 | public static let maximumApiCallPerIP = 500 16 | } 17 | 18 | public static var apiKey = "" 19 | public static var apiSecretKey = "" 20 | } 21 | -------------------------------------------------------------------------------- /SwiftFlyer/Extensions/DictionaryExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DictionaryExtensions.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Dictionary where Key == String, Value == Any { 12 | mutating func appendingQueryParameter(key: String, value: Any?) { 13 | if let value = value { 14 | self[key] = value 15 | } 16 | } 17 | 18 | mutating func appendingQueryParameter(key: String, value: T?) where T.RawValue == String { 19 | if let value = value { 20 | self[key] = value.rawValue 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /SwiftFlyer/HTTPMethod.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPMethod.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | public enum HTTPMethod: String { 10 | case post = "POST" 11 | case get = "GET" 12 | case put = "PUT" 13 | case patch = "PATCH" 14 | case delete = "DELETE" 15 | } 16 | 17 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Address.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Address.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct Address: Codable { 10 | public let type: String 11 | public let currencyCode: CurrencyCode 12 | public let address: String 13 | 14 | public enum CodingKeys: String, CodingKey { 15 | case type 16 | case currencyCode = "currency_code" 17 | case address 18 | } 19 | 20 | public init(type: String, currencyCode: CurrencyCode, address: String) { 21 | self.type = type 22 | self.currencyCode = currencyCode 23 | self.address = address 24 | } 25 | } 26 | 27 | extension Address: Equatable { 28 | public static func ==(lhs: Address, rhs: Address) -> Bool { 29 | return lhs.type == rhs.type 30 | && lhs.currencyCode == rhs.currencyCode 31 | && lhs.address == rhs.address 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Balance.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Balance.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Balance: Codable { 12 | public let amount: Double 13 | public let available: Double 14 | public let currencyCode: CurrencyCode 15 | 16 | public init(amount: Double, available: Double, currencyCode: CurrencyCode) { 17 | self.amount = amount 18 | self.available = available 19 | self.currencyCode = currencyCode 20 | } 21 | 22 | public enum CodingKeys: String, CodingKey { 23 | case amount 24 | case available 25 | case currencyCode = "currency_code" 26 | } 27 | } 28 | 29 | extension Balance: Equatable { 30 | public static func ==(lhs: Balance, rhs: Balance) -> Bool { 31 | return lhs.amount == rhs.amount 32 | && lhs.available == rhs.available 33 | && lhs.currencyCode == rhs.currencyCode 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/BankAccount.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BankAccount.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct BankAccount: Codable { 10 | public let id: Int 11 | public let isVerified: Bool 12 | public let bankName: String 13 | public let branchName: String 14 | public let accountType: String 15 | public let accountNumber: String 16 | public let accountName: String 17 | 18 | public init(id: Int, isVerified: Bool, bankName: String, branchName: String, accountType: String, accountNumber: String, accountName: String) { 19 | self.id = id 20 | self.isVerified = isVerified 21 | self.bankName = bankName 22 | self.branchName = branchName 23 | self.accountType = accountType 24 | self.accountNumber = accountNumber 25 | self.accountName = accountName 26 | } 27 | 28 | public enum CodingKeys: String, CodingKey { 29 | case id 30 | case isVerified = "is_verified" 31 | case bankName = "bank_name" 32 | case branchName = "branch_name" 33 | case accountType = "account_type" 34 | case accountNumber = "account_number" 35 | case accountName = "account_name" 36 | } 37 | } 38 | 39 | extension BankAccount: Equatable { 40 | public static func ==(lhs: BankAccount, rhs: BankAccount) -> Bool { 41 | return lhs.id == rhs.id 42 | && lhs.isVerified == rhs.isVerified 43 | && lhs.bankName == rhs.bankName 44 | && lhs.branchName == rhs.branchName 45 | && lhs.accountType == rhs.accountType 46 | && lhs.accountNumber == rhs.accountNumber 47 | && lhs.accountName == rhs.accountName 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Board.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Board.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Board: Codable { 12 | public let asks: [BoardOrder] 13 | public let bids: [BoardOrder] 14 | public let midPrice: Double 15 | 16 | public init(asks: [BoardOrder], bids: [BoardOrder], midPrice: Double) { 17 | self.asks = asks 18 | self.bids = bids 19 | self.midPrice = midPrice 20 | } 21 | 22 | public enum CodingKeys: String, CodingKey { 23 | case asks 24 | case bids 25 | case midPrice = "mid_price" 26 | } 27 | } 28 | 29 | extension Board: Equatable { 30 | public static func ==(lhs: Board, rhs: Board) -> Bool { 31 | return lhs.asks == rhs.asks 32 | && lhs.bids == rhs.bids 33 | && lhs.midPrice == rhs.midPrice 34 | } 35 | } 36 | 37 | public struct BoardOrder: Codable { 38 | public let price: Double 39 | public let size: Double 40 | 41 | public init(price: Double, size: Double) { 42 | self.price = price 43 | self.size = size 44 | } 45 | } 46 | 47 | extension BoardOrder: Equatable { 48 | public static func ==(lhs: BoardOrder, rhs: BoardOrder) -> Bool { 49 | return lhs.price == rhs.price 50 | && lhs.size == rhs.size 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/BoarderStatus.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BoardState.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct BoardState: Codable { 12 | public let healthState: HealthState 13 | public let tradeState: TradeState 14 | 15 | public init(healthState: HealthState, tradeState: TradeState) { 16 | self.healthState = healthState 17 | self.tradeState = tradeState 18 | } 19 | 20 | public enum CodingKeys: String, CodingKey { 21 | case healthState = "health" 22 | case tradeState = "state" 23 | } 24 | } 25 | 26 | extension BoardState: Equatable { 27 | public static func ==(lhs: BoardState, rhs: BoardState) -> Bool { 28 | return lhs.healthState == rhs.healthState 29 | && lhs.tradeState == rhs.tradeState 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Chat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Chat.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct Chat: Codable { 10 | public let nickname: String 11 | public let message: String 12 | public let date: String 13 | 14 | public init(nickname: String, message: String, date: String) { 15 | self.nickname = nickname 16 | self.message = message 17 | self.date = date 18 | } 19 | } 20 | 21 | extension Chat: Equatable { 22 | public static func ==(lhs: Chat, rhs: Chat) -> Bool { 23 | return lhs.nickname == rhs.nickname 24 | && lhs.message == rhs.message 25 | && lhs.date == rhs.date 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/ChildOrderResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChildOrderResult.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct ChildOrderResult: Codable { 12 | public let childOrderAcceptanceID: String 13 | 14 | public init(childOrderAcceptanceID: String) { 15 | self.childOrderAcceptanceID = childOrderAcceptanceID 16 | } 17 | 18 | public enum CodingKeys: String, CodingKey { 19 | case childOrderAcceptanceID = "child_order_acceptance_id" 20 | } 21 | } 22 | 23 | 24 | extension ChildOrderResult: Equatable { 25 | public static func ==(lhs: ChildOrderResult, rhs: ChildOrderResult) -> Bool { 26 | return lhs.childOrderAcceptanceID == rhs.childOrderAcceptanceID 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/ChildOrderType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChildOrderType.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum ChildOrderType: String { 12 | case limit = "LIMIT" 13 | case market = "MARKET" 14 | } 15 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/CoinHistory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoinHistory.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct CoinHistory: Codable { 10 | public let id: Int 11 | public let orderID: String 12 | public let currencyCode: CurrencyCode 13 | public let amount: Double 14 | public let address: String 15 | public let txHash: String 16 | public let status: CoinStatus 17 | public let eventDate: String 18 | 19 | public init(id: Int, orderID: String, currencyCode: CurrencyCode, amount: Double, address: String, txHash: String, status: CoinStatus, eventDate: String) { 20 | self.id = id 21 | self.orderID = orderID 22 | self.currencyCode = currencyCode 23 | self.amount = amount 24 | self.address = address 25 | self.txHash = txHash 26 | self.status = status 27 | self.eventDate = eventDate 28 | } 29 | 30 | public enum CodingKeys: String, CodingKey { 31 | case id 32 | case orderID = "order_id" 33 | case currencyCode = "currency_code" 34 | case amount 35 | case address 36 | case txHash = "tx_hash" 37 | case status 38 | case eventDate = "event_date" 39 | } 40 | } 41 | 42 | extension CoinHistory: Equatable { 43 | public static func ==(lhs: CoinHistory, rhs: CoinHistory) -> Bool { 44 | return lhs.id == rhs.id 45 | && lhs.orderID == rhs.orderID 46 | && lhs.currencyCode == rhs.currencyCode 47 | && lhs.amount == rhs.amount 48 | && lhs.address == rhs.address 49 | && lhs.txHash == rhs.txHash 50 | && lhs.status == rhs.status 51 | && lhs.eventDate == rhs.eventDate 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/CoinStatus.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoinStatus.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public enum CoinStatus: String, Codable { 10 | case pending = "PENDING" 11 | case completed = "COMPLETED" 12 | } 13 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Collateral.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Collateral.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Collateral: Codable { 12 | public let collateral: Double 13 | public let keepRate: Double 14 | public let openPositionPnl: Double 15 | public let requireCollateral: Double 16 | 17 | public init(collateral: Double, keepRate: Double, openPositionPnl: Double, requireCollateral: Double) { 18 | self.collateral = collateral 19 | self.keepRate = keepRate 20 | self.openPositionPnl = openPositionPnl 21 | self.requireCollateral = requireCollateral 22 | } 23 | 24 | public enum CodingKeys: String, CodingKey { 25 | case collateral 26 | case keepRate = "keep_rate" 27 | case openPositionPnl = "open_position_pnl" 28 | case requireCollateral = "require_collateral" 29 | } 30 | } 31 | 32 | extension Collateral: Equatable { 33 | public static func ==(lhs: Collateral, rhs: Collateral) -> Bool { 34 | return lhs.collateral == rhs.collateral 35 | && lhs.requireCollateral == rhs.requireCollateral 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/CollateralHistory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollateralHistory.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct CollateralHistory: Codable { 12 | public let amount: Double 13 | public let change: Double 14 | public let currencyCode: String 15 | public let date: String 16 | public let id: Int 17 | public let reasonCode: String 18 | 19 | public init(amount: Double, change: Double, currencyCode: String, date: String, id: Int, reasonCode: String) { 20 | self.amount = amount 21 | self.change = change 22 | self.currencyCode = currencyCode 23 | self.date = date 24 | self.id = id 25 | self.reasonCode = reasonCode 26 | } 27 | 28 | public enum CodingKeys: String, CodingKey { 29 | case amount 30 | case change 31 | case currencyCode = "currency_code" 32 | case date 33 | case id 34 | case reasonCode = "reason_code" 35 | } 36 | } 37 | 38 | extension CollateralHistory: Equatable { 39 | public static func ==(lhs: CollateralHistory, rhs: CollateralHistory) -> Bool { 40 | return lhs.amount == rhs.amount 41 | && lhs.change == rhs.change 42 | && lhs.currencyCode == rhs.currencyCode 43 | && lhs.date == rhs.date 44 | && lhs.id == rhs.id 45 | && lhs.reasonCode == rhs.reasonCode 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/ConditionType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConditionType.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum ConditionType: String { 12 | case limit = "LIMIT" 13 | case market = "MARKET" 14 | case stop = "STOP" 15 | case stopLimit = "STOP_LIMIT" 16 | case trail = "TRAIL" 17 | } 18 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Contract.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Contract.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Contract: Decodable { 12 | public let childOrderAcceptanceId: String 13 | public let childOrderId: String 14 | public let commission: Int 15 | public let execDate: String 16 | public let id: Int 17 | public let price: Int 18 | public let side: PositionSide 19 | public let size: Double 20 | 21 | public init(childOrderAcceptanceId: String, childOrderId: String, commission: Int, execDate: String, id: Int, price: Int, side: PositionSide, size: Double) { 22 | self.childOrderAcceptanceId = childOrderAcceptanceId 23 | self.childOrderId = childOrderId 24 | self.commission = commission 25 | self.execDate = execDate 26 | self.id = id 27 | self.price = price 28 | self.side = side 29 | self.size = size 30 | } 31 | 32 | public enum CodingKeys: String, CodingKey { 33 | case childOrderAcceptanceId = "child_order_acceptance_id" 34 | case childOrderId = "child_order_id" 35 | case commission 36 | case execDate = "exec_date" 37 | case id 38 | case price 39 | case side 40 | case size 41 | } 42 | } 43 | 44 | extension Contract: Equatable { 45 | public static func ==(lhs: Contract, rhs: Contract) -> Bool { 46 | return lhs.childOrderAcceptanceId == rhs.childOrderAcceptanceId 47 | && lhs.childOrderId == rhs.childOrderId 48 | && lhs.commission == rhs.commission 49 | && lhs.execDate == rhs.execDate 50 | && lhs.id == rhs.id 51 | && lhs.price == rhs.price 52 | && lhs.side == rhs.side 53 | && lhs.size == rhs.size 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/CurrencyCode.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CurrencyCode.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum CurrencyCode: String, Codable { 12 | case jpy = "JPY" 13 | case btc = "BTC" 14 | case eth = "ETH" 15 | case etc = "ETC" 16 | case bch = "BCH" 17 | case ltc = "LTC" 18 | case mona = "MONA" 19 | case unknown 20 | 21 | public init?(rawValue: String) { 22 | switch rawValue { 23 | case "JPY": 24 | self = .jpy 25 | case "BTC": 26 | self = .btc 27 | case "ETH": 28 | self = .eth 29 | case "ETC": 30 | self = .etc 31 | case "BCH": 32 | self = .bch 33 | case "LTC": 34 | self = .ltc 35 | case "MONA": 36 | self = .mona 37 | default: 38 | self = .unknown 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/DepositHistory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DepositHistory.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct DepositHistory: Codable { 10 | public let id: Int 11 | public let orderID: String 12 | public let currencyCode: CurrencyCode 13 | public let amount: Double 14 | public let status: CoinStatus 15 | public let eventDate: String 16 | 17 | public init(id: Int, orderID: String, currencyCode: CurrencyCode, amount: Double, status: CoinStatus, eventDate: String) { 18 | self.id = id 19 | self.orderID = orderID 20 | self.currencyCode = currencyCode 21 | self.amount = amount 22 | self.status = status 23 | self.eventDate = eventDate 24 | } 25 | 26 | public enum CodingKeys: String, CodingKey { 27 | case id 28 | case orderID = "order_id" 29 | case currencyCode = "currency_code" 30 | case amount 31 | case status 32 | case eventDate = "event_date" 33 | } 34 | } 35 | 36 | extension DepositHistory: Equatable { 37 | public static func ==(lhs: DepositHistory, rhs: DepositHistory) -> Bool { 38 | return lhs.id == rhs.id 39 | && lhs.orderID == rhs.orderID 40 | && lhs.currencyCode == rhs.currencyCode 41 | && lhs.amount == rhs.amount 42 | && lhs.status == rhs.status 43 | && lhs.eventDate == rhs.eventDate 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Executions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Executions.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Execution: Codable { 12 | public let id: Int 13 | public let side: PositionSide 14 | public let price: Double 15 | public let size: Double 16 | public let execDate: String 17 | public let buyChildOrderAcceptanceID: String 18 | public let sellChildOrderAcceptanceID: String 19 | 20 | public init(id: Int, side: PositionSide, price: Double, size: Double, execDate: String, buyChildOrderAcceptanceID: String, sellChildOrderAcceptanceID: String) { 21 | self.id = id 22 | self.side = side 23 | self.price = price 24 | self.size = size 25 | self.execDate = execDate 26 | self.buyChildOrderAcceptanceID = buyChildOrderAcceptanceID 27 | self.sellChildOrderAcceptanceID = sellChildOrderAcceptanceID 28 | } 29 | 30 | public enum CodingKeys: String, CodingKey { 31 | case id 32 | case side 33 | case price 34 | case size 35 | case execDate = "exec_date" 36 | case buyChildOrderAcceptanceID = "buy_child_order_acceptance_id" 37 | case sellChildOrderAcceptanceID = "sell_child_order_acceptance_id" 38 | } 39 | } 40 | 41 | extension Execution: Equatable { 42 | public static func ==(lhs: Execution, rhs: Execution) -> Bool { 43 | return lhs.id == rhs.id 44 | && lhs.side == rhs.side 45 | && lhs.price == rhs.price 46 | && lhs.size == rhs.size 47 | && lhs.execDate == rhs.execDate 48 | && lhs.buyChildOrderAcceptanceID == rhs.buyChildOrderAcceptanceID 49 | && lhs.sellChildOrderAcceptanceID == rhs.sellChildOrderAcceptanceID 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/HealthState.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HealthState.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public enum HealthState: String, Codable { 10 | case normal = "NORMAL" 11 | case busy = "BUSY" 12 | case veryBusy = "VERY BUSY" 13 | case superBusy = "SUPER BUSY" 14 | } 15 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Market.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BFMarket.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct Market: Codable { 10 | public let productCode: ProductCode 11 | public let alias: String? 12 | 13 | public init(productCode: ProductCode, alias: String?) { 14 | self.productCode = productCode 15 | self.alias = alias 16 | } 17 | 18 | public enum CodingKeys: String, CodingKey { 19 | case productCode = "product_code" 20 | case alias 21 | } 22 | } 23 | 24 | extension Market: Equatable { 25 | public static func ==(lhs: Market, rhs: Market) -> Bool { 26 | return lhs.productCode == rhs.productCode 27 | && lhs.alias == rhs.alias 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/MessageID.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageID.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct MessageID: Codable { 10 | public let id: String 11 | 12 | public init(id: String) { 13 | self.id = id 14 | } 15 | 16 | public enum CodingKeys: String, CodingKey { 17 | case id = "message_id" 18 | } 19 | } 20 | 21 | extension MessageID: Equatable { 22 | public static func ==(lhs: MessageID, rhs: MessageID) -> Bool { 23 | return lhs.id == rhs.id 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/OnlyStatusCodeResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OnlyStatusCodeResponse.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct OnlyStatusCodeResponse: Codable { 12 | public let statusCode: Int 13 | public let isSuccess: Bool 14 | 15 | public init(statusCode: Int, isSuccess: Bool) { 16 | self.statusCode = statusCode 17 | self.isSuccess = isSuccess 18 | } 19 | 20 | public enum CodingKeys: String, CodingKey { 21 | case statusCode 22 | case isSuccess 23 | } 24 | } 25 | 26 | extension OnlyStatusCodeResponse: Equatable { 27 | public static func ==(lhs: OnlyStatusCodeResponse, rhs: OnlyStatusCodeResponse) -> Bool { 28 | return lhs.statusCode == rhs.statusCode 29 | && lhs.isSuccess == rhs.isSuccess 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Order.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Order.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Order { 12 | public let productCode: ProductCode 13 | public let conditionType: ConditionType 14 | public let side: PositionSide 15 | public let price: Double? 16 | public let triggerPrice: Double? 17 | public let size: Double 18 | public let offset: Int? 19 | public let timeInForce: TimeInForce? 20 | 21 | public init(productCode: ProductCode, conditionType: ConditionType, side: PositionSide, price: Double?, triggerPrice: Double?, size: Double, offset: Int?, timeInForce: TimeInForce?) { 22 | self.productCode = productCode 23 | self.conditionType = conditionType 24 | self.side = side 25 | self.price = price 26 | self.triggerPrice = triggerPrice 27 | self.size = size 28 | self.offset = offset 29 | self.timeInForce = timeInForce 30 | } 31 | } 32 | 33 | extension Order: Equatable { 34 | public static func ==(lhs: Order, rhs: Order) -> Bool { 35 | return lhs.productCode == rhs.productCode 36 | && lhs.conditionType == rhs.conditionType 37 | && lhs.side == rhs.side 38 | && lhs.price == rhs.price 39 | && lhs.triggerPrice == rhs.triggerPrice 40 | && lhs.size == rhs.size 41 | && lhs.offset == rhs.offset 42 | && lhs.timeInForce == rhs.timeInForce 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/OrderState.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChildOrderState.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum OrderState: String, Decodable { 12 | case active = "ACTIVE" 13 | case completed = "COMPLETED" 14 | case canceled = "CANCELED" 15 | case expired = "EXPIRED" 16 | case rejected = "REJECTED" 17 | } 18 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/ParentOrderResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ParentOrderResult.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct ParentOrderResult: Codable { 12 | public let parentOrderAcceptanceID: String 13 | 14 | public init(parentOrderAcceptanceID: String) { 15 | self.parentOrderAcceptanceID = parentOrderAcceptanceID 16 | } 17 | 18 | public enum CodingKeys: String, CodingKey { 19 | case parentOrderAcceptanceID = "parent_order_acceptance_id" 20 | } 21 | } 22 | 23 | extension ParentOrderResult: Equatable { 24 | public static func ==(lhs: ParentOrderResult, rhs: ParentOrderResult) -> Bool { 25 | return lhs.parentOrderAcceptanceID == rhs.parentOrderAcceptanceID 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/ParentOrderType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ParentOrderType.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum ParentOrderType: String { 12 | case simple = "SIMPLE" 13 | case ifd = "IFD" 14 | case oco = "OCO" 15 | case ifdoco = "IFDOCO" 16 | } 17 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/Permission.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Permission.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct Permission: Codable { 10 | public let scopes: [String] 11 | 12 | public init(scopes: [String]) { 13 | self.scopes = scopes 14 | } 15 | 16 | public init(from decoder: Decoder) throws { 17 | var container = try decoder.unkeyedContainer() 18 | var result: [String] = [] 19 | while !container.isAtEnd { 20 | guard let permission = try? container.decode(String.self) else { continue } 21 | result.append(permission) 22 | } 23 | scopes = result 24 | } 25 | } 26 | 27 | extension Permission: Equatable { 28 | public static func ==(lhs: Permission, rhs: Permission) -> Bool { 29 | return lhs.scopes == rhs.scopes 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/PositionSide.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PositionSide.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum PositionSide: String, Codable { 12 | case buy = "BUY" 13 | case sell = "SELL" 14 | case buysell = "BUYSELL" // Used only parent order like as IFDOCO 15 | case sellbuy = "SELLBUY" // Used only parent order like as IFDOCO 16 | case noPosition 17 | } 18 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/ProductCode.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProductCode.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum ProductCode: String, Codable { 12 | case btc_jpy = "BTC_JPY" 13 | case eth_btc = "ETH_BTC" 14 | case bch_btc = "BCH_BTC" 15 | case fx_btc_jpy = "FX_BTC_JPY" 16 | case btc_jpy_12_jan_2018 = "BTCJPY12JAN2018" 17 | case btc_jpy_19_jan_2018 = "BTCJPY19JAN2018" 18 | case unknown 19 | 20 | public init?(rawValue: String) { 21 | switch rawValue { 22 | case ProductCode.btc_jpy.rawValue: 23 | self = .btc_jpy 24 | case ProductCode.eth_btc.rawValue: 25 | self = .eth_btc 26 | case ProductCode.bch_btc.rawValue: 27 | self = .bch_btc 28 | case ProductCode.fx_btc_jpy.rawValue: 29 | self = .fx_btc_jpy 30 | case ProductCode.btc_jpy_12_jan_2018.rawValue: 31 | self = .btc_jpy_12_jan_2018 32 | case ProductCode.btc_jpy_19_jan_2018.rawValue: 33 | self = .btc_jpy_19_jan_2018 34 | default: 35 | self = .unknown 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/TimeInForce.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TimeInForce.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum TimeInForce: String { 12 | case gtc = "GTC" 13 | case ioc = "IOC" 14 | case fok = "FOK" 15 | } 16 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/TradeHealth.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TradeHealth.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/02/04. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct TradeHealth: Codable { 11 | 12 | public let healthState: HealthState 13 | 14 | public enum CodingKeys: String, CodingKey { 15 | case healthState = "status" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/TradeState.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TradeState.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public enum TradeState: String, Codable { 10 | case running = "RUNNING" 11 | case closed = "CLOSED" 12 | case starting = "STARTING" 13 | case preopen = "PREOPEN" 14 | case circuitBreak = "CIRCUIT BREAK" 15 | case awaitingSQ = "AWATING SQ" 16 | case matured = "MATURED" 17 | } 18 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/TradingCommission.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TradingCommission.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct TraidingCommission: Codable { 12 | public let commissionRate: Double 13 | 14 | public init(commissionRate: Double) { 15 | self.commissionRate = commissionRate 16 | } 17 | 18 | public enum CodingKeys: String, CodingKey { 19 | case commissionRate = "commission_rate" 20 | } 21 | } 22 | 23 | extension TraidingCommission: Equatable { 24 | public static func ==(lhs: TraidingCommission, rhs: TraidingCommission) -> Bool { 25 | return lhs.commissionRate == rhs.commissionRate 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SwiftFlyer/Models/WithdrawHistory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WithdrawHistory.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct WithdrawHistory: Codable { 10 | public let id: Int 11 | public let orderID: String 12 | public let currencyCode: CurrencyCode 13 | public let amount: Double 14 | public let status: CoinStatus 15 | public let eventDate: String 16 | 17 | public init(id: Int, orderID: String, currencyCode: CurrencyCode, amount: Double, status: CoinStatus, eventDate: String) { 18 | self.id = id 19 | self.orderID = orderID 20 | self.currencyCode = currencyCode 21 | self.amount = amount 22 | self.status = status 23 | self.eventDate = eventDate 24 | } 25 | 26 | public enum CodingKeys: String, CodingKey { 27 | case id 28 | case orderID = "order_id" 29 | case currencyCode = "currency_code" 30 | case amount 31 | case status 32 | case eventDate = "event_date" 33 | } 34 | } 35 | 36 | extension WithdrawHistory: Equatable { 37 | public static func ==(lhs: WithdrawHistory, rhs: WithdrawHistory) -> Bool { 38 | return lhs.id == rhs.id 39 | && lhs.orderID == rhs.orderID 40 | && lhs.currencyCode == rhs.currencyCode 41 | && lhs.amount == rhs.amount 42 | && lhs.status == rhs.status 43 | && lhs.eventDate == rhs.eventDate 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SwiftFlyer/RealTimeAPIDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealTimeAPIDelegate.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // 7 | 8 | public protocol RealTimeAPIDelegate: class { 9 | func didReceiveSnapShot(_ snapshot: Board) 10 | func didReceiveBoardDiff(_ board: Board) 11 | func didReceiveTicker(_ ticker: Ticker) 12 | func didReceiveExecution(_ executions: [Execution]) 13 | func onConnect() 14 | func onDisconnect(_ error: Error?) 15 | } 16 | -------------------------------------------------------------------------------- /SwiftFlyer/Requestable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Requestable.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Requestable { 12 | 13 | // The response of `Requestable` expects either JSON object or empty. 14 | associatedtype Response: Decodable 15 | 16 | // The base of URL. 17 | var baseURL: URL { get } 18 | 19 | // The path of URL. 20 | var path: String { get } 21 | 22 | // The header field of HTTP. 23 | var headerField: [String: String] { get } 24 | 25 | // If the request needs OAuth authorization, this will set `true`. The default value is `false`. 26 | var isAuthorizedRequest: Bool { get } 27 | 28 | // The http method. e.g. `.get` 29 | var httpMethod: HTTPMethod { get } 30 | 31 | // The http body parameter, The default value is `nil`. 32 | var httpBody: Data? { get } 33 | 34 | // Additional query paramters for URL, The default value is `[:]`. 35 | var queryParameters: [String: Any] { get } 36 | 37 | // If the response is empty, this should be true. 38 | var isNoContent: Bool { get } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetAddressRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetAddressRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetAddressRequest: Requestable { 10 | 11 | public typealias Response = [Address] 12 | 13 | public var path: String { 14 | return "/v1/me/getaddresses" 15 | } 16 | 17 | public var isAuthorizedRequest: Bool { 18 | return true 19 | } 20 | 21 | public var httpMethod: HTTPMethod { 22 | return .get 23 | } 24 | 25 | public init() {} 26 | } 27 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetBalanceRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetBalanceRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetBalanceRequest: Requestable { 12 | 13 | public typealias Response = [Balance] 14 | 15 | public var path: String { 16 | return "/v1/me/getbalance" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public init() {} 28 | } 29 | 30 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetBankAccountsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetBankAccountsRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetBankAccountsRequest: Requestable { 10 | 11 | public typealias Response = [BankAccount] 12 | 13 | public var path: String { 14 | return "/v1/me/getbankaccounts" 15 | } 16 | 17 | public var isAuthorizedRequest: Bool { 18 | return true 19 | } 20 | 21 | public var httpMethod: HTTPMethod { 22 | return .get 23 | } 24 | 25 | public init() {} 26 | } 27 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetBoardRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetBoardRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetBoardRequest: Requestable { 10 | 11 | public typealias Response = Board 12 | 13 | public var path: String { 14 | return "/v1/getboard" 15 | } 16 | 17 | public var httpMethod: HTTPMethod { 18 | return .get 19 | } 20 | 21 | public var queryParameters: [String : Any] { 22 | var q: [String: Any] = [:] 23 | q.appendingQueryParameter(key: "product_code", value: productCode) 24 | return q 25 | } 26 | 27 | public let productCode: ProductCode 28 | 29 | public init(productCode: ProductCode) { 30 | self.productCode = productCode 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetBoarderStatusRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetStatusRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetBoarderStatusRequest: Requestable { 12 | 13 | public typealias Response = BoardState 14 | 15 | public var path: String { 16 | return "/v1/getboardstate" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var queryParameters: [String : Any] { 24 | var q: [String: Any] = [:] 25 | q.appendingQueryParameter(key: "product_code", value: productCode) 26 | return q 27 | } 28 | 29 | public let productCode: ProductCode 30 | 31 | public init(productCode: ProductCode) { 32 | self.productCode = productCode 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetChatsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetChatsRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetChatsRequest: Requestable { 10 | 11 | public typealias Response = [Chat] 12 | 13 | public var path: String { 14 | return "/v1/getchats" 15 | } 16 | 17 | public var httpMethod: HTTPMethod { 18 | return .get 19 | } 20 | 21 | public var queryParameters: [String : Any] { 22 | var q: [String: Any] = [:] 23 | q.appendingQueryParameter(key: "from_date", value: fromDate) 24 | return q 25 | } 26 | 27 | /// e.g. 2018-01-7T05:58:08.833 28 | public let fromDate: String? 29 | 30 | public init(fromDate: String? = nil) { 31 | self.fromDate = fromDate 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetCollateralHistoriesRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetCollateralHistoriesRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetCollateralHistoriesRequest: Requestable { 12 | 13 | public typealias Response = [CollateralHistory] 14 | 15 | public var path: String { 16 | return "/v1/me/getcollateralhistory" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var queryParameters: [String : Any] { 28 | var q: [String: Any] = [:] 29 | q.appendingQueryParameter(key: "count", value: count) 30 | q.appendingQueryParameter(key: "before", value: before) 31 | q.appendingQueryParameter(key: "after", value: after) 32 | 33 | return q 34 | } 35 | 36 | public let count: Int? // The default value is 100. 37 | public let before: String? 38 | public let after: String? 39 | 40 | public init(count: Int? = nil, 41 | before: String? = nil, 42 | after: String? = nil) { 43 | 44 | self.count = count 45 | self.before = before 46 | self.after = after 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetCollateralRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetCollateralRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetCollateralRequest: Requestable { 12 | 13 | public typealias Response = Collateral 14 | 15 | public var path: String { 16 | return "/v1/me/getcollateral" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public init() {} 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetContractsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetExecutionsRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetContractsRequest: Requestable { 12 | 13 | public typealias Response = [Contract] 14 | 15 | public var path: String { 16 | return "/v1/me/getexecutions" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var queryParameters: [String : Any] { 28 | var q: [String: Any] = [:] 29 | q.appendingQueryParameter(key: "count", value: count) 30 | q.appendingQueryParameter(key: "before", value: before) 31 | q.appendingQueryParameter(key: "after", value: after) 32 | q.appendingQueryParameter(key: "product_code", value: productCode) 33 | q.appendingQueryParameter(key: "child_order_id", value: childOrderID) 34 | q.appendingQueryParameter(key: "child_order_acceptance_id", value: childOrderAcceptanceID) 35 | 36 | return q 37 | } 38 | 39 | public let productCode: ProductCode 40 | public let count: Int? // The default value is 100. 41 | public let before: String? 42 | public let after: String? 43 | public let childOrderID: String? 44 | public let childOrderAcceptanceID: String? 45 | 46 | public init(productCode: ProductCode, 47 | count: Int? = nil, 48 | before: String? = nil, 49 | after: String? = nil, 50 | childOrderID: String? = nil, 51 | childOrderAcceptanceID: String? = nil) { 52 | 53 | self.productCode = productCode 54 | self.count = count 55 | self.before = before 56 | self.after = after 57 | self.childOrderID = childOrderID 58 | self.childOrderAcceptanceID = childOrderAcceptanceID 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetDepositCoinHistoriesRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetDepositCoinHistories.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetDepositCoinHistoriesRequest: Requestable { 10 | 11 | public typealias Response = [Address] 12 | 13 | public var path: String { 14 | return "/v1/me/getcoinins" 15 | } 16 | 17 | public var isAuthorizedRequest: Bool { 18 | return true 19 | } 20 | 21 | public var httpMethod: HTTPMethod { 22 | return .get 23 | } 24 | 25 | public var queryParameters: [String : Any] { 26 | var q: [String: Any] = [:] 27 | q.appendingQueryParameter(key: "count", value: count) 28 | q.appendingQueryParameter(key: "before", value: before) 29 | q.appendingQueryParameter(key: "after", value: after) 30 | return q 31 | } 32 | 33 | public let count: Int? 34 | public let before: String? 35 | public let after: String? 36 | 37 | public init(count: Int? = nil, 38 | before: String? = nil, 39 | after: String? = nil) { 40 | self.count = count 41 | self.before = before 42 | self.after = after 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetDepositsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetDepositsRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetDepositsRequest: Requestable { 10 | 11 | public typealias Response = [DepositHistory] 12 | 13 | public var path: String { 14 | return "/v1/me/getdeposits" 15 | } 16 | 17 | public var isAuthorizedRequest: Bool { 18 | return true 19 | } 20 | 21 | public var httpMethod: HTTPMethod { 22 | return .get 23 | } 24 | 25 | public var queryParameters: [String : Any] { 26 | var q: [String: Any] = [:] 27 | q.appendingQueryParameter(key: "count", value: count) 28 | q.appendingQueryParameter(key: "before", value: before) 29 | q.appendingQueryParameter(key: "after", value: after) 30 | return q 31 | } 32 | 33 | public let count: Int? 34 | public let before: String? 35 | public let after: String? 36 | 37 | public init(count: Int? = nil, 38 | before: String? = nil, 39 | after: String? = nil) { 40 | self.count = count 41 | self.before = before 42 | self.after = after 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetExecutionsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetExecutionsRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetExecutionsRequest: Requestable { 10 | 11 | public typealias Response = [Execution] 12 | 13 | public var path: String { 14 | return "/v1/getexecutions" 15 | } 16 | 17 | public var httpMethod: HTTPMethod { 18 | return .get 19 | } 20 | 21 | public var queryParameters: [String : Any] { 22 | var q: [String: Any] = [:] 23 | q.appendingQueryParameter(key: "product_code", value: productCode) 24 | q.appendingQueryParameter(key: "count", value: count) 25 | q.appendingQueryParameter(key: "before", value: before) 26 | q.appendingQueryParameter(key: "after", value: after) 27 | return q 28 | } 29 | 30 | public let productCode: ProductCode 31 | public let count: Int? 32 | public let before: Int? 33 | public let after: Int? 34 | 35 | public init(productCode: ProductCode, 36 | count: Int? = nil, 37 | before: Int? = nil, 38 | after: Int? = nil) { 39 | self.productCode = productCode 40 | self.count = count 41 | self.before = before 42 | self.after = after 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetHelthStateRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetHelthStateRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/02/04. 6 | // 7 | 8 | import Foundation 9 | 10 | public final class GetHealthStateRequest: Requestable { 11 | 12 | public typealias Response = TradeHealth 13 | 14 | public var path: String { 15 | return "/v1/gethealth" 16 | } 17 | 18 | public var httpMethod: HTTPMethod { 19 | return .get 20 | } 21 | 22 | public init() {} 23 | } 24 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetMarketListRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetMarketListRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetMarketListRequest: Requestable { 10 | 11 | public typealias Response = [Market] 12 | 13 | public var path: String { 14 | return "/v1/getmarkets" 15 | } 16 | 17 | public var httpMethod: HTTPMethod { 18 | return .get 19 | } 20 | 21 | public init() {} 22 | } 23 | 24 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetParentOrderDetailRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetParentOrderRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetParentOrderDetailRequest: Requestable { 12 | 13 | public typealias Response = [ChildOrder] 14 | 15 | public var path: String { 16 | return "/v1/me/getparentorder" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var queryParameters: [String : Any] { 28 | var q: [String: Any] = [:] 29 | q.appendingQueryParameter(key: "count", value: count) 30 | q.appendingQueryParameter(key: "before", value: before) 31 | q.appendingQueryParameter(key: "after", value: after) 32 | q.appendingQueryParameter(key: "product_code", value: productCode) 33 | q.appendingQueryParameter(key: "parent_order_state", value: parentOrderState) 34 | 35 | return q 36 | } 37 | 38 | public let productCode: ProductCode 39 | public let count: Int? // The default value is 100. 40 | public let before: String? 41 | public let after: String? 42 | public let parentOrderState: OrderState? 43 | 44 | public init(productCode: ProductCode, 45 | count: Int? = nil, 46 | before: String? = nil, 47 | after: String? = nil, 48 | parentOrderState: OrderState? = nil) { 49 | 50 | self.productCode = productCode 51 | self.count = count 52 | self.before = before 53 | self.after = after 54 | self.parentOrderState = parentOrderState 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetParentOrdersRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetParentOrdersRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetParentOrdersRequest: Requestable { 12 | 13 | public typealias Response = [ParentOrder] 14 | 15 | public var path: String { 16 | return "/v1/me/getparentorders" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var queryParameters: [String : Any] { 28 | var q: [String: Any] = [:] 29 | q.appendingQueryParameter(key: "count", value: count) 30 | q.appendingQueryParameter(key: "before", value: before) 31 | q.appendingQueryParameter(key: "after", value: after) 32 | q.appendingQueryParameter(key: "product_code", value: productCode) 33 | q.appendingQueryParameter(key: "parent_order_state", value: parentOrderState) 34 | 35 | return q 36 | } 37 | 38 | public let productCode: ProductCode 39 | public let count: Int? // The default value is 100. 40 | public let before: String? 41 | public let after: String? 42 | public let parentOrderState: OrderState? 43 | 44 | public init(productCode: ProductCode, 45 | count: Int? = nil, 46 | before: String? = nil, 47 | after: String? = nil, 48 | parentOrderState: OrderState? = nil) { 49 | 50 | self.productCode = productCode 51 | self.count = count 52 | self.before = before 53 | self.after = after 54 | self.parentOrderState = parentOrderState 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetPermissionsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetPermissionsRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetPermissionsRequest: Requestable { 10 | 11 | public typealias Response = Permission 12 | 13 | public var path: String { 14 | return "/v1/me/getpermissions" 15 | } 16 | 17 | public var httpMethod: HTTPMethod { 18 | return .get 19 | } 20 | 21 | public var isAuthorizedRequest: Bool { 22 | return true 23 | } 24 | 25 | public init() {} 26 | } 27 | 28 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetPositionsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetPositionsRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetPositionsRequest: Requestable { 12 | 13 | public typealias Response = [Position] 14 | 15 | public var path: String { 16 | return "/v1/me/getpositions" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | public var queryParameters: [String : Any] { 27 | var q: [String: Any] = [:] 28 | q.appendingQueryParameter(key: "product_code", value: productCode) 29 | return q 30 | } 31 | 32 | public let productCode: ProductCode 33 | 34 | public init(productCode: ProductCode) { 35 | 36 | self.productCode = productCode 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetTickerRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetTickerRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetTickerRequest: Requestable { 10 | 11 | public typealias Response = Ticker 12 | 13 | public var path: String { 14 | return "/v1/getticker" 15 | } 16 | 17 | public var httpMethod: HTTPMethod { 18 | return .get 19 | } 20 | 21 | public var queryParameters: [String : Any] { 22 | var q: [String: Any] = [:] 23 | q.appendingQueryParameter(key: "product_code", value: productCode) 24 | return q 25 | } 26 | 27 | public let productCode: ProductCode 28 | 29 | public init(productCode: ProductCode) { 30 | self.productCode = productCode 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetTraidingCommissionRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetTraidingCommissionRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class GetTraidingCommissionRequest: Requestable { 12 | 13 | public typealias Response = TraidingCommission 14 | 15 | public var path: String { 16 | return "/v1/me/gettradingcommission" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .get 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var queryParameters: [String : Any] { 28 | var q: [String: Any] = [:] 29 | q.appendingQueryParameter(key: "product_code", value: productCode) 30 | return q 31 | } 32 | 33 | public let productCode: ProductCode 34 | 35 | public init(productCode: ProductCode) { 36 | self.productCode = productCode 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetTransferCoinHistoriesRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetTransferCoinHistoriesRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetTransferCoinHistoriesRequest: Requestable { 10 | 11 | public typealias Response = [Address] 12 | 13 | public var path: String { 14 | return "/v1/me/getcoinouts" 15 | } 16 | 17 | public var isAuthorizedRequest: Bool { 18 | return true 19 | } 20 | 21 | public var httpMethod: HTTPMethod { 22 | return .get 23 | } 24 | 25 | public var queryParameters: [String : Any] { 26 | var q: [String: Any] = [:] 27 | q.appendingQueryParameter(key: "count", value: count) 28 | q.appendingQueryParameter(key: "before", value: before) 29 | q.appendingQueryParameter(key: "after", value: after) 30 | return q 31 | } 32 | 33 | public let count: Int? 34 | public let before: String? 35 | public let after: String? 36 | 37 | public init(count: Int? = nil, 38 | before: String? = nil, 39 | after: String? = nil) { 40 | self.count = count 41 | self.before = before 42 | self.after = after 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/GetWithdrawsRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetWithdrawsRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | public final class GetWithdrawsRequest: Requestable { 10 | 11 | public typealias Response = [WithdrawHistory] 12 | 13 | public var path: String { 14 | return "/v1/me/getwithdrawals" 15 | } 16 | 17 | public var isAuthorizedRequest: Bool { 18 | return true 19 | } 20 | 21 | public var httpMethod: HTTPMethod { 22 | return .get 23 | } 24 | 25 | public var queryParameters: [String : Any] { 26 | var q: [String: Any] = [:] 27 | q.appendingQueryParameter(key: "message_id", value: messageID) 28 | q.appendingQueryParameter(key: "count", value: count) 29 | q.appendingQueryParameter(key: "before", value: before) 30 | q.appendingQueryParameter(key: "after", value: after) 31 | return q 32 | } 33 | 34 | public let messageID: String? 35 | public let count: Int? 36 | public let before: String? 37 | public let after: String? 38 | 39 | public init(messageID: String? = nil, 40 | count: Int? = nil, 41 | before: String? = nil, 42 | after: String? = nil) { 43 | self.messageID = messageID 44 | self.count = count 45 | self.before = before 46 | self.after = after 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/PostCancelAllChildOrdersRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PostCancelAllChildOrdersRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class PostCancelAllOrdersRequest: Requestable { 12 | 13 | public typealias Response = OnlyStatusCodeResponse 14 | 15 | public var path: String { 16 | return "/v1/me/cancelallchildorders" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .post 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var isNoContent: Bool { 28 | return true 29 | } 30 | 31 | public var httpBody: Data? { 32 | var json: [String: Any] = [:] 33 | json.appendingQueryParameter(key: "product_code", value: productCode) 34 | let jsonData = try? JSONSerialization.data(withJSONObject: json, options: [.prettyPrinted]) 35 | return jsonData 36 | } 37 | 38 | public let productCode: ProductCode 39 | 40 | public init(productCode: ProductCode) { 41 | self.productCode = productCode 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/PostCancelChildOrderRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PostOrderCancelRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class PostCancelChildOrderRequest: Requestable { 12 | 13 | public typealias Response = OnlyStatusCodeResponse 14 | 15 | public var path: String { 16 | return "/v1/me/cancelchildorder" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .post 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var isNoContent: Bool { 28 | return true 29 | } 30 | 31 | public var httpBody: Data? { 32 | var json: [String: Any] = [:] 33 | 34 | json.appendingQueryParameter(key: "product_code", value: productCode) 35 | json.appendingQueryParameter(key: "child_order_id", value: childOrderID) 36 | json.appendingQueryParameter(key: "child_order_acceptance_id", value: childOrderAcceptanceID) 37 | 38 | let jsonData = try? JSONSerialization.data(withJSONObject: json, options: [.prettyPrinted]) 39 | 40 | return jsonData 41 | } 42 | 43 | public let productCode: ProductCode 44 | public let childOrderID: String? 45 | public let childOrderAcceptanceID: String? 46 | 47 | public init(productCode: ProductCode, 48 | childOrderID: String? = nil, 49 | childOrderAcceptanceID: String? = nil 50 | ) { 51 | self.productCode = productCode 52 | self.childOrderID = childOrderID 53 | self.childOrderAcceptanceID = childOrderAcceptanceID 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/PostCancelParentOrderRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PostCancelParentOrderRequest.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public final class PostCancelParentOrderRequest: Requestable { 12 | 13 | public typealias Response = OnlyStatusCodeResponse 14 | 15 | public var path: String { 16 | return "/v1/me/cancelparentorder" 17 | } 18 | 19 | public var httpMethod: HTTPMethod { 20 | return .post 21 | } 22 | 23 | public var isAuthorizedRequest: Bool { 24 | return true 25 | } 26 | 27 | public var isNoContent: Bool { 28 | return true 29 | } 30 | 31 | public var httpBody: Data? { 32 | var json: [String: Any] = [:] 33 | 34 | json.appendingQueryParameter(key: "product_code", value: productCode) 35 | json.appendingQueryParameter(key: "parent_order_id", value: parentOrderID) 36 | json.appendingQueryParameter(key: "parent_order_acceptance_id", value: parentOrderAcceptanceID) 37 | 38 | let jsonData = try? JSONSerialization.data(withJSONObject: json, options: [.prettyPrinted]) 39 | 40 | return jsonData 41 | } 42 | 43 | public let productCode: ProductCode 44 | public let parentOrderID: String? 45 | public let parentOrderAcceptanceID: String? 46 | 47 | public init(productCode: ProductCode, 48 | parentOrderID: String? = nil, 49 | parentOrderAcceptanceID: String? = nil 50 | ) { 51 | self.productCode = productCode 52 | self.parentOrderID = parentOrderID 53 | self.parentOrderAcceptanceID = parentOrderAcceptanceID 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SwiftFlyer/Requests/PostWithdrawRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PostWithdrawRequest.swift 3 | // SwiftFlyer 4 | // Created by Ryo Ishikawa on 2018/01/28. 5 | // 6 | 7 | import Foundation 8 | 9 | /// SeeAlso: - https://bitflyer.jp/commission?#DepositCancellation 10 | public final class PostWithdrawRequest: Requestable { 11 | 12 | public typealias Response = MessageID 13 | 14 | public var path: String { 15 | return "/v1/me/withdraw" 16 | } 17 | 18 | public var httpMethod: HTTPMethod { 19 | return .post 20 | } 21 | 22 | public var isAuthorizedRequest: Bool { 23 | return true 24 | } 25 | 26 | public var httpBody: Data? { 27 | var json: [String: Any] = [:] 28 | json.appendingQueryParameter(key: "currency_code", value: currencyCode) 29 | json.appendingQueryParameter(key: "bank_account_id", value: bankAccountID) 30 | json.appendingQueryParameter(key: "amount", value: amount) 31 | json.appendingQueryParameter(key: "code", value: code) 32 | let jsonData = try? JSONSerialization.data(withJSONObject: json, options: [.prettyPrinted]) 33 | return jsonData 34 | } 35 | 36 | public let currencyCode: CurrencyCode 37 | public let bankAccountID: Int 38 | public let amount: Int 39 | 40 | /// Two-factor authenticate code 41 | public let code: String 42 | 43 | public init(currencyCode: CurrencyCode, 44 | bankAccountID: Int, 45 | amount: Int, 46 | code: String) { 47 | self.currencyCode = currencyCode 48 | self.bankAccountID = bankAccountID 49 | self.amount = amount 50 | self.code = code 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /SwiftFlyer/ResponseError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseError.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum ResponseError: Error { 12 | case unacceptableStatusCode(Int) 13 | case unexpectedResponse(Any) 14 | } 15 | -------------------------------------------------------------------------------- /SwiftFlyer/Result.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Result.swift 3 | // SwiftFlyer 4 | // 5 | // Created by Ryo Ishikawa on 2018/01/28. 6 | // Copyright © 2017 Ryo Ishikawa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum Result { 12 | case success(T) 13 | case failed(E) 14 | 15 | var isSuccess: Bool { 16 | if case .success(_) = self { 17 | return true 18 | } 19 | return false 20 | } 21 | 22 | var isFailed: Bool { 23 | if case .failed(_) = self { 24 | return true 25 | } 26 | return false 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------