diff --git a/.ci/buildkite/pipeline.template.yml b/.ci/buildkite/pipeline.template.yml new file mode 100755 index 0000000..d9d701f --- /dev/null +++ b/.ci/buildkite/pipeline.template.yml @@ -0,0 +1,23 @@ +steps: + - + name: ":bundler: Update Bundler" + command: .ci/scripts/update-bundler + agents: + name: "$BUILDKITE_AGENT_META_DATA_NAME" + - + name: ":fastlane: Test Mac OS X" + command: .ci/scripts/test-osx + agents: + name: "$BUILDKITE_AGENT_META_DATA_NAME" + - + name: ":fastlane: Test iOS" + command: .ci/scripts/test-ios + agents: + name: "$BUILDKITE_AGENT_META_DATA_NAME" + - + type: "waiter" + - + name: ":codecov: Send Coverage" + command: .ci/scripts/send-coverage + agents: + name: "$BUILDKITE_AGENT_META_DATA_NAME" diff --git a/.ci/buildkite/upload b/.ci/buildkite/upload new file mode 100755 index 0000000..508329a --- /dev/null +++ b/.ci/buildkite/upload @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eu + +# Makes sure all the steps run on this same agent +sed "s/\$BUILDKITE_AGENT_META_DATA_NAME/$BUILDKITE_AGENT_META_DATA_NAME/" .ci/buildkite/pipeline.template.yml diff --git a/.ci/scripts/send-coverage b/.ci/scripts/send-coverage new file mode 100755 index 0000000..6369aab --- /dev/null +++ b/.ci/scripts/send-coverage @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +bash <(curl -s https://codecov.io/bash) -D .ci/xcodebuild-data \ No newline at end of file diff --git a/.ci/scripts/test-ios b/.ci/scripts/test-ios new file mode 100755 index 0000000..34615bc --- /dev/null +++ b/.ci/scripts/test-ios @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +source /usr/local/opt/chruby/share/chruby/chruby.sh +chruby ruby +bundle exec fastlane ios test + diff --git a/.ci/scripts/test-osx b/.ci/scripts/test-osx new file mode 100755 index 0000000..87b71a5 --- /dev/null +++ b/.ci/scripts/test-osx @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +source /usr/local/opt/chruby/share/chruby/chruby.sh +chruby ruby +bundle exec fastlane mac test diff --git a/.ci/scripts/update-bundler b/.ci/scripts/update-bundler new file mode 100755 index 0000000..748efd0 --- /dev/null +++ b/.ci/scripts/update-bundler @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +source /usr/local/opt/chruby/share/chruby/chruby.sh +chruby ruby +bundle update && bundle exec fastlane enable_crash_reporting diff --git a/.ci/xcodebuild-data/.gitkeep b/.ci/xcodebuild-data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.fastlane/Appfile b/.fastlane/Appfile new file mode 100644 index 0000000..5d26191 --- /dev/null +++ b/.fastlane/Appfile @@ -0,0 +1,2 @@ +app_identifier "me.danthorpe.Money" +apple_id "someone@somewhere.com" diff --git a/.fastlane/Fastfile b/.fastlane/Fastfile new file mode 100644 index 0000000..d1e9a83 --- /dev/null +++ b/.fastlane/Fastfile @@ -0,0 +1,28 @@ +before_all do |lane| + carthage(platform: "all") +end + +platform :ios do + + desc "Runs all the tests" + lane :test do + xctest scheme: 'Money-iOS', + sdk: 'iphonesimulator', + destination: 'platform=iOS Simulator,name=iPhone 6,OS=9.1', + destination_timeout: 120, + derivedDataPath: '.ci/xcodebuild-data' + end + +end + +platform :mac do + + desc "Runs all the tests" + lane :test do + xctest scheme: 'Money-OSX', + sdk: 'macosx', + destination: 'platform=OS X', + derivedDataPath: '.ci/xcodebuild-data' + end + +end diff --git a/.gitignore b/.gitignore index 8615121..0121b32 100644 --- a/.gitignore +++ b/.gitignore @@ -17,17 +17,12 @@ DerivedData *.ipa *.xcuserstate -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# -# Pods/ - # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts +Carthage/Checkouts Carthage/Build +.fastlane/report.xml +.ci/xcodebuild-data/* +*.coverage.txt diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2c33ee7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ + +# 1.0.0 +🎉🐝 Initial release of Money. + +- [x] DecimalNumberType with full support for mathematics operators +- [x] Strongly typed ISO currencies +- [x] Strongly typed ISO money type which conforms to DecimalNumberType +- [x] Generic Foreign Exchange APIs +- [x] Yahoo FX provider +- [x] OpenExchangeRates.org FX provider +- [x] 100% of code covered by tests diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..62b0ff2 --- /dev/null +++ b/Cartfile @@ -0,0 +1,4 @@ +github "danthorpe/ValueCoding" +github "antitypical/Result" >= 0.6 +github "SwiftyJSON/SwiftyJSON" +github "danthorpe/DVR" "DVR_27_restore_print_and_abort" diff --git a/Cartfile.resolved b/Cartfile.resolved new file mode 100644 index 0000000..064da12 --- /dev/null +++ b/Cartfile.resolved @@ -0,0 +1,4 @@ +github "danthorpe/DVR" "f0195d81d27a7d7633bd8c89ac7baa986fe8a21f" +github "antitypical/Result" "0.6.0-beta.6" +github "SwiftyJSON/SwiftyJSON" "2.3.1" +github "danthorpe/ValueCoding" "1.1.0" diff --git a/Examples/Custom Money/Custom Money.xcodeproj/project.pbxproj b/Examples/Custom Money/Custom Money.xcodeproj/project.pbxproj new file mode 100644 index 0000000..405fb66 --- /dev/null +++ b/Examples/Custom Money/Custom Money.xcodeproj/project.pbxproj @@ -0,0 +1,375 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 6557F4B31BEACBAB003CD2BF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4B21BEACBAB003CD2BF /* AppDelegate.swift */; }; + 6557F4B51BEACBAB003CD2BF /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4B41BEACBAB003CD2BF /* ViewController.swift */; }; + 6557F4B81BEACBAB003CD2BF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6557F4B61BEACBAB003CD2BF /* Main.storyboard */; }; + 6557F4BA1BEACBAB003CD2BF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6557F4B91BEACBAB003CD2BF /* Assets.xcassets */; }; + 6557F4BD1BEACBAB003CD2BF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6557F4BB1BEACBAB003CD2BF /* LaunchScreen.storyboard */; }; + 6557F4C51BEACCA2003CD2BF /* Currencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4C41BEACCA2003CD2BF /* Currencies.swift */; }; + CCAD2E0AC5B63470D9132683 /* Pods_Custom_Money.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B7C36A00E5A068833F1ABAC8 /* Pods_Custom_Money.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 27DD6DC0FB0700753D5A773C /* Pods-Custom Money.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Custom Money.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.debug.xcconfig"; sourceTree = ""; }; + 6557F4AF1BEACBAB003CD2BF /* Custom Money.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Custom Money.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6557F4B21BEACBAB003CD2BF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 6557F4B41BEACBAB003CD2BF /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 6557F4B71BEACBAB003CD2BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 6557F4B91BEACBAB003CD2BF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 6557F4BC1BEACBAB003CD2BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 6557F4BE1BEACBAB003CD2BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6557F4C41BEACCA2003CD2BF /* Currencies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Currencies.swift; sourceTree = ""; }; + B7C36A00E5A068833F1ABAC8 /* Pods_Custom_Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Custom_Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FD1CC1E65FBD4CF149DE88A7 /* Pods-Custom Money.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Custom Money.release.xcconfig"; path = "Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6557F4AC1BEACBAB003CD2BF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CCAD2E0AC5B63470D9132683 /* Pods_Custom_Money.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1772214E578AC43BA791BDDB /* Frameworks */ = { + isa = PBXGroup; + children = ( + B7C36A00E5A068833F1ABAC8 /* Pods_Custom_Money.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6557F4A61BEACBAB003CD2BF = { + isa = PBXGroup; + children = ( + 6557F4B11BEACBAB003CD2BF /* Custom Money */, + 6557F4B01BEACBAB003CD2BF /* Products */, + 9EB48F1098E882560DF9AFF6 /* Pods */, + 1772214E578AC43BA791BDDB /* Frameworks */, + ); + sourceTree = ""; + }; + 6557F4B01BEACBAB003CD2BF /* Products */ = { + isa = PBXGroup; + children = ( + 6557F4AF1BEACBAB003CD2BF /* Custom Money.app */, + ); + name = Products; + sourceTree = ""; + }; + 6557F4B11BEACBAB003CD2BF /* Custom Money */ = { + isa = PBXGroup; + children = ( + 6557F4BE1BEACBAB003CD2BF /* Info.plist */, + 6557F4B21BEACBAB003CD2BF /* AppDelegate.swift */, + 6557F4C41BEACCA2003CD2BF /* Currencies.swift */, + 6557F4B41BEACBAB003CD2BF /* ViewController.swift */, + 6557F4B91BEACBAB003CD2BF /* Assets.xcassets */, + 6557F4BB1BEACBAB003CD2BF /* LaunchScreen.storyboard */, + 6557F4B61BEACBAB003CD2BF /* Main.storyboard */, + ); + path = "Custom Money"; + sourceTree = ""; + }; + 9EB48F1098E882560DF9AFF6 /* Pods */ = { + isa = PBXGroup; + children = ( + 27DD6DC0FB0700753D5A773C /* Pods-Custom Money.debug.xcconfig */, + FD1CC1E65FBD4CF149DE88A7 /* Pods-Custom Money.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6557F4AE1BEACBAB003CD2BF /* Custom Money */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6557F4C11BEACBAB003CD2BF /* Build configuration list for PBXNativeTarget "Custom Money" */; + buildPhases = ( + A29DCC8CFC4FF9494BCBC9E4 /* Check Pods Manifest.lock */, + 6557F4AB1BEACBAB003CD2BF /* Sources */, + 6557F4AC1BEACBAB003CD2BF /* Frameworks */, + 6557F4AD1BEACBAB003CD2BF /* Resources */, + 832DC70C773DE13EEBE861E3 /* Embed Pods Frameworks */, + 141A924FCF80CDB9B7B98D7F /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Custom Money"; + productName = "Custom Money"; + productReference = 6557F4AF1BEACBAB003CD2BF /* Custom Money.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6557F4A71BEACBAB003CD2BF /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0710; + LastUpgradeCheck = 0710; + ORGANIZATIONNAME = "Daniel Thorpe"; + TargetAttributes = { + 6557F4AE1BEACBAB003CD2BF = { + CreatedOnToolsVersion = 7.1; + }; + }; + }; + buildConfigurationList = 6557F4AA1BEACBAB003CD2BF /* Build configuration list for PBXProject "Custom Money" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6557F4A61BEACBAB003CD2BF; + productRefGroup = 6557F4B01BEACBAB003CD2BF /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6557F4AE1BEACBAB003CD2BF /* Custom Money */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6557F4AD1BEACBAB003CD2BF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6557F4BD1BEACBAB003CD2BF /* LaunchScreen.storyboard in Resources */, + 6557F4BA1BEACBAB003CD2BF /* Assets.xcassets in Resources */, + 6557F4B81BEACBAB003CD2BF /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 141A924FCF80CDB9B7B98D7F /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 832DC70C773DE13EEBE861E3 /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + A29DCC8CFC4FF9494BCBC9E4 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6557F4AB1BEACBAB003CD2BF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6557F4C51BEACCA2003CD2BF /* Currencies.swift in Sources */, + 6557F4B51BEACBAB003CD2BF /* ViewController.swift in Sources */, + 6557F4B31BEACBAB003CD2BF /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 6557F4B61BEACBAB003CD2BF /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6557F4B71BEACBAB003CD2BF /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 6557F4BB1BEACBAB003CD2BF /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6557F4BC1BEACBAB003CD2BF /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 6557F4BF1BEACBAB003CD2BF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6557F4C01BEACBAB003CD2BF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6557F4C21BEACBAB003CD2BF /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 27DD6DC0FB0700753D5A773C /* Pods-Custom Money.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = "Custom Money/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Custom-Money"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 6557F4C31BEACBAB003CD2BF /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FD1CC1E65FBD4CF149DE88A7 /* Pods-Custom Money.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = "Custom Money/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Custom-Money"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6557F4AA1BEACBAB003CD2BF /* Build configuration list for PBXProject "Custom Money" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6557F4BF1BEACBAB003CD2BF /* Debug */, + 6557F4C01BEACBAB003CD2BF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6557F4C11BEACBAB003CD2BF /* Build configuration list for PBXNativeTarget "Custom Money" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6557F4C21BEACBAB003CD2BF /* Debug */, + 6557F4C31BEACBAB003CD2BF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6557F4A71BEACBAB003CD2BF /* Project object */; +} diff --git a/Examples/Custom Money/Custom Money.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Examples/Custom Money/Custom Money.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..de2c059 --- /dev/null +++ b/Examples/Custom Money/Custom Money.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Examples/Custom Money/Custom Money.xcworkspace/contents.xcworkspacedata b/Examples/Custom Money/Custom Money.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..8fe652d --- /dev/null +++ b/Examples/Custom Money/Custom Money.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Examples/Custom Money/Custom Money/AppDelegate.swift b/Examples/Custom Money/Custom Money/AppDelegate.swift new file mode 100644 index 0000000..6a301a3 --- /dev/null +++ b/Examples/Custom Money/Custom Money/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// Custom Money +// +// Created by Daniel Thorpe on 04/11/2015. +// Copyright © 2015 Daniel Thorpe. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(application: UIApplication) { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Examples/Custom Money/Custom Money/Assets.xcassets/AppIcon.appiconset/Contents.json b/Examples/Custom Money/Custom Money/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..36d2c80 --- /dev/null +++ b/Examples/Custom Money/Custom Money/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Custom Money/Custom Money/Base.lproj/LaunchScreen.storyboard b/Examples/Custom Money/Custom Money/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..2e721e1 --- /dev/null +++ b/Examples/Custom Money/Custom Money/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Custom Money/Custom Money/Base.lproj/Main.storyboard b/Examples/Custom Money/Custom Money/Base.lproj/Main.storyboard new file mode 100644 index 0000000..3a2a49b --- /dev/null +++ b/Examples/Custom Money/Custom Money/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Custom Money/Custom Money/Currencies.swift b/Examples/Custom Money/Custom Money/Currencies.swift new file mode 100644 index 0000000..b1bd4eb --- /dev/null +++ b/Examples/Custom Money/Custom Money/Currencies.swift @@ -0,0 +1,89 @@ +// +// Currencies.swift +// Custom Money +// +// Created by Daniel Thorpe on 04/11/2015. +// Copyright © 2015 Daniel Thorpe. All rights reserved. +// + +import Foundation +import Money + +protocol MyCustomCurrencyType: CurrencyType { } + +extension Currency { + + final class Heart: MyCustomCurrencyType { + + static let code: String = "HEARTS" + static let symbol: String = "❤️" + static let scale: Int = 0 + static let formatter: NSNumberFormatter = { + let fmtr = NSNumberFormatter() + fmtr.numberStyle = .CurrencyStyle + fmtr.maximumFractionDigits = Currency.Heart.scale + fmtr.currencySymbol = Currency.Heart.symbol + return fmtr + }() + } + + final class Bee: MyCustomCurrencyType { + + static let code: String = "BEES" + static let symbol: String = "🐝" + static let scale: Int = 0 + static let formatter: NSNumberFormatter = { + let fmtr = NSNumberFormatter() + fmtr.numberStyle = .CurrencyStyle + fmtr.maximumFractionDigits = Currency.Bee.scale + fmtr.currencySymbol = Currency.Bee.symbol + return fmtr + }() + } +} + +typealias Hearts = _Money +typealias Bees = _Money + +class BankRates { + + static func quoteForBase(base: String, counter: String) -> FXQuote { + return FXQuote(rate: sharedInstance.rates[base]![counter]!) + } + + static let sharedInstance = BankRates() + + let rates: [String: [String: BankersDecimal]] + + init() { + rates = [ + "BEES": [ + "BEES": 1.1, + "HEARTS": 0.3 + ], + "HEARTS": [ + "BEES": 7.3859, + "HEARTS": 0.8 + ] + ] + } +} + +class Bank: FXLocalProviderType { + + typealias BaseMoney = B + typealias CounterMoney = C + + static func name() -> String { + return "App Bank" + } + + static func quote() -> FXQuote { + return BankRates.quoteForBase(BaseMoney.Currency.code, counter: CounterMoney.Currency.code) + } +} + diff --git a/Examples/Custom Money/Custom Money/Info.plist b/Examples/Custom Money/Custom Money/Info.plist new file mode 100644 index 0000000..40c6215 --- /dev/null +++ b/Examples/Custom Money/Custom Money/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Examples/Custom Money/Custom Money/ViewController.swift b/Examples/Custom Money/Custom Money/ViewController.swift new file mode 100644 index 0000000..6ddaa89 --- /dev/null +++ b/Examples/Custom Money/Custom Money/ViewController.swift @@ -0,0 +1,27 @@ +// +// ViewController.swift +// Custom Money +// +// Created by Daniel Thorpe on 04/11/2015. +// Copyright © 2015 Daniel Thorpe. All rights reserved. +// + +import UIKit +import Money + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + let hearts: Hearts = 8.7 + let bees: Bees = 3.4 + + print("You have \(hearts) and \(bees)") + + let total = Bank.fx(hearts) + bees + + print("Exchanging your \(hearts) into \(Currency.Bee.symbol) via the bank gives you \(total) in total.") + } +} + diff --git a/Examples/Custom Money/Podfile b/Examples/Custom Money/Podfile new file mode 100644 index 0000000..8fa7170 --- /dev/null +++ b/Examples/Custom Money/Podfile @@ -0,0 +1,6 @@ +use_frameworks! + +target 'Custom Money' do + pod 'Money', :path => '../../' +end + diff --git a/Examples/Custom Money/Podfile.lock b/Examples/Custom Money/Podfile.lock new file mode 100644 index 0000000..668d1d4 --- /dev/null +++ b/Examples/Custom Money/Podfile.lock @@ -0,0 +1,23 @@ +PODS: + - Money (1.0.0): + - Result (= 0.6.0-beta.6) + - SwiftyJSON + - ValueCoding + - Result (0.6.0-beta.6) + - SwiftyJSON (2.3.1) + - ValueCoding (1.1.0) + +DEPENDENCIES: + - Money (from `../../`) + +EXTERNAL SOURCES: + Money: + :path: "../../" + +SPEC CHECKSUMS: + Money: fdc3b1c89c626afe7ae0290742cd95d24bf6bb4b + Result: dc390d0b58f9ec43fcd536f1ebdd130803cc6cbc + SwiftyJSON: 592b53bee5ef3dd9b3bebc6b9cb7ee35426ae8c3 + ValueCoding: 54486fde2d7b1c2f1eb46de260b95340abed5bde + +COCOAPODS: 0.39.0 diff --git a/Examples/Custom Money/Pods/Local Podspecs/Money.podspec.json b/Examples/Custom Money/Pods/Local Podspecs/Money.podspec.json new file mode 100644 index 0000000..84469e6 --- /dev/null +++ b/Examples/Custom Money/Pods/Local Podspecs/Money.podspec.json @@ -0,0 +1,39 @@ +{ + "name": "Money", + "version": "1.0.0", + "summary": "Swift types for working with Money.", + "description": "Money is a Swift cross platform framework for iOS, watchOS, tvOS and OS X. \n\nIt provides types and functionality to help represent and manipulate money \nand currency related information.", + "homepage": "https://github.com/danthorpe/Money", + "license": "MIT", + "authors": { + "Daniel Thorpe": "@danthorpe" + }, + "source": { + "git": "https://github.com/danthorpe/Money.git", + "tag": "1.0.0" + }, + "module_name": "Money", + "social_media_url": "https://twitter.com/danthorpe", + "requires_arc": true, + "platforms": { + "ios": "8.0", + "osx": "10.10", + "tvos": "9.0", + "watchos": "2.0" + }, + "source_files": [ + "Money/*.swift", + "Money/Decimal/*.swift" + ], + "dependencies": { + "ValueCoding": [ + + ], + "Result": [ + "0.6.0-beta.6" + ], + "SwiftyJSON": [ + + ] + } +} diff --git a/Examples/Custom Money/Pods/Manifest.lock b/Examples/Custom Money/Pods/Manifest.lock new file mode 100644 index 0000000..668d1d4 --- /dev/null +++ b/Examples/Custom Money/Pods/Manifest.lock @@ -0,0 +1,23 @@ +PODS: + - Money (1.0.0): + - Result (= 0.6.0-beta.6) + - SwiftyJSON + - ValueCoding + - Result (0.6.0-beta.6) + - SwiftyJSON (2.3.1) + - ValueCoding (1.1.0) + +DEPENDENCIES: + - Money (from `../../`) + +EXTERNAL SOURCES: + Money: + :path: "../../" + +SPEC CHECKSUMS: + Money: fdc3b1c89c626afe7ae0290742cd95d24bf6bb4b + Result: dc390d0b58f9ec43fcd536f1ebdd130803cc6cbc + SwiftyJSON: 592b53bee5ef3dd9b3bebc6b9cb7ee35426ae8c3 + ValueCoding: 54486fde2d7b1c2f1eb46de260b95340abed5bde + +COCOAPODS: 0.39.0 diff --git a/Examples/Custom Money/Pods/Pods.xcodeproj/project.pbxproj b/Examples/Custom Money/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..263f65c --- /dev/null +++ b/Examples/Custom Money/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,1091 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 01F1F11219565EEDB994774F5458DBCC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */; }; + 09F8C9409DF28C51561C0D4BCBDB7426 /* Pods-Custom Money-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CEE659D9C1D3DEA521E896D331964 /* Pods-Custom Money-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 205DE9495F6E98279A553429FDDF15B6 /* Money-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B01F2F57312E8852B8AAE2F384F620E /* Money-dummy.m */; }; + 30A618A1BC51A7D95D17A2067B21ACF0 /* ResultType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F003A917BF6D1C4FBA4D94B06C30179 /* ResultType.swift */; }; + 33F7DE75B0812B10F67D0420C6D71510 /* NSDecimalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6A0B230AA93987BDA716F0FEBDCDA0E /* NSDecimalExtensions.swift */; }; + 35575A63DB40EB8EC8BFD8189093A5DB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */; }; + 3CD1D2DD10E273F86707E96E8BDB06AA /* ValueCoding-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B5E95FBF4C047EA6401BB7B12E42A8B7 /* ValueCoding-dummy.m */; }; + 3F1E9A6F32C74A0E158DF5FD355FDADD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */; }; + 40CD08E83AB8406EFF6DAD723DFA3AC3 /* ValueCoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5BC5B78EBB608AE95556AC64F2F724 /* ValueCoding.swift */; }; + 46B661B9D41457BFE21F2618E7CCC4E0 /* Pods-Custom Money-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9600516FB0E389F99DD6A409A89CA451 /* Pods-Custom Money-dummy.m */; }; + 563C2572D3B5DF7896E7626C05F0CE11 /* FX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21ADF1E6DF190AAE9E0330490E4C3CF4 /* FX.swift */; }; + 5749D741D8442D600F69E17C2E0C571E /* DecimalNumberType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73CBCFF08B4E8BC27DCC0D5E90E976EA /* DecimalNumberType.swift */; }; + 591F03157805EB971E8A5D69F6F5112F /* Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED82986EB832C433BA892182F89597C6 /* Support.swift */; }; + 5E7CE62AF1775A4C8F8CE4336708FACF /* Result-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F158272DDE3E68231F6FE2A3DEB56C4E /* Result-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6E4DBC7F136D4F38ECD0AE3CB83A0676 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C83A0ED4B948E127B8A02BBD7F0A9BA /* Currency.swift */; }; + 75DB6DD279AC32DEEE23F40E91029761 /* Money.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F95EC7386DACBA19CC5260381AADDE /* Money.swift */; }; + 78191570D151CEFFE5779A818A10D273 /* ValueCoding-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E593BAC0D422045A94607A9C0A277E /* ValueCoding-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7A64F6E65EEA7AD7BA15349E04A6C17E /* Result-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F2976F6779F80CE007235A83876CE7 /* Result-dummy.m */; }; + 8E429C0288212DAB30AD1C19DD92D176 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D1FC653D131B20022B75023F33F250B9 /* Result.framework */; }; + 9A09B11207C1722543A88B81FD18E43D /* SwiftyJSON-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = E2CDFCF407B3970A3F2FD3C19CCA4CE7 /* SwiftyJSON-dummy.m */; }; + A5D79197F9C87AA12A55CF321D39FD9E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */; }; + AB72AD9AEBAF9D656831C0593CB00F2C /* Money-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 91C4C71A43800346A8BACEA8E5B05DA5 /* Money-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AE4219A42AA8CC10780AFC8B8603DEC7 /* ValueCoding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C29D8E4CA9E4CF9452CBCB9F8D56071 /* ValueCoding.framework */; }; + B0590FC08FA8208B3D4A3F1C3B3D231F /* SwiftyJSON-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0216247E5703DEFCB395822BEDEDB978 /* SwiftyJSON-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B0BD516593207CE2DFF82F7428C2C0A9 /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31FCA3CC32B1FFB7E577A3FD7C8BDC8 /* SwiftyJSON.swift */; }; + D6564B72044D33B29B1ABCF62936AFF2 /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77FD247247D6D3CDBF638A9DB0EBDB4E /* SwiftyJSON.framework */; }; + DF62EA9ACF4A13DAF30D77D29FF0A664 /* NSDecimalNumberExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3816C7DAA3910FD77039D0F101813083 /* NSDecimalNumberExtensions.swift */; }; + E8240E78A8B0F6B8EFD560880C1B7EA2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */; }; + F099E4D77161FCDE09092A1EFE073689 /* Decimal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E2C607AAC7546F5DA1FF6E1D936464 /* Decimal.swift */; }; + FC421BD763CC47A66D9082814D727889 /* Autogenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFDAC51BCA9CA51E45E8E3EFF1115DC6 /* Autogenerated.swift */; }; + FCAC7A169DF92F4B209A2B4ADF0CEECC /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCB9149D7C1AAA968AE461BDB9D1EEE8 /* Result.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1CA2F65C195043637C90F2888D138A77 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3162227A40407035A6B7783E8DF419C0; + remoteInfo = Result; + }; + 1DFE2A02B5C6BDFE88F8CA3DFB0FC286 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7B7DCF1E0AA248CEB9ECEDA271F769CF; + remoteInfo = Money; + }; + 36023380F037B6AB8D4492DCA3A27CD5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 72F679D7EC35E44212F7DDF30676E432; + remoteInfo = SwiftyJSON; + }; + 41F272EA7F75CA2CEBC8E35579A501C9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3162227A40407035A6B7783E8DF419C0; + remoteInfo = Result; + }; + 7AA052775F912BADEC1FFCBF37B0CE8F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 72F679D7EC35E44212F7DDF30676E432; + remoteInfo = SwiftyJSON; + }; + A8D7D5C5D4B2B0DBEA7CD9A1C6CA1131 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 392A4CAB83070A6D2BFD53A02DBF3F3A; + remoteInfo = ValueCoding; + }; + FC9033D9680B4E91FEC3E2DAD8E754F3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 392A4CAB83070A6D2BFD53A02DBF3F3A; + remoteInfo = ValueCoding; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 0216247E5703DEFCB395822BEDEDB978 /* SwiftyJSON-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwiftyJSON-umbrella.h"; sourceTree = ""; }; + 03F95EC7386DACBA19CC5260381AADDE /* Money.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Money.swift; sourceTree = ""; }; + 0DA8BD07E1098E205AF45D501594137C /* Result.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Result.modulemap; sourceTree = ""; }; + 1DADDD5C59FCA27235ACA32605BD1527 /* SwiftyJSON-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwiftyJSON-prefix.pch"; sourceTree = ""; }; + 21ADF1E6DF190AAE9E0330490E4C3CF4 /* FX.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = FX.swift; sourceTree = ""; }; + 269178DAB03BE95581C9933E5AD7BA5E /* Result.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Result.xcconfig; sourceTree = ""; }; + 3816C7DAA3910FD77039D0F101813083 /* NSDecimalNumberExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NSDecimalNumberExtensions.swift; sourceTree = ""; }; + 3D3CEE659D9C1D3DEA521E896D331964 /* Pods-Custom Money-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Custom Money-umbrella.h"; sourceTree = ""; }; + 3D699C1DA947CA5DBF82BE8927112AC0 /* ValueCoding.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = ValueCoding.modulemap; sourceTree = ""; }; + 3F972EB6AED7000E61962C751DD7165D /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 4AB0701B627076DB30830590329556A7 /* Money.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Money.modulemap; sourceTree = ""; }; + 4B01F2F57312E8852B8AAE2F384F620E /* Money-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Money-dummy.m"; sourceTree = ""; }; + 4C1460F12F695C031F6228E5D1C63C9F /* SwiftyJSON.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftyJSON.xcconfig; sourceTree = ""; }; + 4F003A917BF6D1C4FBA4D94B06C30179 /* ResultType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResultType.swift; path = Result/ResultType.swift; sourceTree = ""; }; + 50DFB978AB699248C726E034F1B3B42F /* ValueCoding.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ValueCoding.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5C29D8E4CA9E4CF9452CBCB9F8D56071 /* ValueCoding.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ValueCoding.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65E593BAC0D422045A94607A9C0A277E /* ValueCoding-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ValueCoding-umbrella.h"; sourceTree = ""; }; + 6C83A0ED4B948E127B8A02BBD7F0A9BA /* Currency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Currency.swift; sourceTree = ""; }; + 71224125016483CBA4B84EA93DFD15CB /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 73CBCFF08B4E8BC27DCC0D5E90E976EA /* DecimalNumberType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = DecimalNumberType.swift; sourceTree = ""; }; + 765CD792203F037EA7D0D97B135C395A /* ValueCoding.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = ValueCoding.xcconfig; sourceTree = ""; }; + 77FD247247D6D3CDBF638A9DB0EBDB4E /* SwiftyJSON.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftyJSON.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7D56F281EDF6E7A4ED5627141F4E4DA2 /* Pods_Custom_Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Custom_Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 91C4C71A43800346A8BACEA8E5B05DA5 /* Money-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Money-umbrella.h"; sourceTree = ""; }; + 94291E74B2ABBA056AD28AD1873DD8E3 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 946FC5A04C491594712C2DB0468A8E59 /* Pods-Custom Money-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Custom Money-frameworks.sh"; sourceTree = ""; }; + 9600516FB0E389F99DD6A409A89CA451 /* Pods-Custom Money-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Custom Money-dummy.m"; sourceTree = ""; }; + 9678D4111A5AF8A6BB307124E11DCA92 /* Pods-Custom Money-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Custom Money-resources.sh"; sourceTree = ""; }; + 9E93EF565FBC64DCCA9029202BF573DE /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9F8525B17F44112BA10D136F7F6C4089 /* ValueCoding-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ValueCoding-prefix.pch"; sourceTree = ""; }; + A26E7BC45299526E4063BB4C61816580 /* Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A6DD5137FE8F22C2424D946F7E8D8D68 /* Pods-Custom Money-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Custom Money-acknowledgements.markdown"; sourceTree = ""; }; + AFDAC51BCA9CA51E45E8E3EFF1115DC6 /* Autogenerated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Autogenerated.swift; sourceTree = ""; }; + B54A2AA14A7640E4A9B85F662D37A7D6 /* SwiftyJSON.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = SwiftyJSON.modulemap; sourceTree = ""; }; + B5E95FBF4C047EA6401BB7B12E42A8B7 /* ValueCoding-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "ValueCoding-dummy.m"; sourceTree = ""; }; + B6A0B230AA93987BDA716F0FEBDCDA0E /* NSDecimalExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NSDecimalExtensions.swift; sourceTree = ""; }; + BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + C31FCA3CC32B1FFB7E577A3FD7C8BDC8 /* SwiftyJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftyJSON.swift; path = Source/SwiftyJSON.swift; sourceTree = ""; }; + C3461681C9E35896A154A3D8722352D1 /* Pods-Custom Money-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Custom Money-acknowledgements.plist"; sourceTree = ""; }; + C4B98152CC246208D533CBEB9CD23E8C /* Money-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Money-prefix.pch"; sourceTree = ""; }; + C6AD9E331A620215773EDAE3D38920CB /* Pods-Custom Money.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Custom Money.release.xcconfig"; sourceTree = ""; }; + CCB9149D7C1AAA968AE461BDB9D1EEE8 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Result/Result.swift; sourceTree = ""; }; + D0F97F33A29F47BC32D7EBD2E18FAB2D /* Money.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Money.xcconfig; sourceTree = ""; }; + D1FC653D131B20022B75023F33F250B9 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D3F2B752C29D13FEC643AB1DFAD68B3E /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D5181C8B9D1105F7243EBF4BDFDA56F8 /* Result-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Result-prefix.pch"; sourceTree = ""; }; + D619B7641BF35CCD0B69F64DE1F3B98A /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D8F2976F6779F80CE007235A83876CE7 /* Result-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Result-dummy.m"; sourceTree = ""; }; + DC0E8FE128B75E4AF4C971D16E94076E /* SwiftyJSON.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftyJSON.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DF6284F39323D79B75BEEB8C366DE87C /* Pods-Custom Money.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Custom Money.debug.xcconfig"; sourceTree = ""; }; + E2CDFCF407B3970A3F2FD3C19CCA4CE7 /* SwiftyJSON-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SwiftyJSON-dummy.m"; sourceTree = ""; }; + ED5BC5B78EBB608AE95556AC64F2F724 /* ValueCoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ValueCoding.swift; path = ValueCoding/ValueCoding.swift; sourceTree = ""; }; + ED82986EB832C433BA892182F89597C6 /* Support.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Support.swift; sourceTree = ""; }; + F158272DDE3E68231F6FE2A3DEB56C4E /* Result-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Result-umbrella.h"; sourceTree = ""; }; + F3E2C607AAC7546F5DA1FF6E1D936464 /* Decimal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Decimal.swift; sourceTree = ""; }; + F50C4C662DD8A2616FF07C3827D2AAC0 /* Pods-Custom Money.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Custom Money.modulemap"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 287993008FC38E134DDEC5ABE9076EC2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 01F1F11219565EEDB994774F5458DBCC /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 36E3CCD4791DA18A6646ECD589D9FA62 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E8240E78A8B0F6B8EFD560880C1B7EA2 /* Foundation.framework in Frameworks */, + 8E429C0288212DAB30AD1C19DD92D176 /* Result.framework in Frameworks */, + D6564B72044D33B29B1ABCF62936AFF2 /* SwiftyJSON.framework in Frameworks */, + AE4219A42AA8CC10780AFC8B8603DEC7 /* ValueCoding.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3AFBB1C75257342FF231054380286529 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3F1E9A6F32C74A0E158DF5FD355FDADD /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3B577FA4015B3AA4F0642D89BC36EF20 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A5D79197F9C87AA12A55CF321D39FD9E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4716E670998219B6B6EB4A7AB3211D1C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 35575A63DB40EB8EC8BFD8189093A5DB /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 13A85A3CB9EFB99894B9E1D258300E7F /* ValueCoding */ = { + isa = PBXGroup; + children = ( + ED5BC5B78EBB608AE95556AC64F2F724 /* ValueCoding.swift */, + 85C16A8C8A8FE775D0BED2B53BDCB62D /* Support Files */, + ); + path = ValueCoding; + sourceTree = ""; + }; + 1C7CAFC5D20189D4E6E712868550FB26 /* Decimal */ = { + isa = PBXGroup; + children = ( + F3E2C607AAC7546F5DA1FF6E1D936464 /* Decimal.swift */, + 73CBCFF08B4E8BC27DCC0D5E90E976EA /* DecimalNumberType.swift */, + B6A0B230AA93987BDA716F0FEBDCDA0E /* NSDecimalExtensions.swift */, + 3816C7DAA3910FD77039D0F101813083 /* NSDecimalNumberExtensions.swift */, + ); + path = Decimal; + sourceTree = ""; + }; + 37FC7D49E06169F9EEE81FBA6366BDB9 /* Pods-Custom Money */ = { + isa = PBXGroup; + children = ( + D3F2B752C29D13FEC643AB1DFAD68B3E /* Info.plist */, + F50C4C662DD8A2616FF07C3827D2AAC0 /* Pods-Custom Money.modulemap */, + A6DD5137FE8F22C2424D946F7E8D8D68 /* Pods-Custom Money-acknowledgements.markdown */, + C3461681C9E35896A154A3D8722352D1 /* Pods-Custom Money-acknowledgements.plist */, + 9600516FB0E389F99DD6A409A89CA451 /* Pods-Custom Money-dummy.m */, + 946FC5A04C491594712C2DB0468A8E59 /* Pods-Custom Money-frameworks.sh */, + 9678D4111A5AF8A6BB307124E11DCA92 /* Pods-Custom Money-resources.sh */, + 3D3CEE659D9C1D3DEA521E896D331964 /* Pods-Custom Money-umbrella.h */, + DF6284F39323D79B75BEEB8C366DE87C /* Pods-Custom Money.debug.xcconfig */, + C6AD9E331A620215773EDAE3D38920CB /* Pods-Custom Money.release.xcconfig */, + ); + name = "Pods-Custom Money"; + path = "Target Support Files/Pods-Custom Money"; + sourceTree = ""; + }; + 455019E8E9063E7A12C1AB640CD1296A /* Pods */ = { + isa = PBXGroup; + children = ( + B5C0E67CF8FBCF29AA3D76C4CEADF315 /* Result */, + ED084EEB9ACE805519B38840A5FB08F9 /* SwiftyJSON */, + 13A85A3CB9EFB99894B9E1D258300E7F /* ValueCoding */, + ); + name = Pods; + sourceTree = ""; + }; + 5CEE22C08342643D21F896926A007B93 /* Money */ = { + isa = PBXGroup; + children = ( + A4426877A6400E8A0EF97526D9013EAE /* Money */, + 88ECEAF82072CCAC7F028BBF483E773D /* Support Files */, + ); + name = Money; + path = ../../..; + sourceTree = ""; + }; + 7CD8DE1FA9C24B39D42EAA6BE52E7E30 /* Products */ = { + isa = PBXGroup; + children = ( + A26E7BC45299526E4063BB4C61816580 /* Money.framework */, + 7D56F281EDF6E7A4ED5627141F4E4DA2 /* Pods_Custom_Money.framework */, + D619B7641BF35CCD0B69F64DE1F3B98A /* Result.framework */, + DC0E8FE128B75E4AF4C971D16E94076E /* SwiftyJSON.framework */, + 50DFB978AB699248C726E034F1B3B42F /* ValueCoding.framework */, + ); + name = Products; + sourceTree = ""; + }; + 7DB346D0F39D3F0E887471402A8071AB = { + isa = PBXGroup; + children = ( + BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */, + CAC5A6648E74B35CD2E9377F99CF2FF6 /* Development Pods */, + BA66696464500E2C416485FBF1B9A1DC /* Frameworks */, + 455019E8E9063E7A12C1AB640CD1296A /* Pods */, + 7CD8DE1FA9C24B39D42EAA6BE52E7E30 /* Products */, + CC000F6A87092A7C760D60A29FA15A12 /* Targets Support Files */, + ); + sourceTree = ""; + }; + 821C7EACE9BFB31DB92E84CD826E39AC /* Support Files */ = { + isa = PBXGroup; + children = ( + 94291E74B2ABBA056AD28AD1873DD8E3 /* Info.plist */, + B54A2AA14A7640E4A9B85F662D37A7D6 /* SwiftyJSON.modulemap */, + 4C1460F12F695C031F6228E5D1C63C9F /* SwiftyJSON.xcconfig */, + E2CDFCF407B3970A3F2FD3C19CCA4CE7 /* SwiftyJSON-dummy.m */, + 1DADDD5C59FCA27235ACA32605BD1527 /* SwiftyJSON-prefix.pch */, + 0216247E5703DEFCB395822BEDEDB978 /* SwiftyJSON-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/SwiftyJSON"; + sourceTree = ""; + }; + 85C16A8C8A8FE775D0BED2B53BDCB62D /* Support Files */ = { + isa = PBXGroup; + children = ( + 3F972EB6AED7000E61962C751DD7165D /* Info.plist */, + 3D699C1DA947CA5DBF82BE8927112AC0 /* ValueCoding.modulemap */, + 765CD792203F037EA7D0D97B135C395A /* ValueCoding.xcconfig */, + B5E95FBF4C047EA6401BB7B12E42A8B7 /* ValueCoding-dummy.m */, + 9F8525B17F44112BA10D136F7F6C4089 /* ValueCoding-prefix.pch */, + 65E593BAC0D422045A94607A9C0A277E /* ValueCoding-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/ValueCoding"; + sourceTree = ""; + }; + 88ECEAF82072CCAC7F028BBF483E773D /* Support Files */ = { + isa = PBXGroup; + children = ( + 9E93EF565FBC64DCCA9029202BF573DE /* Info.plist */, + 4AB0701B627076DB30830590329556A7 /* Money.modulemap */, + D0F97F33A29F47BC32D7EBD2E18FAB2D /* Money.xcconfig */, + 4B01F2F57312E8852B8AAE2F384F620E /* Money-dummy.m */, + C4B98152CC246208D533CBEB9CD23E8C /* Money-prefix.pch */, + 91C4C71A43800346A8BACEA8E5B05DA5 /* Money-umbrella.h */, + ); + name = "Support Files"; + path = "Examples/Custom Money/Pods/Target Support Files/Money"; + sourceTree = ""; + }; + A4426877A6400E8A0EF97526D9013EAE /* Money */ = { + isa = PBXGroup; + children = ( + AFDAC51BCA9CA51E45E8E3EFF1115DC6 /* Autogenerated.swift */, + 6C83A0ED4B948E127B8A02BBD7F0A9BA /* Currency.swift */, + 21ADF1E6DF190AAE9E0330490E4C3CF4 /* FX.swift */, + 03F95EC7386DACBA19CC5260381AADDE /* Money.swift */, + ED82986EB832C433BA892182F89597C6 /* Support.swift */, + 1C7CAFC5D20189D4E6E712868550FB26 /* Decimal */, + ); + path = Money; + sourceTree = ""; + }; + B5C0E67CF8FBCF29AA3D76C4CEADF315 /* Result */ = { + isa = PBXGroup; + children = ( + CCB9149D7C1AAA968AE461BDB9D1EEE8 /* Result.swift */, + 4F003A917BF6D1C4FBA4D94B06C30179 /* ResultType.swift */, + EDEC584DA0D01041295CAE86B185A4FB /* Support Files */, + ); + path = Result; + sourceTree = ""; + }; + BA66696464500E2C416485FBF1B9A1DC /* Frameworks */ = { + isa = PBXGroup; + children = ( + D1FC653D131B20022B75023F33F250B9 /* Result.framework */, + 77FD247247D6D3CDBF638A9DB0EBDB4E /* SwiftyJSON.framework */, + 5C29D8E4CA9E4CF9452CBCB9F8D56071 /* ValueCoding.framework */, + D1F9686EA2AB71EF7FD960AFCB6C0950 /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + CAC5A6648E74B35CD2E9377F99CF2FF6 /* Development Pods */ = { + isa = PBXGroup; + children = ( + 5CEE22C08342643D21F896926A007B93 /* Money */, + ); + name = "Development Pods"; + sourceTree = ""; + }; + CC000F6A87092A7C760D60A29FA15A12 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + 37FC7D49E06169F9EEE81FBA6366BDB9 /* Pods-Custom Money */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + D1F9686EA2AB71EF7FD960AFCB6C0950 /* iOS */ = { + isa = PBXGroup; + children = ( + 8912AF1B024C1949E8DB3ECC403C4AE2 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; + ED084EEB9ACE805519B38840A5FB08F9 /* SwiftyJSON */ = { + isa = PBXGroup; + children = ( + C31FCA3CC32B1FFB7E577A3FD7C8BDC8 /* SwiftyJSON.swift */, + 821C7EACE9BFB31DB92E84CD826E39AC /* Support Files */, + ); + path = SwiftyJSON; + sourceTree = ""; + }; + EDEC584DA0D01041295CAE86B185A4FB /* Support Files */ = { + isa = PBXGroup; + children = ( + 71224125016483CBA4B84EA93DFD15CB /* Info.plist */, + 0DA8BD07E1098E205AF45D501594137C /* Result.modulemap */, + 269178DAB03BE95581C9933E5AD7BA5E /* Result.xcconfig */, + D8F2976F6779F80CE007235A83876CE7 /* Result-dummy.m */, + D5181C8B9D1105F7243EBF4BDFDA56F8 /* Result-prefix.pch */, + F158272DDE3E68231F6FE2A3DEB56C4E /* Result-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/Result"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 6E4808B6DCEFB9C7F269EFD1C1EC9C1E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 78191570D151CEFFE5779A818A10D273 /* ValueCoding-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6F9A0A9EDDAC4636E3474534015A7AEC /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + AB72AD9AEBAF9D656831C0593CB00F2C /* Money-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8269C693AE9B0FAA04EE2300F9720E28 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F8C9409DF28C51561C0D4BCBDB7426 /* Pods-Custom Money-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 92E11BD2A7982BE9DBED7211BC4F5139 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + B0590FC08FA8208B3D4A3F1C3B3D231F /* SwiftyJSON-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A1104E3A762FB90D79396269FE488BF5 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 5E7CE62AF1775A4C8F8CE4336708FACF /* Result-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3162227A40407035A6B7783E8DF419C0 /* Result */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5157FB6DF5F40D1480DE27E6F4F6F192 /* Build configuration list for PBXNativeTarget "Result" */; + buildPhases = ( + 511CC0195ACB2D26498CE4C92918E8EB /* Sources */, + 3B577FA4015B3AA4F0642D89BC36EF20 /* Frameworks */, + A1104E3A762FB90D79396269FE488BF5 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Result; + productName = Result; + productReference = D619B7641BF35CCD0B69F64DE1F3B98A /* Result.framework */; + productType = "com.apple.product-type.framework"; + }; + 392A4CAB83070A6D2BFD53A02DBF3F3A /* ValueCoding */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6E0CE741A92A61C488DE040CED3E085F /* Build configuration list for PBXNativeTarget "ValueCoding" */; + buildPhases = ( + 78A6B0DF6F273EBFC464152AEE8880F4 /* Sources */, + 287993008FC38E134DDEC5ABE9076EC2 /* Frameworks */, + 6E4808B6DCEFB9C7F269EFD1C1EC9C1E /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ValueCoding; + productName = ValueCoding; + productReference = 50DFB978AB699248C726E034F1B3B42F /* ValueCoding.framework */; + productType = "com.apple.product-type.framework"; + }; + 72F679D7EC35E44212F7DDF30676E432 /* SwiftyJSON */ = { + isa = PBXNativeTarget; + buildConfigurationList = C1B846582E915B3960C2BB7D63A45E25 /* Build configuration list for PBXNativeTarget "SwiftyJSON" */; + buildPhases = ( + 3DD5417794C8371AC8C5C0E14D09B015 /* Sources */, + 3AFBB1C75257342FF231054380286529 /* Frameworks */, + 92E11BD2A7982BE9DBED7211BC4F5139 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftyJSON; + productName = SwiftyJSON; + productReference = DC0E8FE128B75E4AF4C971D16E94076E /* SwiftyJSON.framework */; + productType = "com.apple.product-type.framework"; + }; + 7B7DCF1E0AA248CEB9ECEDA271F769CF /* Money */ = { + isa = PBXNativeTarget; + buildConfigurationList = 08A005D3FEAC46D266B6125A996C5566 /* Build configuration list for PBXNativeTarget "Money" */; + buildPhases = ( + C85EDC555633733F4044486EE937639F /* Sources */, + 36E3CCD4791DA18A6646ECD589D9FA62 /* Frameworks */, + 6F9A0A9EDDAC4636E3474534015A7AEC /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + 74A7EEF02148E28896373E011E00E453 /* PBXTargetDependency */, + CEFCEFA0EC8DC38BA5F89A533919F966 /* PBXTargetDependency */, + 593A557A4013D60694292A73EE435A48 /* PBXTargetDependency */, + ); + name = Money; + productName = Money; + productReference = A26E7BC45299526E4063BB4C61816580 /* Money.framework */; + productType = "com.apple.product-type.framework"; + }; + B63DBF20C97F25D4F844CB4BDFE4527A /* Pods-Custom Money */ = { + isa = PBXNativeTarget; + buildConfigurationList = 37A41A6B9185E59239BFB81D6353E1CF /* Build configuration list for PBXNativeTarget "Pods-Custom Money" */; + buildPhases = ( + 9939AE9FAD1EEC366F8358A7D92606F6 /* Sources */, + 4716E670998219B6B6EB4A7AB3211D1C /* Frameworks */, + 8269C693AE9B0FAA04EE2300F9720E28 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + 6A5AB7BA465846DD13A7288647AE3D64 /* PBXTargetDependency */, + 5296D6953C077C85AFCB563124192C7D /* PBXTargetDependency */, + 14EE644027DDF28E4652404B99E3BE47 /* PBXTargetDependency */, + DBB46D880EEEB766A474B6074D4B98DF /* PBXTargetDependency */, + ); + name = "Pods-Custom Money"; + productName = "Pods-Custom Money"; + productReference = 7D56F281EDF6E7A4ED5627141F4E4DA2 /* Pods_Custom_Money.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0700; + LastUpgradeCheck = 0700; + }; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 7DB346D0F39D3F0E887471402A8071AB; + productRefGroup = 7CD8DE1FA9C24B39D42EAA6BE52E7E30 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7B7DCF1E0AA248CEB9ECEDA271F769CF /* Money */, + B63DBF20C97F25D4F844CB4BDFE4527A /* Pods-Custom Money */, + 3162227A40407035A6B7783E8DF419C0 /* Result */, + 72F679D7EC35E44212F7DDF30676E432 /* SwiftyJSON */, + 392A4CAB83070A6D2BFD53A02DBF3F3A /* ValueCoding */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 3DD5417794C8371AC8C5C0E14D09B015 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9A09B11207C1722543A88B81FD18E43D /* SwiftyJSON-dummy.m in Sources */, + B0BD516593207CE2DFF82F7428C2C0A9 /* SwiftyJSON.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 511CC0195ACB2D26498CE4C92918E8EB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7A64F6E65EEA7AD7BA15349E04A6C17E /* Result-dummy.m in Sources */, + FCAC7A169DF92F4B209A2B4ADF0CEECC /* Result.swift in Sources */, + 30A618A1BC51A7D95D17A2067B21ACF0 /* ResultType.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 78A6B0DF6F273EBFC464152AEE8880F4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3CD1D2DD10E273F86707E96E8BDB06AA /* ValueCoding-dummy.m in Sources */, + 40CD08E83AB8406EFF6DAD723DFA3AC3 /* ValueCoding.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9939AE9FAD1EEC366F8358A7D92606F6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 46B661B9D41457BFE21F2618E7CCC4E0 /* Pods-Custom Money-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C85EDC555633733F4044486EE937639F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC421BD763CC47A66D9082814D727889 /* Autogenerated.swift in Sources */, + 6E4DBC7F136D4F38ECD0AE3CB83A0676 /* Currency.swift in Sources */, + F099E4D77161FCDE09092A1EFE073689 /* Decimal.swift in Sources */, + 5749D741D8442D600F69E17C2E0C571E /* DecimalNumberType.swift in Sources */, + 563C2572D3B5DF7896E7626C05F0CE11 /* FX.swift in Sources */, + 205DE9495F6E98279A553429FDDF15B6 /* Money-dummy.m in Sources */, + 75DB6DD279AC32DEEE23F40E91029761 /* Money.swift in Sources */, + 33F7DE75B0812B10F67D0420C6D71510 /* NSDecimalExtensions.swift in Sources */, + DF62EA9ACF4A13DAF30D77D29FF0A664 /* NSDecimalNumberExtensions.swift in Sources */, + 591F03157805EB971E8A5D69F6F5112F /* Support.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 14EE644027DDF28E4652404B99E3BE47 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SwiftyJSON; + target = 72F679D7EC35E44212F7DDF30676E432 /* SwiftyJSON */; + targetProxy = 36023380F037B6AB8D4492DCA3A27CD5 /* PBXContainerItemProxy */; + }; + 5296D6953C077C85AFCB563124192C7D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Result; + target = 3162227A40407035A6B7783E8DF419C0 /* Result */; + targetProxy = 41F272EA7F75CA2CEBC8E35579A501C9 /* PBXContainerItemProxy */; + }; + 593A557A4013D60694292A73EE435A48 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ValueCoding; + target = 392A4CAB83070A6D2BFD53A02DBF3F3A /* ValueCoding */; + targetProxy = FC9033D9680B4E91FEC3E2DAD8E754F3 /* PBXContainerItemProxy */; + }; + 6A5AB7BA465846DD13A7288647AE3D64 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Money; + target = 7B7DCF1E0AA248CEB9ECEDA271F769CF /* Money */; + targetProxy = 1DFE2A02B5C6BDFE88F8CA3DFB0FC286 /* PBXContainerItemProxy */; + }; + 74A7EEF02148E28896373E011E00E453 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Result; + target = 3162227A40407035A6B7783E8DF419C0 /* Result */; + targetProxy = 1CA2F65C195043637C90F2888D138A77 /* PBXContainerItemProxy */; + }; + CEFCEFA0EC8DC38BA5F89A533919F966 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SwiftyJSON; + target = 72F679D7EC35E44212F7DDF30676E432 /* SwiftyJSON */; + targetProxy = 7AA052775F912BADEC1FFCBF37B0CE8F /* PBXContainerItemProxy */; + }; + DBB46D880EEEB766A474B6074D4B98DF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ValueCoding; + target = 392A4CAB83070A6D2BFD53A02DBF3F3A /* ValueCoding */; + targetProxy = A8D7D5C5D4B2B0DBEA7CD9A1C6CA1131 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 155B87FE08E3E94C4A3224D3CA34A844 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4C1460F12F695C031F6228E5D1C63C9F /* SwiftyJSON.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SwiftyJSON/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/SwiftyJSON/SwiftyJSON.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = SwiftyJSON; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 1A5C3AB79FFAD473C53D2FF59AD706F0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = DF6284F39323D79B75BEEB8C366DE87C /* Pods-Custom Money.debug.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Custom Money/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Custom Money/Pods-Custom Money.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_NAME = Pods_Custom_Money; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 4995DDF9C7DA0EB2DAD7955EC6C7E16D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4C1460F12F695C031F6228E5D1C63C9F /* SwiftyJSON.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SwiftyJSON/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/SwiftyJSON/SwiftyJSON.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = SwiftyJSON; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 5CCE459C2B148F060DEF089C2B8EF33E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C6AD9E331A620215773EDAE3D38920CB /* Pods-Custom Money.release.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Custom Money/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Custom Money/Pods-Custom Money.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_NAME = Pods_Custom_Money; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 69CB76F5C7AB28E540D9920F52F6ADF0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0F97F33A29F47BC32D7EBD2E18FAB2D /* Money.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/Money/Money-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Money/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Money/Money.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Money; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 6BD90311D0271248CD69AE34E2D3F023 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 269178DAB03BE95581C9933E5AD7BA5E /* Result.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/Result/Result-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Result/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Result/Result.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Result; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 86F21C46C5F12EAC4936A18B3B5C6484 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 765CD792203F037EA7D0D97B135C395A /* ValueCoding.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/ValueCoding/ValueCoding-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/ValueCoding/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/ValueCoding/ValueCoding.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = ValueCoding; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 8EFFC1C125424EA89B82CFAB194229AB /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0F97F33A29F47BC32D7EBD2E18FAB2D /* Money.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/Money/Money-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Money/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Money/Money.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = Money; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + BDA4AFECD66C51EC5CB5FD10E522DB96 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 765CD792203F037EA7D0D97B135C395A /* ValueCoding.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/ValueCoding/ValueCoding-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/ValueCoding/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/ValueCoding/ValueCoding.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = ValueCoding; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + C074F63C9EE7CB4D8C618390A32CEC35 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + ONLY_ACTIVE_ARCH = YES; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + E43846B588E1892F3093F3B7082B6DFB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E94DE46C3FE758FA6C0D60E3649FA006 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 269178DAB03BE95581C9933E5AD7BA5E /* Result.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/Result/Result-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Result/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Result/Result.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = Result; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 08A005D3FEAC46D266B6125A996C5566 /* Build configuration list for PBXNativeTarget "Money" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 69CB76F5C7AB28E540D9920F52F6ADF0 /* Debug */, + 8EFFC1C125424EA89B82CFAB194229AB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C074F63C9EE7CB4D8C618390A32CEC35 /* Debug */, + E43846B588E1892F3093F3B7082B6DFB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 37A41A6B9185E59239BFB81D6353E1CF /* Build configuration list for PBXNativeTarget "Pods-Custom Money" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A5C3AB79FFAD473C53D2FF59AD706F0 /* Debug */, + 5CCE459C2B148F060DEF089C2B8EF33E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5157FB6DF5F40D1480DE27E6F4F6F192 /* Build configuration list for PBXNativeTarget "Result" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6BD90311D0271248CD69AE34E2D3F023 /* Debug */, + E94DE46C3FE758FA6C0D60E3649FA006 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6E0CE741A92A61C488DE040CED3E085F /* Build configuration list for PBXNativeTarget "ValueCoding" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 86F21C46C5F12EAC4936A18B3B5C6484 /* Debug */, + BDA4AFECD66C51EC5CB5FD10E522DB96 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C1B846582E915B3960C2BB7D63A45E25 /* Build configuration list for PBXNativeTarget "SwiftyJSON" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4995DDF9C7DA0EB2DAD7955EC6C7E16D /* Debug */, + 155B87FE08E3E94C4A3224D3CA34A844 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; +} diff --git a/Examples/Custom Money/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Money.xcscheme b/Examples/Custom Money/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Money.xcscheme new file mode 100644 index 0000000..99bfe2a --- /dev/null +++ b/Examples/Custom Money/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Money.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Custom Money/Pods/Result/LICENSE b/Examples/Custom Money/Pods/Result/LICENSE new file mode 100644 index 0000000..3026ee1 --- /dev/null +++ b/Examples/Custom Money/Pods/Result/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Rob Rix + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Examples/Custom Money/Pods/Result/README.md b/Examples/Custom Money/Pods/Result/README.md new file mode 100644 index 0000000..cec661d --- /dev/null +++ b/Examples/Custom Money/Pods/Result/README.md @@ -0,0 +1,22 @@ +# Result + +[![Build Status](https://travis-ci.org/antitypical/Result.svg?branch=master)](https://travis-ci.org/antitypical/Result) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![CocoaPods](https://img.shields.io/cocoapods/v/Result.svg)](https://cocoapods.org/) + +This is a Swift µframework providing `Result`. + +`Result` values are either successful (wrapping `Value`) or failed (wrapping `Error`). This is similar to Swift’s native `Optional` type, with the addition of an error value to pass some error code, message, or object along to be logged or displayed to the user. + + +## Use + +[API documentation](http://cocoadocs.org/docsets/Result/) is in the source. + + +## Integration + +1. Add this repository as a submodule and/or [add it to your Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) if you’re using [carthage](https://github.com/Carthage/Carthage/) to manage your dependencies. +2. Drag `Result.xcodeproj` into your project or workspace. +3. Link your target against `Result.framework`. +4. Application targets should ensure that the framework gets copied into their application bundle. (Framework targets should instead require the application linking them to include Result.) diff --git a/Examples/Custom Money/Pods/Result/Result/Result.swift b/Examples/Custom Money/Pods/Result/Result/Result.swift new file mode 100644 index 0000000..d035fc3 --- /dev/null +++ b/Examples/Custom Money/Pods/Result/Result/Result.swift @@ -0,0 +1,204 @@ +// Copyright (c) 2015 Rob Rix. All rights reserved. + +/// An enum representing either a failure with an explanatory error, or a success with a result value. +public enum Result: ResultType, CustomStringConvertible, CustomDebugStringConvertible { + case Success(T) + case Failure(Error) + + // MARK: Constructors + + /// Constructs a success wrapping a `value`. + public init(value: T) { + self = .Success(value) + } + + /// Constructs a failure wrapping an `error`. + public init(error: Error) { + self = .Failure(error) + } + + /// Constructs a result from an Optional, failing with `Error` if `nil` + public init(_ value: T?, @autoclosure failWith: () -> Error) { + self = value.map(Result.Success) ?? .Failure(failWith()) + } + + /// Constructs a result from a function that uses `throw`, failing with `Error` if throws + public init(@autoclosure _ f: () throws -> T) { + do { + self = .Success(try f()) + } catch { + self = .Failure(error as! Error) + } + } + + + // MARK: Deconstruction + + /// Returns the value from `Success` Results or `throw`s the error + public func dematerialize() throws -> T { + switch self { + case let .Success(value): + return value + case let .Failure(error): + throw error + } + } + + /// Case analysis for Result. + /// + /// Returns the value produced by applying `ifFailure` to `Failure` Results, or `ifSuccess` to `Success` Results. + public func analysis(@noescape ifSuccess ifSuccess: T -> Result, @noescape ifFailure: Error -> Result) -> Result { + switch self { + case let .Success(value): + return ifSuccess(value) + case let .Failure(value): + return ifFailure(value) + } + } + + + // MARK: Higher-order functions + + /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??` + public func recover(@autoclosure value: () -> T) -> T { + return self.value ?? value() + } + + /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??` + public func recoverWith(@autoclosure result: () -> Result) -> Result { + return analysis( + ifSuccess: { _ in self }, + ifFailure: { _ in result() }) + } + + // MARK: Errors + + /// The domain for errors constructed by Result. + public static var errorDomain: String { return "com.antitypical.Result" } + + /// The userInfo key for source functions in errors constructed by Result. + public static var functionKey: String { return "\(errorDomain).function" } + + /// The userInfo key for source file paths in errors constructed by Result. + public static var fileKey: String { return "\(errorDomain).file" } + + /// The userInfo key for source file line numbers in errors constructed by Result. + public static var lineKey: String { return "\(errorDomain).line" } + + /// Constructs an error. + public static func error(message: String? = nil, function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__) -> NSError { + var userInfo: [String: AnyObject] = [ + functionKey: function, + fileKey: file, + lineKey: line, + ] + + if let message = message { + userInfo[NSLocalizedDescriptionKey] = message + } + + return NSError(domain: errorDomain, code: 0, userInfo: userInfo) + } + + + // MARK: CustomStringConvertible + + public var description: String { + return analysis( + ifSuccess: { ".Success(\($0))" }, + ifFailure: { ".Failure(\($0))" }) + } + + + // MARK: CustomDebugStringConvertible + + public var debugDescription: String { + return description + } +} + + +/// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. +public func == (left: Result, right: Result) -> Bool { + if let left = left.value, right = right.value { + return left == right + } else if let left = left.error, right = right.error { + return left == right + } + return false +} + +/// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. +public func != (left: Result, right: Result) -> Bool { + return !(left == right) +} + + +/// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits. +public func ?? (left: Result, @autoclosure right: () -> T) -> T { + return left.recover(right()) +} + +/// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits. +public func ?? (left: Result, @autoclosure right: () -> Result) -> Result { + return left.recoverWith(right()) +} + +// MARK: - Derive result from failable closure + +public func materialize(f: () throws -> T) -> Result { + return materialize(try f()) +} + +public func materialize(@autoclosure f: () throws -> T) -> Result { + do { + return .Success(try f()) + } catch { + return .Failure(error as NSError) + } +} + +// MARK: - Cocoa API conveniences + +/// Constructs a Result with the result of calling `try` with an error pointer. +/// +/// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.: +/// +/// Result.try { NSData(contentsOfURL: URL, options: .DataReadingMapped, error: $0) } +public func `try`(function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__, `try`: NSErrorPointer -> T?) -> Result { + var error: NSError? + return `try`(&error).map(Result.Success) ?? .Failure(error ?? Result.error(function: function, file: file, line: line)) +} + +/// Constructs a Result with the result of calling `try` with an error pointer. +/// +/// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: +/// +/// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } +public func `try`(function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__, `try`: NSErrorPointer -> Bool) -> Result<(), NSError> { + var error: NSError? + return `try`(&error) ? + .Success(()) + : .Failure(error ?? Result<(), NSError>.error(function: function, file: file, line: line)) +} + + +// MARK: - Operators + +infix operator >>- { + // Left-associativity so that chaining works like you’d expect, and for consistency with Haskell, Runes, swiftz, etc. + associativity left + + // Higher precedence than function application, but lower than function composition. + precedence 100 +} + +/// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. +/// +/// This is a synonym for `flatMap`. +public func >>- (result: Result, @noescape transform: T -> Result) -> Result { + return result.flatMap(transform) +} + + +import Foundation diff --git a/Examples/Custom Money/Pods/Result/Result/ResultType.swift b/Examples/Custom Money/Pods/Result/Result/ResultType.swift new file mode 100644 index 0000000..f445a32 --- /dev/null +++ b/Examples/Custom Money/Pods/Result/Result/ResultType.swift @@ -0,0 +1,80 @@ +// Copyright (c) 2015 Rob Rix. All rights reserved. + +/// A type that can represent either failure with an error or success with a result value. +public protocol ResultType { + typealias Value + typealias Error: ErrorType + + /// Constructs a successful result wrapping a `value`. + init(value: Value) + + /// Constructs a failed result wrapping an `error`. + init(error: Error) + + /// Case analysis for ResultType. + /// + /// Returns the value produced by appliying `ifFailure` to the error if self represents a failure, or `ifSuccess` to the result value if self represents a success. + func analysis(@noescape ifSuccess ifSuccess: Value -> U, @noescape ifFailure: Error -> U) -> U + + /// Returns the value if self represents a success, `nil` otherwise. + /// + /// A default implementation is provided by a protocol extension. Conforming types may specialize it. + var value: Value? { get } + + /// Returns the error if self represents a failure, `nil` otherwise. + /// + /// A default implementation is provided by a protocol extension. Conforming types may specialize it. + var error: Error? { get } +} + +public extension ResultType { + + /// Returns the value if self represents a success, `nil` otherwise. + public var value: Value? { + return analysis(ifSuccess: { $0 }, ifFailure: { _ in nil }) + } + + /// Returns the error if self represents a failure, `nil` otherwise. + public var error: Error? { + return analysis(ifSuccess: { _ in nil }, ifFailure: { $0 }) + } + + /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors. + public func map(@noescape transform: Value -> U) -> Result { + return flatMap { .Success(transform($0)) } + } + + /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. + public func flatMap(@noescape transform: Value -> Result) -> Result { + return analysis( + ifSuccess: transform, + ifFailure: Result.Failure) + } + + /// Returns a new Result by mapping `Failure`'s values using `transform`, or re-wrapping `Success`es’ values. + public func mapError(@noescape transform: Error -> Error2) -> Result { + return flatMapError { .Failure(transform($0)) } + } + + /// Returns the result of applying `transform` to `Failure`’s errors, or re-wrapping `Success`es’ values. + public func flatMapError(@noescape transform: Error -> Result) -> Result { + return analysis( + ifSuccess: Result.Success, + ifFailure: transform) + } +} + +// MARK: - Operators + +infix operator &&& { + /// Same associativity as &&. + associativity left + + /// Same precedence as &&. + precedence 120 +} + +/// Returns a Result with a tuple of `left` and `right` values if both are `Success`es, or re-wrapping the error of the earlier `Failure`. +public func &&& (left: L, @autoclosure right: () -> R) -> Result<(L.Value, R.Value), L.Error> { + return left.flatMap { left in right().map { right in (left, right) } } +} diff --git a/Examples/Custom Money/Pods/SwiftyJSON/LICENSE b/Examples/Custom Money/Pods/SwiftyJSON/LICENSE new file mode 100644 index 0000000..a7af196 --- /dev/null +++ b/Examples/Custom Money/Pods/SwiftyJSON/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ruoyu Fu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Examples/Custom Money/Pods/SwiftyJSON/README.md b/Examples/Custom Money/Pods/SwiftyJSON/README.md new file mode 100644 index 0000000..20058d1 --- /dev/null +++ b/Examples/Custom Money/Pods/SwiftyJSON/README.md @@ -0,0 +1,379 @@ +#SwiftyJSON [中文介绍](http://tangplin.github.io/swiftyjson/) + +SwiftyJSON makes it easy to deal with JSON data in Swift. + +1. [Why is the typical JSON handling in Swift NOT good](#why-is-the-typical-json-handling-in-swift-not-good) +1. [Requirements](#requirements) +1. [Integration](#integration) +1. [Usage](#usage) + - [Initialization](#initialization) + - [Subscript](#subscript) + - [Loop](#loop) + - [Error](#error) + - [Optional getter](#optional-getter) + - [Non-optional getter](#non-optional-getter) + - [Setter](#setter) + - [Raw object](#raw-object) + - [Literal convertibles](#literal-convertibles) +1. [Work with Alamofire](#work-with-alamofire) + +##Why is the typical JSON handling in Swift NOT good? +Swift is very strict about types. But although explicit typing is good for saving us from mistakes, it becomes painful when dealing with JSON and other areas that are, by nature, implicit about types. + +Take the Twitter API for example. Say we want to retrieve a user's "name" value of some tweet in Swift (according to Twitter's API https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline). + +The code would look like this: + +```swift + +let JSONObject: AnyObject? = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) + +if let statusesArray = JSONObject as? [AnyObject], + let status = statusesArray[0] as? [String: AnyObject], + let user = status["user"] as? [String: AnyObject], + let username = user["name"] as? String { + // Finally we got the username +} + +``` + +It's not good. + +Even if we use optional chaining, it would be messy: + +```swift + +let JSONObject: AnyObject? = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) + +if let username = (((JSONObject as? [AnyObject])?[0] as? [String: AnyObject])?["user"] as? [String: AnyObject])?["name"] as? String { + // What a disaster +} + +``` +An unreadable mess--for something that should really be simple! + +With SwiftyJSON all you have to do is: + +```swift + +let json = JSON(data: dataFromNetworking) +if let userName = json[0]["user"]["name"].string { + //Now you got your value +} + +``` + +And don't worry about the Optional Wrapping thing. It's done for you automatically. + +```swift + +let json = JSON(data: dataFromNetworking) +if let userName = json[999999]["wrong_key"]["wrong_name"].string { + //Calm down, take it easy, the ".string" property still produces the correct Optional String type with safety +} else { + //Print the error + print(json[999999]["wrong_key"]["wrong_name"]) +} + +``` + +## Requirements + +- iOS 7.0+ / Mac OS X 10.9+ +- Xcode 7 + +##Integration + +####CocoaPods (iOS 8+, OS X 10.9+) +You can use [Cocoapods](http://cocoapods.org/) to install `SwiftyJSON`by adding it to your `Podfile`: +```ruby +platform :ios, '8.0' +use_frameworks! + +target 'MyApp' do + pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git' +end +``` +Note that this requires CocoaPods version 36, and your iOS deployment target to be at least 8.0: + +####Carthage (iOS 8+, OS X 10.9+) +You can use [Carthage](https://github.com/Carthage/Carthage) to install `SwiftyJSON` by adding it to your `Cartfile`: +``` +github "SwiftyJSON/SwiftyJSON" +``` + +####Manually (iOS 7+, OS X 10.9+) + +To use this library in your project manually you may: + +1. for Projects, just drag SwiftyJSON.swift to the project tree +2. for Workspaces, include the whole SwiftyJSON.xcodeproj + +## Usage + +####Initialization +```swift +import SwiftyJSON +``` +```swift +let json = JSON(data: dataFromNetworking) +``` +```swift +let json = JSON(jsonObject) +``` +```swift +if let dataFromString = jsonString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) { + let json = JSON(data: dataFromString) +} +``` + +####Subscript +```swift +//Getting a double from a JSON Array +let name = json[0].double +``` +```swift +//Getting a string from a JSON Dictionary +let name = json["name"].stringValue +``` +```swift +//Getting a string using a path to the element +let path = [1,"list",2,"name"] +let name = json[path].string +//Just the same +let name = json[1]["list"][2]["name"].string +//Alternatively +let name = json[1,"list",2,"name"].string +``` +```swift +//With a hard way +let name = json[].string +``` +```swift +//With a custom way +let keys:[SubscriptType] = [1,"list",2,"name"] +let name = json[keys].string +``` +####Loop +```swift +//If json is .Dictionary +for (key,subJson):(String, JSON) in json { + //Do something you want +} +``` +*The first element is always a String, even if the JSON is an Array* +```swift +//If json is .Array +//The `index` is 0.. = json["list"].arrayValue +``` +```swift +//If not a Dictionary or nil, return [:] +let user: Dictionary = json["user"].dictionaryValue +``` + +####Setter +```swift +json["name"] = JSON("new-name") +json[0] = JSON(1) +``` +```swift +json["id"].int = 1234567890 +json["coordinate"].double = 8766.766 +json["name"].string = "Jack" +json.arrayObject = [1,2,3,4] +json.dictionary = ["name":"Jack", "age":25] +``` + +####Raw object +```swift +let jsonObject: AnyObject = json.object +``` +```swift +if let jsonObject: AnyObject = json.rawValue +``` +```swift +//convert the JSON to raw NSData +if let data = json.rawData() { + //Do something you want +} +``` +```swift +//convert the JSON to a raw String +if let string = json.rawString() { + //Do something you want +} + +####Existance +```swift +//shows you whether value specified in JSON or not +if json["name"].isExists() +``` +``` +####Literal convertibles +For more info about literal convertibles: [Swift Literal Convertibles](http://nshipster.com/swift-literal-convertible/) +```swift +//StringLiteralConvertible +let json: JSON = "I'm a json" +``` +```swift +//IntegerLiteralConvertible +let json: JSON = 12345 +``` +```swift +//BooleanLiteralConvertible +let json: JSON = true +``` +```swift +//FloatLiteralConvertible +let json: JSON = 2.8765 +``` +```swift +//DictionaryLiteralConvertible +let json: JSON = ["I":"am", "a":"json"] +``` +```swift +//ArrayLiteralConvertible +let json: JSON = ["I", "am", "a", "json"] +``` +```swift +//NilLiteralConvertible +let json: JSON = nil +``` +```swift +//With subscript in array +var json: JSON = [1,2,3] +json[0] = 100 +json[1] = 200 +json[2] = 300 +json[999] = 300 //Don't worry, nothing will happen +``` +```swift +//With subscript in dictionary +var json: JSON = ["name": "Jack", "age": 25] +json["name"] = "Mike" +json["age"] = "25" //It's OK to set String +json["address"] = "L.A." // Add the "address": "L.A." in json +``` +```swift +//Array & Dictionary +var json: JSON = ["name": "Jack", "age": 25, "list": ["a", "b", "c", ["what": "this"]]] +json["list"][3]["what"] = "that" +json["list",3,"what"] = "that" +let path = ["list",3,"what"] +json[path] = "that" +``` +##Work with Alamofire + +SwiftyJSON nicely wraps the result of the Alamofire JSON response handler: +```swift +Alamofire.request(.GET, url, parameters: parameters) + .responseJSON { (req, res, json, error) in + if(error != nil) { + NSLog("Error: \(error)") + print(req) + print(res) + } + else { + NSLog("Success: \(url)") + var json = JSON(json!) + } + } +``` diff --git a/Examples/Custom Money/Pods/SwiftyJSON/Source/SwiftyJSON.swift b/Examples/Custom Money/Pods/SwiftyJSON/Source/SwiftyJSON.swift new file mode 100644 index 0000000..a63ef84 --- /dev/null +++ b/Examples/Custom Money/Pods/SwiftyJSON/Source/SwiftyJSON.swift @@ -0,0 +1,1352 @@ +// SwiftyJSON.swift +// +// Copyright (c) 2014 Ruoyu Fu, Pinglin Tang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +// MARK: - Error + +///Error domain +public let ErrorDomain: String! = "SwiftyJSONErrorDomain" + +///Error code +public let ErrorUnsupportedType: Int! = 999 +public let ErrorIndexOutOfBounds: Int! = 900 +public let ErrorWrongType: Int! = 901 +public let ErrorNotExist: Int! = 500 +public let ErrorInvalidJSON: Int! = 490 + +// MARK: - JSON Type + +/** +JSON's type definitions. + +See http://tools.ietf.org/html/rfc7231#section-4.3 +*/ +public enum Type :Int{ + + case Number + case String + case Bool + case Array + case Dictionary + case Null + case Unknown +} + +// MARK: - JSON Base + +public struct JSON { + + /** + Creates a JSON using the data. + + - parameter data: The NSData used to convert to json.Top level object in data is an NSArray or NSDictionary + - parameter opt: The JSON serialization reading options. `.AllowFragments` by default. + - parameter error: error The NSErrorPointer used to return the error. `nil` by default. + + - returns: The created JSON + */ + public init(data:NSData, options opt: NSJSONReadingOptions = .AllowFragments, error: NSErrorPointer = nil) { + do { + let object: AnyObject = try NSJSONSerialization.JSONObjectWithData(data, options: opt) + self.init(object) + } catch let aError as NSError { + if error != nil { + error.memory = aError + } + self.init(NSNull()) + } + } + + /** + Creates a JSON using the object. + + - parameter object: The object must have the following properties: All objects are NSString/String, NSNumber/Int/Float/Double/Bool, NSArray/Array, NSDictionary/Dictionary, or NSNull; All dictionary keys are NSStrings/String; NSNumbers are not NaN or infinity. + + - returns: The created JSON + */ + public init(_ object: AnyObject) { + self.object = object + } + + /** + Creates a JSON from a [JSON] + + - parameter jsonArray: A Swift array of JSON objects + + - returns: The created JSON + */ + public init(_ jsonArray:[JSON]) { + self.init(jsonArray.map { $0.object }) + } + + /** + Creates a JSON from a [String: JSON] + + - parameter jsonDictionary: A Swift dictionary of JSON objects + + - returns: The created JSON + */ + public init(_ jsonDictionary:[String: JSON]) { + var dictionary = [String: AnyObject]() + for (key, json) in jsonDictionary { + dictionary[key] = json.object + } + self.init(dictionary) + } + + /// Private object + private var rawArray: [AnyObject] = [] + private var rawDictionary: [String : AnyObject] = [:] + private var rawString: String = "" + private var rawNumber: NSNumber = 0 + private var rawNull: NSNull = NSNull() + /// Private type + private var _type: Type = .Null + /// prviate error + private var _error: NSError? = nil + + /// Object in JSON + public var object: AnyObject { + get { + switch self.type { + case .Array: + return self.rawArray + case .Dictionary: + return self.rawDictionary + case .String: + return self.rawString + case .Number: + return self.rawNumber + case .Bool: + return self.rawNumber + default: + return self.rawNull + } + } + set { + _error = nil + switch newValue { + case let number as NSNumber: + if number.isBool { + _type = .Bool + } else { + _type = .Number + } + self.rawNumber = number + case let string as String: + _type = .String + self.rawString = string + case _ as NSNull: + _type = .Null + case let array as [AnyObject]: + _type = .Array + self.rawArray = array + case let dictionary as [String : AnyObject]: + _type = .Dictionary + self.rawDictionary = dictionary + default: + _type = .Unknown + _error = NSError(domain: ErrorDomain, code: ErrorUnsupportedType, userInfo: [NSLocalizedDescriptionKey: "It is a unsupported type"]) + } + } + } + + /// json type + public var type: Type { get { return _type } } + + /// Error in JSON + public var error: NSError? { get { return self._error } } + + /// The static null json + @available(*, unavailable, renamed="null") + public static var nullJSON: JSON { get { return null } } + public static var null: JSON { get { return JSON(NSNull()) } } +} + +// MARK: - CollectionType, SequenceType, Indexable +extension JSON : Swift.CollectionType, Swift.SequenceType, Swift.Indexable { + + public typealias Generator = JSONGenerator + + public typealias Index = JSONIndex + + public var startIndex: JSON.Index { + switch self.type { + case .Array: + return JSONIndex(arrayIndex: self.rawArray.startIndex) + case .Dictionary: + return JSONIndex(dictionaryIndex: self.rawDictionary.startIndex) + default: + return JSONIndex() + } + } + + public var endIndex: JSON.Index { + switch self.type { + case .Array: + return JSONIndex(arrayIndex: self.rawArray.endIndex) + case .Dictionary: + return JSONIndex(dictionaryIndex: self.rawDictionary.endIndex) + default: + return JSONIndex() + } + } + + public subscript (position: JSON.Index) -> JSON.Generator.Element { + switch self.type { + case .Array: + return (String(position.arrayIndex), JSON(self.rawArray[position.arrayIndex!])) + case .Dictionary: + let (key, value) = self.rawDictionary[position.dictionaryIndex!] + return (key, JSON(value)) + default: + return ("", JSON.null) + } + } + + /// If `type` is `.Array` or `.Dictionary`, return `array.empty` or `dictonary.empty` otherwise return `false`. + public var isEmpty: Bool { + get { + switch self.type { + case .Array: + return self.rawArray.isEmpty + case .Dictionary: + return self.rawDictionary.isEmpty + default: + return true + } + } + } + + /// If `type` is `.Array` or `.Dictionary`, return `array.count` or `dictonary.count` otherwise return `0`. + public var count: Int { + switch self.type { + case .Array: + return self.rawArray.count + case .Dictionary: + return self.rawDictionary.count + default: + return 0 + } + } + + public func underestimateCount() -> Int { + switch self.type { + case .Array: + return self.rawArray.underestimateCount() + case .Dictionary: + return self.rawDictionary.underestimateCount() + default: + return 0 + } + } + + /** + If `type` is `.Array` or `.Dictionary`, return a generator over the elements like `Array` or `Dictionary`, otherwise return a generator over empty. + + - returns: Return a *generator* over the elements of JSON. + */ + public func generate() -> JSON.Generator { + return JSON.Generator(self) + } +} + +public struct JSONIndex: ForwardIndexType, _Incrementable, Equatable, Comparable { + + let arrayIndex: Int? + let dictionaryIndex: DictionaryIndex? + + let type: Type + + init(){ + self.arrayIndex = nil + self.dictionaryIndex = nil + self.type = .Unknown + } + + init(arrayIndex: Int) { + self.arrayIndex = arrayIndex + self.dictionaryIndex = nil + self.type = .Array + } + + init(dictionaryIndex: DictionaryIndex) { + self.arrayIndex = nil + self.dictionaryIndex = dictionaryIndex + self.type = .Dictionary + } + + public func successor() -> JSONIndex { + switch self.type { + case .Array: + return JSONIndex(arrayIndex: self.arrayIndex!.successor()) + case .Dictionary: + return JSONIndex(dictionaryIndex: self.dictionaryIndex!.successor()) + default: + return JSONIndex() + } + } +} + +public func ==(lhs: JSONIndex, rhs: JSONIndex) -> Bool { + switch (lhs.type, rhs.type) { + case (.Array, .Array): + return lhs.arrayIndex == rhs.arrayIndex + case (.Dictionary, .Dictionary): + return lhs.dictionaryIndex == rhs.dictionaryIndex + default: + return false + } +} + +public func <(lhs: JSONIndex, rhs: JSONIndex) -> Bool { + switch (lhs.type, rhs.type) { + case (.Array, .Array): + return lhs.arrayIndex < rhs.arrayIndex + case (.Dictionary, .Dictionary): + return lhs.dictionaryIndex < rhs.dictionaryIndex + default: + return false + } +} + +public func <=(lhs: JSONIndex, rhs: JSONIndex) -> Bool { + switch (lhs.type, rhs.type) { + case (.Array, .Array): + return lhs.arrayIndex <= rhs.arrayIndex + case (.Dictionary, .Dictionary): + return lhs.dictionaryIndex <= rhs.dictionaryIndex + default: + return false + } +} + +public func >=(lhs: JSONIndex, rhs: JSONIndex) -> Bool { + switch (lhs.type, rhs.type) { + case (.Array, .Array): + return lhs.arrayIndex >= rhs.arrayIndex + case (.Dictionary, .Dictionary): + return lhs.dictionaryIndex >= rhs.dictionaryIndex + default: + return false + } +} + +public func >(lhs: JSONIndex, rhs: JSONIndex) -> Bool { + switch (lhs.type, rhs.type) { + case (.Array, .Array): + return lhs.arrayIndex > rhs.arrayIndex + case (.Dictionary, .Dictionary): + return lhs.dictionaryIndex > rhs.dictionaryIndex + default: + return false + } +} + +public struct JSONGenerator : GeneratorType { + + public typealias Element = (String, JSON) + + private let type: Type + private var dictionayGenerate: DictionaryGenerator? + private var arrayGenerate: IndexingGenerator<[AnyObject]>? + private var arrayIndex: Int = 0 + + init(_ json: JSON) { + self.type = json.type + if type == .Array { + self.arrayGenerate = json.rawArray.generate() + }else { + self.dictionayGenerate = json.rawDictionary.generate() + } + } + + public mutating func next() -> JSONGenerator.Element? { + switch self.type { + case .Array: + if let o = self.arrayGenerate!.next() { + return (String(self.arrayIndex++), JSON(o)) + } else { + return nil + } + case .Dictionary: + if let (k, v): (String, AnyObject) = self.dictionayGenerate!.next() { + return (k, JSON(v)) + } else { + return nil + } + default: + return nil + } + } +} + +// MARK: - Subscript + +/** +* To mark both String and Int can be used in subscript. +*/ +public protocol JSONSubscriptType {} + +extension Int: JSONSubscriptType {} + +extension String: JSONSubscriptType {} + +extension JSON { + + /// If `type` is `.Array`, return json which's object is `array[index]`, otherwise return null json with error. + private subscript(index index: Int) -> JSON { + get { + if self.type != .Array { + var r = JSON.null + r._error = self._error ?? NSError(domain: ErrorDomain, code: ErrorWrongType, userInfo: [NSLocalizedDescriptionKey: "Array[\(index)] failure, It is not an array"]) + return r + } else if index >= 0 && index < self.rawArray.count { + return JSON(self.rawArray[index]) + } else { + var r = JSON.null + r._error = NSError(domain: ErrorDomain, code:ErrorIndexOutOfBounds , userInfo: [NSLocalizedDescriptionKey: "Array[\(index)] is out of bounds"]) + return r + } + } + set { + if self.type == .Array { + if self.rawArray.count > index && newValue.error == nil { + self.rawArray[index] = newValue.object + } + } + } + } + + /// If `type` is `.Dictionary`, return json which's object is `dictionary[key]` , otherwise return null json with error. + private subscript(key key: String) -> JSON { + get { + var r = JSON.null + if self.type == .Dictionary { + if let o = self.rawDictionary[key] { + r = JSON(o) + } else { + r._error = NSError(domain: ErrorDomain, code: ErrorNotExist, userInfo: [NSLocalizedDescriptionKey: "Dictionary[\"\(key)\"] does not exist"]) + } + } else { + r._error = self._error ?? NSError(domain: ErrorDomain, code: ErrorWrongType, userInfo: [NSLocalizedDescriptionKey: "Dictionary[\"\(key)\"] failure, It is not an dictionary"]) + } + return r + } + set { + if self.type == .Dictionary && newValue.error == nil { + self.rawDictionary[key] = newValue.object + } + } + } + + /// If `sub` is `Int`, return `subscript(index:)`; If `sub` is `String`, return `subscript(key:)`. + private subscript(sub sub: JSONSubscriptType) -> JSON { + get { + if sub is String { + return self[key:sub as! String] + } else { + return self[index:sub as! Int] + } + } + set { + if sub is String { + self[key:sub as! String] = newValue + } else { + self[index:sub as! Int] = newValue + } + } + } + + /** + Find a json in the complex data structuresby using the Int/String's array. + + - parameter path: The target json's path. Example: + + let json = JSON[data] + let path = [9,"list","person","name"] + let name = json[path] + + The same as: let name = json[9]["list"]["person"]["name"] + + - returns: Return a json found by the path or a null json with error + */ + public subscript(path: [JSONSubscriptType]) -> JSON { + get { + return path.reduce(self) { $0[sub: $1] } + } + set { + switch path.count { + case 0: + return + case 1: + self[sub:path[0]].object = newValue.object + default: + var aPath = path; aPath.removeAtIndex(0) + var nextJSON = self[sub: path[0]] + nextJSON[aPath] = newValue + self[sub: path[0]] = nextJSON + } + } + } + + /** + Find a json in the complex data structuresby using the Int/String's array. + + - parameter path: The target json's path. Example: + + let name = json[9,"list","person","name"] + + The same as: let name = json[9]["list"]["person"]["name"] + + - returns: Return a json found by the path or a null json with error + */ + public subscript(path: JSONSubscriptType...) -> JSON { + get { + return self[path] + } + set { + self[path] = newValue + } + } +} + +// MARK: - LiteralConvertible + +extension JSON: Swift.StringLiteralConvertible { + + public init(stringLiteral value: StringLiteralType) { + self.init(value) + } + + public init(extendedGraphemeClusterLiteral value: StringLiteralType) { + self.init(value) + } + + public init(unicodeScalarLiteral value: StringLiteralType) { + self.init(value) + } +} + +extension JSON: Swift.IntegerLiteralConvertible { + + public init(integerLiteral value: IntegerLiteralType) { + self.init(value) + } +} + +extension JSON: Swift.BooleanLiteralConvertible { + + public init(booleanLiteral value: BooleanLiteralType) { + self.init(value) + } +} + +extension JSON: Swift.FloatLiteralConvertible { + + public init(floatLiteral value: FloatLiteralType) { + self.init(value) + } +} + +extension JSON: Swift.DictionaryLiteralConvertible { + + public init(dictionaryLiteral elements: (String, AnyObject)...) { + self.init(elements.reduce([String : AnyObject]()){(dictionary: [String : AnyObject], element:(String, AnyObject)) -> [String : AnyObject] in + var d = dictionary + d[element.0] = element.1 + return d + }) + } +} + +extension JSON: Swift.ArrayLiteralConvertible { + + public init(arrayLiteral elements: AnyObject...) { + self.init(elements) + } +} + +extension JSON: Swift.NilLiteralConvertible { + + public init(nilLiteral: ()) { + self.init(NSNull()) + } +} + +// MARK: - Raw + +extension JSON: Swift.RawRepresentable { + + public init?(rawValue: AnyObject) { + if JSON(rawValue).type == .Unknown { + return nil + } else { + self.init(rawValue) + } + } + + public var rawValue: AnyObject { + return self.object + } + + public func rawData(options opt: NSJSONWritingOptions = NSJSONWritingOptions(rawValue: 0)) throws -> NSData { + guard NSJSONSerialization.isValidJSONObject(self.object) else { + throw NSError(domain: ErrorDomain, code: ErrorInvalidJSON, userInfo: [NSLocalizedDescriptionKey: "JSON is invalid"]) + } + + return try NSJSONSerialization.dataWithJSONObject(self.object, options: opt) + } + + public func rawString(encoding: UInt = NSUTF8StringEncoding, options opt: NSJSONWritingOptions = .PrettyPrinted) -> String? { + switch self.type { + case .Array, .Dictionary: + do { + let data = try self.rawData(options: opt) + return NSString(data: data, encoding: encoding) as? String + } catch _ { + return nil + } + case .String: + return self.rawString + case .Number: + return self.rawNumber.stringValue + case .Bool: + return self.rawNumber.boolValue.description + case .Null: + return "null" + default: + return nil + } + } +} + +// MARK: - Printable, DebugPrintable + +extension JSON: Swift.Printable, Swift.DebugPrintable { + + public var description: String { + if let string = self.rawString(options:.PrettyPrinted) { + return string + } else { + return "unknown" + } + } + + public var debugDescription: String { + return description + } +} + +// MARK: - Array + +extension JSON { + + //Optional [JSON] + public var array: [JSON]? { + get { + if self.type == .Array { + return self.rawArray.map{ JSON($0) } + } else { + return nil + } + } + } + + //Non-optional [JSON] + public var arrayValue: [JSON] { + get { + return self.array ?? [] + } + } + + //Optional [AnyObject] + public var arrayObject: [AnyObject]? { + get { + switch self.type { + case .Array: + return self.rawArray + default: + return nil + } + } + set { + if let array = newValue { + self.object = array + } else { + self.object = NSNull() + } + } + } +} + +// MARK: - Dictionary + +extension JSON { + + //Optional [String : JSON] + public var dictionary: [String : JSON]? { + if self.type == .Dictionary { + return self.rawDictionary.reduce([String : JSON]()) { (dictionary: [String : JSON], element: (String, AnyObject)) -> [String : JSON] in + var d = dictionary + d[element.0] = JSON(element.1) + return d + } + } else { + return nil + } + } + + //Non-optional [String : JSON] + public var dictionaryValue: [String : JSON] { + return self.dictionary ?? [:] + } + + //Optional [String : AnyObject] + public var dictionaryObject: [String : AnyObject]? { + get { + switch self.type { + case .Dictionary: + return self.rawDictionary + default: + return nil + } + } + set { + if let v = newValue { + self.object = v + } else { + self.object = NSNull() + } + } + } +} + +// MARK: - Bool + +extension JSON: Swift.BooleanType { + + //Optional bool + public var bool: Bool? { + get { + switch self.type { + case .Bool: + return self.rawNumber.boolValue + default: + return nil + } + } + set { + if newValue != nil { + self.object = NSNumber(bool: newValue!) + } else { + self.object = NSNull() + } + } + } + + //Non-optional bool + public var boolValue: Bool { + get { + switch self.type { + case .Bool, .Number, .String: + return self.object.boolValue + default: + return false + } + } + set { + self.object = NSNumber(bool: newValue) + } + } +} + +// MARK: - String + +extension JSON { + + //Optional string + public var string: String? { + get { + switch self.type { + case .String: + return self.object as? String + default: + return nil + } + } + set { + if newValue != nil { + self.object = NSString(string:newValue!) + } else { + self.object = NSNull() + } + } + } + + //Non-optional string + public var stringValue: String { + get { + switch self.type { + case .String: + return self.object as! String + case .Number: + return self.object.stringValue + case .Bool: + return (self.object as! Bool).description + default: + return "" + } + } + set { + self.object = NSString(string:newValue) + } + } +} + +// MARK: - Number +extension JSON { + + //Optional number + public var number: NSNumber? { + get { + switch self.type { + case .Number, .Bool: + return self.rawNumber + default: + return nil + } + } + set { + self.object = newValue ?? NSNull() + } + } + + //Non-optional number + public var numberValue: NSNumber { + get { + switch self.type { + case .String: + let decimal = NSDecimalNumber(string: self.object as? String) + if decimal == NSDecimalNumber.notANumber() { // indicates parse error + return NSDecimalNumber.zero() + } + return decimal + case .Number, .Bool: + return self.object as! NSNumber + default: + return NSNumber(double: 0.0) + } + } + set { + self.object = newValue + } + } +} + +//MARK: - Null +extension JSON { + + public var null: NSNull? { + get { + switch self.type { + case .Null: + return self.rawNull + default: + return nil + } + } + set { + self.object = NSNull() + } + } + public func isExists() -> Bool{ + if let errorValue = error where errorValue.code == ErrorNotExist{ + return false + } + return true + } +} + +//MARK: - URL +extension JSON { + + //Optional URL + public var URL: NSURL? { + get { + switch self.type { + case .String: + if let encodedString_ = self.rawString.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet()) { + return NSURL(string: encodedString_) + } else { + return nil + } + default: + return nil + } + } + set { + self.object = newValue?.absoluteString ?? NSNull() + } + } +} + +// MARK: - Int, Double, Float, Int8, Int16, Int32, Int64 + +extension JSON { + + public var double: Double? { + get { + return self.number?.doubleValue + } + set { + if newValue != nil { + self.object = NSNumber(double: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var doubleValue: Double { + get { + return self.numberValue.doubleValue + } + set { + self.object = NSNumber(double: newValue) + } + } + + public var float: Float? { + get { + return self.number?.floatValue + } + set { + if newValue != nil { + self.object = NSNumber(float: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var floatValue: Float { + get { + return self.numberValue.floatValue + } + set { + self.object = NSNumber(float: newValue) + } + } + + public var int: Int? { + get { + return self.number?.longValue + } + set { + if newValue != nil { + self.object = NSNumber(integer: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var intValue: Int { + get { + return self.numberValue.integerValue + } + set { + self.object = NSNumber(integer: newValue) + } + } + + public var uInt: UInt? { + get { + return self.number?.unsignedLongValue + } + set { + if newValue != nil { + self.object = NSNumber(unsignedLong: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var uIntValue: UInt { + get { + return self.numberValue.unsignedLongValue + } + set { + self.object = NSNumber(unsignedLong: newValue) + } + } + + public var int8: Int8? { + get { + return self.number?.charValue + } + set { + if newValue != nil { + self.object = NSNumber(char: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var int8Value: Int8 { + get { + return self.numberValue.charValue + } + set { + self.object = NSNumber(char: newValue) + } + } + + public var uInt8: UInt8? { + get { + return self.number?.unsignedCharValue + } + set { + if newValue != nil { + self.object = NSNumber(unsignedChar: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var uInt8Value: UInt8 { + get { + return self.numberValue.unsignedCharValue + } + set { + self.object = NSNumber(unsignedChar: newValue) + } + } + + public var int16: Int16? { + get { + return self.number?.shortValue + } + set { + if newValue != nil { + self.object = NSNumber(short: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var int16Value: Int16 { + get { + return self.numberValue.shortValue + } + set { + self.object = NSNumber(short: newValue) + } + } + + public var uInt16: UInt16? { + get { + return self.number?.unsignedShortValue + } + set { + if newValue != nil { + self.object = NSNumber(unsignedShort: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var uInt16Value: UInt16 { + get { + return self.numberValue.unsignedShortValue + } + set { + self.object = NSNumber(unsignedShort: newValue) + } + } + + public var int32: Int32? { + get { + return self.number?.intValue + } + set { + if newValue != nil { + self.object = NSNumber(int: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var int32Value: Int32 { + get { + return self.numberValue.intValue + } + set { + self.object = NSNumber(int: newValue) + } + } + + public var uInt32: UInt32? { + get { + return self.number?.unsignedIntValue + } + set { + if newValue != nil { + self.object = NSNumber(unsignedInt: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var uInt32Value: UInt32 { + get { + return self.numberValue.unsignedIntValue + } + set { + self.object = NSNumber(unsignedInt: newValue) + } + } + + public var int64: Int64? { + get { + return self.number?.longLongValue + } + set { + if newValue != nil { + self.object = NSNumber(longLong: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var int64Value: Int64 { + get { + return self.numberValue.longLongValue + } + set { + self.object = NSNumber(longLong: newValue) + } + } + + public var uInt64: UInt64? { + get { + return self.number?.unsignedLongLongValue + } + set { + if newValue != nil { + self.object = NSNumber(unsignedLongLong: newValue!) + } else { + self.object = NSNull() + } + } + } + + public var uInt64Value: UInt64 { + get { + return self.numberValue.unsignedLongLongValue + } + set { + self.object = NSNumber(unsignedLongLong: newValue) + } + } +} + +//MARK: - Comparable +extension JSON : Swift.Comparable {} + +public func ==(lhs: JSON, rhs: JSON) -> Bool { + + switch (lhs.type, rhs.type) { + case (.Number, .Number): + return lhs.rawNumber == rhs.rawNumber + case (.String, .String): + return lhs.rawString == rhs.rawString + case (.Bool, .Bool): + return lhs.rawNumber.boolValue == rhs.rawNumber.boolValue + case (.Array, .Array): + return lhs.rawArray as NSArray == rhs.rawArray as NSArray + case (.Dictionary, .Dictionary): + return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary + case (.Null, .Null): + return true + default: + return false + } +} + +public func <=(lhs: JSON, rhs: JSON) -> Bool { + + switch (lhs.type, rhs.type) { + case (.Number, .Number): + return lhs.rawNumber <= rhs.rawNumber + case (.String, .String): + return lhs.rawString <= rhs.rawString + case (.Bool, .Bool): + return lhs.rawNumber.boolValue == rhs.rawNumber.boolValue + case (.Array, .Array): + return lhs.rawArray as NSArray == rhs.rawArray as NSArray + case (.Dictionary, .Dictionary): + return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary + case (.Null, .Null): + return true + default: + return false + } +} + +public func >=(lhs: JSON, rhs: JSON) -> Bool { + + switch (lhs.type, rhs.type) { + case (.Number, .Number): + return lhs.rawNumber >= rhs.rawNumber + case (.String, .String): + return lhs.rawString >= rhs.rawString + case (.Bool, .Bool): + return lhs.rawNumber.boolValue == rhs.rawNumber.boolValue + case (.Array, .Array): + return lhs.rawArray as NSArray == rhs.rawArray as NSArray + case (.Dictionary, .Dictionary): + return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary + case (.Null, .Null): + return true + default: + return false + } +} + +public func >(lhs: JSON, rhs: JSON) -> Bool { + + switch (lhs.type, rhs.type) { + case (.Number, .Number): + return lhs.rawNumber > rhs.rawNumber + case (.String, .String): + return lhs.rawString > rhs.rawString + default: + return false + } +} + +public func <(lhs: JSON, rhs: JSON) -> Bool { + + switch (lhs.type, rhs.type) { + case (.Number, .Number): + return lhs.rawNumber < rhs.rawNumber + case (.String, .String): + return lhs.rawString < rhs.rawString + default: + return false + } +} + +private let trueNumber = NSNumber(bool: true) +private let falseNumber = NSNumber(bool: false) +private let trueObjCType = String.fromCString(trueNumber.objCType) +private let falseObjCType = String.fromCString(falseNumber.objCType) + +// MARK: - NSNumber: Comparable + +extension NSNumber { + var isBool:Bool { + get { + let objCType = String.fromCString(self.objCType) + if (self.compare(trueNumber) == NSComparisonResult.OrderedSame && objCType == trueObjCType) + || (self.compare(falseNumber) == NSComparisonResult.OrderedSame && objCType == falseObjCType){ + return true + } else { + return false + } + } + } +} + +public func ==(lhs: NSNumber, rhs: NSNumber) -> Bool { + switch (lhs.isBool, rhs.isBool) { + case (false, true): + return false + case (true, false): + return false + default: + return lhs.compare(rhs) == NSComparisonResult.OrderedSame + } +} + +public func !=(lhs: NSNumber, rhs: NSNumber) -> Bool { + return !(lhs == rhs) +} + +public func <(lhs: NSNumber, rhs: NSNumber) -> Bool { + + switch (lhs.isBool, rhs.isBool) { + case (false, true): + return false + case (true, false): + return false + default: + return lhs.compare(rhs) == NSComparisonResult.OrderedAscending + } +} + +public func >(lhs: NSNumber, rhs: NSNumber) -> Bool { + + switch (lhs.isBool, rhs.isBool) { + case (false, true): + return false + case (true, false): + return false + default: + return lhs.compare(rhs) == NSComparisonResult.OrderedDescending + } +} + +public func <=(lhs: NSNumber, rhs: NSNumber) -> Bool { + + switch (lhs.isBool, rhs.isBool) { + case (false, true): + return false + case (true, false): + return false + default: + return lhs.compare(rhs) != NSComparisonResult.OrderedDescending + } +} + +public func >=(lhs: NSNumber, rhs: NSNumber) -> Bool { + + switch (lhs.isBool, rhs.isBool) { + case (false, true): + return false + case (true, false): + return false + default: + return lhs.compare(rhs) != NSComparisonResult.OrderedAscending + } +} diff --git a/Examples/Custom Money/Pods/Target Support Files/Money/Info.plist b/Examples/Custom Money/Pods/Target Support Files/Money/Info.plist new file mode 100644 index 0000000..6974542 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Money/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Examples/Custom Money/Pods/Target Support Files/Money/Money-dummy.m b/Examples/Custom Money/Pods/Target Support Files/Money/Money-dummy.m new file mode 100644 index 0000000..6edf1dd --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Money/Money-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Money : NSObject +@end +@implementation PodsDummy_Money +@end diff --git a/Examples/Custom Money/Pods/Target Support Files/Money/Money-prefix.pch b/Examples/Custom Money/Pods/Target Support Files/Money/Money-prefix.pch new file mode 100644 index 0000000..aa992a4 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Money/Money-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Examples/Custom Money/Pods/Target Support Files/Money/Money-umbrella.h b/Examples/Custom Money/Pods/Target Support Files/Money/Money-umbrella.h new file mode 100644 index 0000000..39c6b56 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Money/Money-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double MoneyVersionNumber; +FOUNDATION_EXPORT const unsigned char MoneyVersionString[]; + diff --git a/Examples/Custom Money/Pods/Target Support Files/Money/Money.modulemap b/Examples/Custom Money/Pods/Target Support Files/Money/Money.modulemap new file mode 100644 index 0000000..473121c --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Money/Money.modulemap @@ -0,0 +1,6 @@ +framework module Money { + umbrella header "Money-umbrella.h" + + export * + module * { export * } +} diff --git a/Examples/Custom Money/Pods/Target Support Files/Money/Money.xcconfig b/Examples/Custom Money/Pods/Target Support Files/Money/Money.xcconfig new file mode 100644 index 0000000..0bebc3e --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Money/Money.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Money" "${PODS_ROOT}/Headers/Public" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_ROOT = ${SRCROOT} +SKIP_INSTALL = YES \ No newline at end of file diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Info.plist b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Info.plist new file mode 100644 index 0000000..6974542 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-acknowledgements.markdown b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-acknowledgements.markdown new file mode 100644 index 0000000..ad95a98 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-acknowledgements.markdown @@ -0,0 +1,104 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## Money + +The MIT License (MIT) + +Copyright (c) 2015 Daniel Thorpe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + +## Result + +The MIT License (MIT) + +Copyright (c) 2014 Rob Rix + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +## SwiftyJSON + +The MIT License (MIT) + +Copyright (c) 2014 Ruoyu Fu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +## ValueCoding + +The MIT License (MIT) + +Copyright (c) 2015 Daniel Thorpe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +Generated by CocoaPods - http://cocoapods.org diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-acknowledgements.plist b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-acknowledgements.plist new file mode 100644 index 0000000..280591b --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-acknowledgements.plist @@ -0,0 +1,146 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2015 Daniel Thorpe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + Title + Money + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2014 Rob Rix + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + Title + Result + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2014 Ruoyu Fu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + Title + SwiftyJSON + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2015 Daniel Thorpe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + Title + ValueCoding + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-dummy.m b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-dummy.m new file mode 100644 index 0000000..dd1664b --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_Custom_Money : NSObject +@end +@implementation PodsDummy_Pods_Custom_Money +@end diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-frameworks.sh b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-frameworks.sh new file mode 100755 index 0000000..0aaaa30 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-frameworks.sh @@ -0,0 +1,97 @@ +#!/bin/sh +set -e + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" + +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + # use filter instead of exclude so missing patterns dont' throw errors + echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" + /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" + fi +} + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + # Get architectures for current file + archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" + stripped="" + for arch in $archs; do + if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi +} + + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "Pods-Custom Money/Money.framework" + install_framework "Pods-Custom Money/Result.framework" + install_framework "Pods-Custom Money/SwiftyJSON.framework" + install_framework "Pods-Custom Money/ValueCoding.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "Pods-Custom Money/Money.framework" + install_framework "Pods-Custom Money/Result.framework" + install_framework "Pods-Custom Money/SwiftyJSON.framework" + install_framework "Pods-Custom Money/ValueCoding.framework" +fi diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-resources.sh b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-resources.sh new file mode 100755 index 0000000..16774fb --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-resources.sh @@ -0,0 +1,95 @@ +#!/bin/sh +set -e + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +realpath() { + DIRECTORY="$(cd "${1%/*}" && pwd)" + FILENAME="${1##*/}" + echo "$DIRECTORY/$FILENAME" +} + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" + xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-umbrella.h b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-umbrella.h new file mode 100644 index 0000000..5ce7f5e --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double Pods_Custom_MoneyVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_Custom_MoneyVersionString[]; + diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.debug.xcconfig b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.debug.xcconfig new file mode 100644 index 0000000..9e21ee8 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.debug.xcconfig @@ -0,0 +1,8 @@ +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Money.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Result.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/SwiftyJSON.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/ValueCoding.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Money" -framework "Result" -framework "SwiftyJSON" -framework "ValueCoding" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Custom Money +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.modulemap b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.modulemap new file mode 100644 index 0000000..f1862f0 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.modulemap @@ -0,0 +1,6 @@ +framework module Pods_Custom_Money { + umbrella header "Pods-Custom Money-umbrella.h" + + export * + module * { export * } +} diff --git a/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.release.xcconfig b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.release.xcconfig new file mode 100644 index 0000000..9e21ee8 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Pods-Custom Money/Pods-Custom Money.release.xcconfig @@ -0,0 +1,8 @@ +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Money.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Result.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/SwiftyJSON.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/ValueCoding.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Money" -framework "Result" -framework "SwiftyJSON" -framework "ValueCoding" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Custom Money +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Examples/Custom Money/Pods/Target Support Files/Result/Info.plist b/Examples/Custom Money/Pods/Target Support Files/Result/Info.plist new file mode 100644 index 0000000..7b20907 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Result/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 0.6.0-beta.6 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Examples/Custom Money/Pods/Target Support Files/Result/Result-dummy.m b/Examples/Custom Money/Pods/Target Support Files/Result/Result-dummy.m new file mode 100644 index 0000000..ba47f61 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Result/Result-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Result : NSObject +@end +@implementation PodsDummy_Result +@end diff --git a/Examples/Custom Money/Pods/Target Support Files/Result/Result-prefix.pch b/Examples/Custom Money/Pods/Target Support Files/Result/Result-prefix.pch new file mode 100644 index 0000000..aa992a4 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Result/Result-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Examples/Custom Money/Pods/Target Support Files/Result/Result-umbrella.h b/Examples/Custom Money/Pods/Target Support Files/Result/Result-umbrella.h new file mode 100644 index 0000000..4575ce0 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Result/Result-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double ResultVersionNumber; +FOUNDATION_EXPORT const unsigned char ResultVersionString[]; + diff --git a/Examples/Custom Money/Pods/Target Support Files/Result/Result.modulemap b/Examples/Custom Money/Pods/Target Support Files/Result/Result.modulemap new file mode 100644 index 0000000..c5e6a4a --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Result/Result.modulemap @@ -0,0 +1,6 @@ +framework module Result { + umbrella header "Result-umbrella.h" + + export * + module * { export * } +} diff --git a/Examples/Custom Money/Pods/Target Support Files/Result/Result.xcconfig b/Examples/Custom Money/Pods/Target Support Files/Result/Result.xcconfig new file mode 100644 index 0000000..6783934 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/Result/Result.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Result" "${PODS_ROOT}/Headers/Public" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_ROOT = ${SRCROOT} +SKIP_INSTALL = YES \ No newline at end of file diff --git a/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/Info.plist b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/Info.plist new file mode 100644 index 0000000..a98a41a --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.3.1 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m new file mode 100644 index 0000000..3159bec --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SwiftyJSON : NSObject +@end +@implementation PodsDummy_SwiftyJSON +@end diff --git a/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch new file mode 100644 index 0000000..aa992a4 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h new file mode 100644 index 0000000..ce00ad0 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double SwiftyJSONVersionNumber; +FOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[]; + diff --git a/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap new file mode 100644 index 0000000..6f41751 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap @@ -0,0 +1,6 @@ +framework module SwiftyJSON { + umbrella header "SwiftyJSON-umbrella.h" + + export * + module * { export * } +} diff --git a/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.xcconfig b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.xcconfig new file mode 100644 index 0000000..6fb4cff --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SwiftyJSON" "${PODS_ROOT}/Headers/Public" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_ROOT = ${SRCROOT} +SKIP_INSTALL = YES \ No newline at end of file diff --git a/Examples/Custom Money/Pods/Target Support Files/ValueCoding/Info.plist b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/Info.plist new file mode 100644 index 0000000..01903d7 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.1.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-dummy.m b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-dummy.m new file mode 100644 index 0000000..afec760 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_ValueCoding : NSObject +@end +@implementation PodsDummy_ValueCoding +@end diff --git a/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-prefix.pch b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-prefix.pch new file mode 100644 index 0000000..aa992a4 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-umbrella.h b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-umbrella.h new file mode 100644 index 0000000..1d8ec40 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double ValueCodingVersionNumber; +FOUNDATION_EXPORT const unsigned char ValueCodingVersionString[]; + diff --git a/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding.modulemap b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding.modulemap new file mode 100644 index 0000000..8438ca5 --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding.modulemap @@ -0,0 +1,6 @@ +framework module ValueCoding { + umbrella header "ValueCoding-umbrella.h" + + export * + module * { export * } +} diff --git a/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding.xcconfig b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding.xcconfig new file mode 100644 index 0000000..417997d --- /dev/null +++ b/Examples/Custom Money/Pods/Target Support Files/ValueCoding/ValueCoding.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/ValueCoding" "${PODS_ROOT}/Headers/Public" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_ROOT = ${SRCROOT} +SKIP_INSTALL = YES \ No newline at end of file diff --git a/Examples/Custom Money/Pods/ValueCoding/LICENSE b/Examples/Custom Money/Pods/ValueCoding/LICENSE new file mode 100644 index 0000000..3bd0a95 --- /dev/null +++ b/Examples/Custom Money/Pods/ValueCoding/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Daniel Thorpe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Examples/Custom Money/Pods/ValueCoding/README.md b/Examples/Custom Money/Pods/ValueCoding/README.md new file mode 100644 index 0000000..18ac72c --- /dev/null +++ b/Examples/Custom Money/Pods/ValueCoding/README.md @@ -0,0 +1,80 @@ +# ValueCoding + +[![Build status](https://badge.buildkite.com/482fd5558d9ccf05b669c55f40450166033522f32314a1bbb2.svg)](https://buildkite.com/blindingskies/valuecoding) +[![codecov.io](http://codecov.io/github/danthorpe/ValueCoding/coverage.svg?branch=development)](http://codecov.io/github/danthorpe/ValueCoding?branch=development) + +ValueCoding is a simple pair of protocols to support the coding of Swift value types. + +It works by allowing a value type, which must conform to `ValueCoding` to define via a typealias its *coder*. The coder is another type which implements the `CoderType` protocol. This type will typically be an `NSObject` which implements `NSCoding` and is an adaptor which is responsible for encoding and decoding the properties of the value. + +A minimal example for a simple `struct` is shown below: + +```swift +import ValueCoding + +struct Foo: ValueCoding { + typealias Coder = FooCoder + let bar: String +} + +class FooCoder: NSObject, NSCoding, CodingType { + + enum Keys: String { + case Bar = "bar" + } + + let value: Foo + + required init(_ v: Foo) { + value = v + } + + required init?(coder aDecoder: NSCoder) { + let bar = aDecoder.decodeObjectForKey(Keys.Bar.rawValue) as? String + value = Foo(bar: bar!) + } + + func encodeWithCoder(aCoder: NSCoder) { + aCoder.encodeObject(value.bar, forKey: Keys.Bar.rawValue) + } +} +``` + +If you are converting existing models from classes to values types, the `NSCoding` methods should look familiar, and hopefully you are able to reuse your existing code. + +The framework provides static methods and properties for types which conform to `ValueCoding` with correct archivers. Therefore, given a value of `Foo`, you can encode it ready for serialization using `NSKeyedArchiver`. + +```swift +let data = NSKeyedArchiver.archivedDataWithRootObject(foo.encoded) +``` + +and likewise, unarchiving (and decoding) can be done: + +```swift +if let foo = Foo.decode(NSKeyedUnarchiver.unarchiveObjectWithData(data)) { + // etc, unarchive returns optionals when working with a single item. +} +``` + +These methods can also be used if composing value types inside other types which require encoding. + +When working with sequences of values, use the `encoded` property on the sequence. + +```swift +let foos = Set(arrayLiteral: Foo(), Foo(), Foo()) +let data = NSKeyedArchiver.archivedDataWithRootObject(foos.encoded) +``` + +When decoding an `NSArray`, perform a conditional cast to `[AnyObject]` before passing it to `decode`. The result will be an `Array` which will be empty if the object was not cast successfully. In addition, any members of `[AnyObject]` which did not decode will filtered from the result. This means that the length of the result will be less than the original encoded array if there was an issue decoding. + +```swift +let foos = Foo.decode(NSKeyedUnarchiver.unarchiveObjectWithData(data) as? [AnyObject]) +``` + +### Installation +ValueCoding builds as a cross platform (iOS, OS X, watchOS) extension compatible framework. It is also available via CocoaPods + +```ruby +pod ‘ValueCoding’ +``` + diff --git a/Examples/Custom Money/Pods/ValueCoding/ValueCoding/ValueCoding.swift b/Examples/Custom Money/Pods/ValueCoding/ValueCoding/ValueCoding.swift new file mode 100644 index 0000000..6ea6ab4 --- /dev/null +++ b/Examples/Custom Money/Pods/ValueCoding/ValueCoding/ValueCoding.swift @@ -0,0 +1,133 @@ +// +// ValueCoding.swift +// ValueCoding +// +// Created by Daniel Thorpe on 11/10/2015. +// +// + +import Foundation + +// MARK: - CodingType + +/** +A generic protocol for classes which can +encode/decode value types. +*/ +public protocol CodingType { + + typealias ValueType + + /// The value type which is being encoded/decoded + var value: ValueType { get } + + /// Required initializer receiving the wrapped value type. + init(_: ValueType) +} + +// MARK: - ValueCoding + +/** +A generic protocol for value types which require +coding. +*/ +public protocol ValueCoding { + typealias Coder: CodingType +} + +// MARK: - Protocol Extensions + +extension CodingType where ValueType: ValueCoding, ValueType.Coder == Self { + + internal static func decode(object: AnyObject?) -> ValueType? { + return (object as? Self)?.value + } + + internal static func decode(objects: S?) -> [ValueType] { + return objects?.flatMap(decode) ?? [] + } +} + +extension SequenceType + where + Generator.Element: CodingType { + + /// Access the values from a sequence of coders. + public var values: [Generator.Element.ValueType] { + return map { $0.value } + } +} + +/** +Static methods for decoding `AnyObject` to Self, and returning encoded object +of Self. +*/ +extension ValueCoding where Coder: NSCoding, Coder.ValueType == Self { + + /** + Decodes the value from a single decoder, if possible. + For example + + let foo = Foo.decode(decoder.decodeObjectForKey("foo")) + + - parameter object: an optional `AnyObject` which if not nil should + be of `Coder` type. + - returns: an optional `Self` + */ + public static func decode(object: AnyObject?) -> Self? { + return Coder.decode(object) + } + + /** + Decodes the values from a sequence of coders, if possible + For example + + let foos = Foo.decode(decoder.decodeObjectForKey("foos") as? [AnyObject]) + + - parameter objects: a `SequenceType` of `AnyObject`. + - returns: the array of values which were able to be unarchived. + */ + public static func decode(objects: S?) -> [Self] { + return Coder.decode(objects) + } + + /** + Encodes the value type into its Coder. + + Typically this would be used inside of + `encodeWithCoder:` when the value is composed inside + another `ValueCoding` or `NSCoding` type. For example: + + encoder.encodeObject(foo.encoded, forKey: "foo") + + */ + public var encoded: Coder { + return Coder(self) + } +} + +extension SequenceType + where + Generator.Element: ValueCoding, + Generator.Element.Coder: NSCoding, + Generator.Element.Coder.ValueType == Generator.Element { + + /** + Encodes the sequence of value types into a sequence of coders. + + Typically this would be used inside of + `encodeWithCoder:` when a sequence of values is + composed inside another `ValueCoding` or + `NSCoding` type. For example: + + encoder.encodeObject(foos.encoded, forKey: "foos") + + */ + public var encoded: [Generator.Element.Coder] { + return map { $0.encoded } + } +} + + + + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3f17113 --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gem 'scan' +gem 'fastlane', '>= 1.35' +gem 'xcpretty' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..fe1c9d1 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,241 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (4.2.4) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.3.8) + autoparse (0.3.3) + addressable (>= 2.3.1) + extlib (>= 0.9.15) + multi_json (>= 1.0.0) + babosa (1.0.2) + cert (1.2.0) + fastlane_core (>= 0.19.0, < 1.0.0) + spaceship (>= 0.6.0) + claide (0.9.1) + coderay (1.1.0) + colored (1.2) + commander (4.3.5) + highline (~> 1.7.2) + credentials_manager (0.10.0) + colored + highline (>= 1.7.1) + security + deliver (1.5.0) + credentials_manager (>= 0.9.0) + fastimage (~> 1.6.3) + fastlane_core (>= 0.19.0, < 1.0.0) + plist (~> 3.1.0) + spaceship (>= 0.13.0, <= 1.0.0) + domain_name (0.5.25) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.0.2) + excon (0.45.4) + extlib (0.9.16) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.10.0) + faraday (>= 0.7.4, < 0.10) + fastimage (1.6.8) + addressable (~> 2.3, >= 2.3.5) + fastlane (1.37.0) + addressable (~> 2.3.8) + cert (>= 1.1.0, < 2.0.0) + credentials_manager (>= 0.10.0, < 1.0.0) + deliver (>= 1.5.0, < 2.0.0) + fastlane_core (>= 0.26.1, < 1.0.0) + frameit (>= 2.2.2, < 3.0.0) + gym (>= 1.1.1, < 2.0.0) + krausefx-shenzhen (>= 0.14.6) + pbxplorer (~> 1.0.0) + pem (>= 1.0.0, < 2.0.0) + pilot (>= 1.0.0, < 2.0.0) + plist (~> 3.1.0) + produce (>= 1.0.0, < 2.0.0) + rest-client (~> 1.8.0) + scan (>= 0.2.0, < 1.0.0) + sigh (>= 1.1.1, < 2.0.0) + slack-notifier (~> 1.3) + snapshot (>= 1.0.4, < 2.0.0) + spaceship (>= 0.13.0, < 1.0.0) + supply (>= 0.2.1, < 1.0.0) + terminal-notifier (~> 1.6.2) + terminal-table (~> 1.4.5) + xcode-install (~> 1.0.1) + xcodeproj (>= 0.20, < 1.0.0) + xcpretty (>= 0.2.1) + fastlane_core (0.26.1) + babosa + colored + commander (>= 4.3.5) + credentials_manager (>= 0.8.2, < 1.0.0) + excon (~> 0.45.0) + highline (>= 1.7.2) + json + multi_json + plist (~> 3.1) + rubyzip (~> 1.1.6) + sentry-raven (~> 0.15) + terminal-table (~> 1.4.5) + frameit (2.2.2) + deliver (> 0.3) + fastimage (~> 1.6.3) + fastlane_core (>= 0.16.0, < 1.0.0) + mini_magick (~> 4.0.2) + google-api-client (0.8.6) + activesupport (>= 3.2) + addressable (~> 2.3) + autoparse (~> 0.3) + extlib (~> 0.9) + faraday (~> 0.9) + googleauth (~> 0.3) + launchy (~> 2.4) + multi_json (~> 1.10) + retriable (~> 1.4) + signet (~> 0.6) + googleauth (0.4.2) + faraday (~> 0.9) + jwt (~> 1.4) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + signet (~> 0.6) + gym (1.1.5) + fastlane_core (>= 0.25.0, < 1.0.0) + plist + rubyzip (>= 1.1.7) + terminal-table + xcpretty (>= 0.2.1) + highline (1.7.8) + http-cookie (1.0.2) + domain_name (~> 0.5) + i18n (0.7.0) + json (1.8.3) + jwt (1.5.2) + krausefx-shenzhen (0.14.6) + commander (~> 4.3) + dotenv (>= 0.7) + faraday (~> 0.9) + faraday_middleware (~> 0.9) + highline (>= 1.7.2) + json (~> 1.8) + net-sftp (~> 2.1.2) + plist (~> 3.1.0) + rubyzip (~> 1.1) + security (~> 0.1.3) + terminal-table (~> 1.4.5) + launchy (2.4.3) + addressable (~> 2.3) + little-plugger (1.1.4) + logging (2.0.0) + little-plugger (~> 1.1) + multi_json (~> 1.10) + memoist (0.12.0) + method_source (0.8.2) + mime-types (2.6.2) + mini_magick (4.0.4) + minitest (5.8.2) + multi_json (1.11.2) + multi_xml (0.5.5) + multipart-post (2.0.0) + net-sftp (2.1.2) + net-ssh (>= 2.6.5) + net-ssh (3.0.1) + netrc (0.11.0) + pbxplorer (1.0.0) + pem (1.0.1) + fastlane_core (>= 0.21.0, < 1.0.0) + spaceship (>= 0.12.0, < 1.0.0) + pilot (1.0.0) + credentials_manager (>= 0.3.0) + fastlane_core (>= 0.16.1, < 1.0.0) + spaceship (>= 0.12.0, < 1.0.0) + terminal-table (~> 1.4.5) + plist (3.1.0) + produce (1.0.0) + fastlane_core (>= 0.22.3, < 1.0.0) + spaceship (>= 0.12.0) + pry (0.10.3) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) + retriable (1.4.1) + rouge (1.10.1) + rubyzip (1.1.7) + scan (0.2.1) + fastlane_core (>= 0.25.3, < 1.0.0) + slack-notifier (~> 1.3) + terminal-table + xcpretty (>= 0.2.1) + xcpretty-travis-formatter (>= 0.0.3) + security (0.1.3) + sentry-raven (0.15.2) + faraday (>= 0.7.6) + sigh (1.1.1) + fastlane_core (>= 0.19.0, < 1.0.0) + plist (~> 3.1) + spaceship (>= 0.12.3) + signet (0.6.1) + addressable (~> 2.3) + extlib (~> 0.9) + faraday (~> 0.9) + jwt (~> 1.5) + multi_json (~> 1.10) + slack-notifier (1.4.0) + slop (3.6.0) + snapshot (1.1.0) + fastimage (~> 1.6.3) + fastlane_core (>= 0.21.0, < 1.0.0) + plist (~> 3.1.0) + xcpretty (>= 0.2.1) + spaceship (0.13.0) + colored + credentials_manager (>= 0.9.0) + faraday (~> 0.9) + faraday_middleware (~> 0.9) + fastimage (~> 1.6) + multi_xml (~> 0.5) + plist (~> 3.1) + pry + supply (0.2.1) + credentials_manager (>= 0.8.2) + fastlane_core (>= 0.19.0) + google-api-client (~> 0.8.6) + terminal-notifier (1.6.3) + terminal-table (1.4.5) + thread_safe (0.3.5) + tzinfo (1.2.2) + thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.1) + xcode-install (1.0.1) + claide (~> 0.9.1) + spaceship (>= 0.13.0, < 1.0.0) + xcodeproj (0.28.2) + activesupport (>= 3) + claide (~> 0.9.1) + colored (~> 1.2) + xcpretty (0.2.1) + rouge (~> 1.8) + xcpretty-travis-formatter (0.0.4) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane (>= 1.35) + scan + xcpretty + +BUNDLED WITH + 1.10.6 diff --git a/Money.podspec b/Money.podspec new file mode 100644 index 0000000..43a484f --- /dev/null +++ b/Money.podspec @@ -0,0 +1,30 @@ +Pod::Spec.new do |s| + s.name = "Money" + s.version = "1.0.0" + s.summary = "Swift types for working with Money." + s.description = <<-DESC + + Money is a Swift cross platform framework for iOS, watchOS, tvOS and OS X. + + It provides types and functionality to help represent and manipulate money + and currency related information. + + DESC + s.homepage = "https://github.com/danthorpe/Money" + s.license = 'MIT' + s.author = { "Daniel Thorpe" => "@danthorpe" } + s.source = { :git => "https://github.com/danthorpe/Money.git", :tag => s.version.to_s } + s.module_name = 'Money' + s.social_media_url = 'https://twitter.com/danthorpe' + s.requires_arc = true + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.10' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' + s.source_files = ['Money/*.swift', 'Money/Decimal/*.swift'] + + s.dependency 'ValueCoding' + s.dependency 'Result', '0.6.0-beta.6' + s.dependency 'SwiftyJSON' +end + diff --git a/Money.xcodeproj/project.pbxproj b/Money.xcodeproj/project.pbxproj new file mode 100644 index 0000000..36405dc --- /dev/null +++ b/Money.xcodeproj/project.pbxproj @@ -0,0 +1,1752 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + 65A876D81BE65FAF00E26F22 /* Generate Swift */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 65A876D91BE65FAF00E26F22 /* Build configuration list for PBXAggregateTarget "Generate Swift" */; + buildPhases = ( + 65A876DC1BE65FDA00E26F22 /* Generate Currency Type */, + ); + dependencies = ( + ); + name = "Generate Swift"; + productName = "Generate Swift"; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 6557F4C71BEB7F32003CD2BF /* ValueCoding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6557F4C61BEB7F32003CD2BF /* ValueCoding.framework */; }; + 6557F4C91BEB7F3D003CD2BF /* ValueCoding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6557F4C81BEB7F3D003CD2BF /* ValueCoding.framework */; }; + 6557F4CB1BEB7F46003CD2BF /* ValueCoding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6557F4CA1BEB7F46003CD2BF /* ValueCoding.framework */; }; + 6557F4CD1BEB7F51003CD2BF /* ValueCoding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6557F4CC1BEB7F51003CD2BF /* ValueCoding.framework */; }; + 6557F4D61BEB8720003CD2BF /* Decimal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D41BEB8720003CD2BF /* Decimal.swift */; }; + 6557F4D71BEB8720003CD2BF /* Decimal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D41BEB8720003CD2BF /* Decimal.swift */; }; + 6557F4D81BEB8720003CD2BF /* Decimal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D41BEB8720003CD2BF /* Decimal.swift */; }; + 6557F4D91BEB8720003CD2BF /* Decimal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D41BEB8720003CD2BF /* Decimal.swift */; }; + 6557F4DA1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D51BEB8720003CD2BF /* NSDecimalNumberExtensions.swift */; }; + 6557F4DB1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D51BEB8720003CD2BF /* NSDecimalNumberExtensions.swift */; }; + 6557F4DC1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D51BEB8720003CD2BF /* NSDecimalNumberExtensions.swift */; }; + 6557F4DD1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4D51BEB8720003CD2BF /* NSDecimalNumberExtensions.swift */; }; + 6557F4DF1BEB8737003CD2BF /* DecimalNumberType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4DE1BEB8737003CD2BF /* DecimalNumberType.swift */; }; + 6557F4E01BEB8737003CD2BF /* DecimalNumberType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4DE1BEB8737003CD2BF /* DecimalNumberType.swift */; }; + 6557F4E11BEB8737003CD2BF /* DecimalNumberType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4DE1BEB8737003CD2BF /* DecimalNumberType.swift */; }; + 6557F4E21BEB8737003CD2BF /* DecimalNumberType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4DE1BEB8737003CD2BF /* DecimalNumberType.swift */; }; + 6557F4E41BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E31BEB8850003CD2BF /* NSDecimalExtensions.swift */; }; + 6557F4E51BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E31BEB8850003CD2BF /* NSDecimalExtensions.swift */; }; + 6557F4E61BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E31BEB8850003CD2BF /* NSDecimalExtensions.swift */; }; + 6557F4E71BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E31BEB8850003CD2BF /* NSDecimalExtensions.swift */; }; + 6557F4E91BEB924D003CD2BF /* NSDecimalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E81BEB924D003CD2BF /* NSDecimalTests.swift */; }; + 6557F4EA1BEB924D003CD2BF /* NSDecimalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E81BEB924D003CD2BF /* NSDecimalTests.swift */; }; + 6557F4EB1BEB924D003CD2BF /* NSDecimalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4E81BEB924D003CD2BF /* NSDecimalTests.swift */; }; + 6557F4ED1BEB97AC003CD2BF /* NSDecimalNumberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4EC1BEB97AC003CD2BF /* NSDecimalNumberTests.swift */; }; + 6557F4EE1BEB97AC003CD2BF /* NSDecimalNumberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4EC1BEB97AC003CD2BF /* NSDecimalNumberTests.swift */; }; + 6557F4EF1BEB97AC003CD2BF /* NSDecimalNumberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6557F4EC1BEB97AC003CD2BF /* NSDecimalNumberTests.swift */; }; + 6557F4F11BEBC5CD003CD2BF /* Yahoo GBPUSD.json in Resources */ = {isa = PBXBuildFile; fileRef = 6557F4F01BEBC5C1003CD2BF /* Yahoo GBPUSD.json */; }; + 6557F4F21BEBC5D2003CD2BF /* Yahoo GBPUSD.json in Resources */ = {isa = PBXBuildFile; fileRef = 6557F4F01BEBC5C1003CD2BF /* Yahoo GBPUSD.json */; }; + 6557F4F31BEBC5D7003CD2BF /* Yahoo GBPUSD.json in Resources */ = {isa = PBXBuildFile; fileRef = 6557F4F01BEBC5C1003CD2BF /* Yahoo GBPUSD.json */; }; + 656409411BEAABCA00F82B4D /* FXYahooTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656409401BEAABCA00F82B4D /* FXYahooTests.swift */; }; + 656409421BEAABCA00F82B4D /* FXYahooTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656409401BEAABCA00F82B4D /* FXYahooTests.swift */; }; + 656409431BEAABCA00F82B4D /* FXYahooTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656409401BEAABCA00F82B4D /* FXYahooTests.swift */; }; + 656409451BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656409441BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift */; }; + 656409461BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656409441BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift */; }; + 656409471BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656409441BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift */; }; + 656409491BEAB89400F82B4D /* OpenExchangeRates.org USDEUR.json in Resources */ = {isa = PBXBuildFile; fileRef = 656409481BEAB88700F82B4D /* OpenExchangeRates.org USDEUR.json */; }; + 6564094A1BEAB89B00F82B4D /* OpenExchangeRates.org USDEUR.json in Resources */ = {isa = PBXBuildFile; fileRef = 656409481BEAB88700F82B4D /* OpenExchangeRates.org USDEUR.json */; }; + 6564094B1BEAB8A100F82B4D /* OpenExchangeRates.org USDEUR.json in Resources */ = {isa = PBXBuildFile; fileRef = 656409481BEAB88700F82B4D /* OpenExchangeRates.org USDEUR.json */; }; + 6564094D1BEABA6100F82B4D /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6564094C1BEABA6100F82B4D /* SwiftyJSON.framework */; }; + 6564094F1BEABA6E00F82B4D /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6564094E1BEABA6E00F82B4D /* SwiftyJSON.framework */; }; + 656409511BEABA7A00F82B4D /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 656409501BEABA7A00F82B4D /* SwiftyJSON.framework */; }; + 656409531BEABA8400F82B4D /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 656409521BEABA8400F82B4D /* SwiftyJSON.framework */; }; + 657C0B0E1BE10D2700CDB873 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B0D1BE10D2700CDB873 /* Currency.swift */; }; + 657C0B0F1BE10D2700CDB873 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B0D1BE10D2700CDB873 /* Currency.swift */; }; + 657C0B101BE10D2700CDB873 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B0D1BE10D2700CDB873 /* Currency.swift */; }; + 657C0B111BE10D2700CDB873 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B0D1BE10D2700CDB873 /* Currency.swift */; }; + 657C0B131BE1211900CDB873 /* Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B121BE1211900CDB873 /* Support.swift */; }; + 657C0B141BE1211900CDB873 /* Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B121BE1211900CDB873 /* Support.swift */; }; + 657C0B151BE1211900CDB873 /* Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B121BE1211900CDB873 /* Support.swift */; }; + 657C0B161BE1211900CDB873 /* Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B121BE1211900CDB873 /* Support.swift */; }; + 658863B91BEA2B26003482ED /* Troll.png in Resources */ = {isa = PBXBuildFile; fileRef = 658863B61BEA2B0B003482ED /* Troll.png */; }; + 658863BA1BEA2B2C003482ED /* Troll.png in Resources */ = {isa = PBXBuildFile; fileRef = 658863B61BEA2B0B003482ED /* Troll.png */; }; + 658863BB1BEA2B30003482ED /* Troll.png in Resources */ = {isa = PBXBuildFile; fileRef = 658863B61BEA2B0B003482ED /* Troll.png */; }; + 658863BD1BEA34ED003482ED /* DVR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 658863BC1BEA34ED003482ED /* DVR.framework */; }; + 658863BF1BEA3514003482ED /* DVR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 658863BE1BEA3514003482ED /* DVR.framework */; }; + 65A876E51BE79A9300E26F22 /* Autogenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B1B1BE164B700CDB873 /* Autogenerated.swift */; }; + 65A876E61BE79A9400E26F22 /* Autogenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B1B1BE164B700CDB873 /* Autogenerated.swift */; }; + 65A876E71BE79A9500E26F22 /* Autogenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B1B1BE164B700CDB873 /* Autogenerated.swift */; }; + 65A876E81BE79A9600E26F22 /* Autogenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 657C0B1B1BE164B700CDB873 /* Autogenerated.swift */; }; + 65A876EF1BE7B88F00E26F22 /* FX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876EE1BE7B88F00E26F22 /* FX.swift */; }; + 65A876F01BE7B88F00E26F22 /* FX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876EE1BE7B88F00E26F22 /* FX.swift */; }; + 65A876F11BE7B88F00E26F22 /* FX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876EE1BE7B88F00E26F22 /* FX.swift */; }; + 65A876F21BE7B88F00E26F22 /* FX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876EE1BE7B88F00E26F22 /* FX.swift */; }; + 65A876F41BE7D1A100E26F22 /* FXTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876F31BE7D1A100E26F22 /* FXTests.swift */; }; + 65A876F51BE7D1A100E26F22 /* FXTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876F31BE7D1A100E26F22 /* FXTests.swift */; }; + 65A876F61BE7D1A100E26F22 /* FXTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A876F31BE7D1A100E26F22 /* FXTests.swift */; }; + 65B92ADE1BE0E4A700F82024 /* Money.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65B92AD31BE0E4A700F82024 /* Money.framework */; }; + 65B92B071BE0E4D800F82024 /* Money.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65B92AFD1BE0E4D800F82024 /* Money.framework */; }; + 65B92B231BE0E4E700F82024 /* Money.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65B92B191BE0E4E700F82024 /* Money.framework */; }; + 65B92B351BE0E51E00F82024 /* Money.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B92B331BE0E51E00F82024 /* Money.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 65B92B3A1BE0E69500F82024 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 65B92B381BE0E69500F82024 /* Info.plist */; }; + 65B92B3C1BE0E70500F82024 /* Money.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B92B331BE0E51E00F82024 /* Money.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 65B92B3D1BE0E70500F82024 /* Money.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B92B331BE0E51E00F82024 /* Money.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 65B92B3E1BE0E70600F82024 /* Money.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B92B331BE0E51E00F82024 /* Money.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 65B92B3F1BE0E72700F82024 /* MoneyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B391BE0E69500F82024 /* MoneyTests.swift */; }; + 65B92B401BE0E72800F82024 /* MoneyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B391BE0E69500F82024 /* MoneyTests.swift */; }; + 65B92B411BE0E72900F82024 /* MoneyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B391BE0E69500F82024 /* MoneyTests.swift */; }; + 65B92B431BE0F93F00F82024 /* Money.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B421BE0F93F00F82024 /* Money.swift */; }; + 65B92B441BE0F93F00F82024 /* Money.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B421BE0F93F00F82024 /* Money.swift */; }; + 65B92B451BE0F93F00F82024 /* Money.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B421BE0F93F00F82024 /* Money.swift */; }; + 65B92B461BE0F93F00F82024 /* Money.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B92B421BE0F93F00F82024 /* Money.swift */; }; + 65D305521BE8E8210032D99F /* DecimalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D305511BE8E8210032D99F /* DecimalTests.swift */; }; + 65D305531BE8E8210032D99F /* DecimalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D305511BE8E8210032D99F /* DecimalTests.swift */; }; + 65D305541BE8E8210032D99F /* DecimalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D305511BE8E8210032D99F /* DecimalTests.swift */; }; + 65D3055A1BE94F860032D99F /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D305591BE94F860032D99F /* Result.framework */; }; + 65D3055B1BE94FA70032D99F /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D305571BE94E850032D99F /* Result.framework */; }; + 65D3055D1BE94FD40032D99F /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D3055C1BE94FD40032D99F /* Result.framework */; }; + 65D305601BE955020032D99F /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65D3055F1BE955020032D99F /* Result.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 65A876DD1BE65FF600E26F22 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65A876D81BE65FAF00E26F22; + remoteInfo = "Generate Swift"; + }; + 65A876DF1BE6600500E26F22 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65A876D81BE65FAF00E26F22; + remoteInfo = "Generate Swift"; + }; + 65A876E11BE6602800E26F22 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65A876D81BE65FAF00E26F22; + remoteInfo = "Generate Swift"; + }; + 65A876E31BE6603100E26F22 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65A876D81BE65FAF00E26F22; + remoteInfo = "Generate Swift"; + }; + 65B92ADF1BE0E4A700F82024 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65B92AD21BE0E4A700F82024; + remoteInfo = "Money-iOS"; + }; + 65B92B081BE0E4D800F82024 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65B92AFC1BE0E4D800F82024; + remoteInfo = "Money-tvOS"; + }; + 65B92B241BE0E4E700F82024 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 65B92AC81BE0E46C00F82024 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 65B92B181BE0E4E700F82024; + remoteInfo = "Money-OSX"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 6557F4C61BEB7F32003CD2BF /* ValueCoding.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ValueCoding.framework; path = Carthage/Build/iOS/ValueCoding.framework; sourceTree = ""; }; + 6557F4C81BEB7F3D003CD2BF /* ValueCoding.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ValueCoding.framework; path = Carthage/Build/watchOS/ValueCoding.framework; sourceTree = ""; }; + 6557F4CA1BEB7F46003CD2BF /* ValueCoding.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ValueCoding.framework; path = Carthage/Build/tvOS/ValueCoding.framework; sourceTree = ""; }; + 6557F4CC1BEB7F51003CD2BF /* ValueCoding.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ValueCoding.framework; path = Carthage/Build/Mac/ValueCoding.framework; sourceTree = ""; }; + 6557F4D41BEB8720003CD2BF /* Decimal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Decimal.swift; sourceTree = ""; }; + 6557F4D51BEB8720003CD2BF /* NSDecimalNumberExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDecimalNumberExtensions.swift; sourceTree = ""; }; + 6557F4DE1BEB8737003CD2BF /* DecimalNumberType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecimalNumberType.swift; sourceTree = ""; }; + 6557F4E31BEB8850003CD2BF /* NSDecimalExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDecimalExtensions.swift; sourceTree = ""; }; + 6557F4E81BEB924D003CD2BF /* NSDecimalTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDecimalTests.swift; sourceTree = ""; }; + 6557F4EC1BEB97AC003CD2BF /* NSDecimalNumberTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDecimalNumberTests.swift; sourceTree = ""; }; + 6557F4F01BEBC5C1003CD2BF /* Yahoo GBPUSD.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Yahoo GBPUSD.json"; path = "DVR Cassettes/Yahoo GBPUSD.json"; sourceTree = ""; }; + 656409401BEAABCA00F82B4D /* FXYahooTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FXYahooTests.swift; sourceTree = ""; }; + 656409441BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FXOpenExchangeRatesTests.swift; sourceTree = ""; }; + 656409481BEAB88700F82B4D /* OpenExchangeRates.org USDEUR.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "OpenExchangeRates.org USDEUR.json"; path = "DVR Cassettes/OpenExchangeRates.org USDEUR.json"; sourceTree = ""; }; + 6564094C1BEABA6100F82B4D /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/iOS/SwiftyJSON.framework; sourceTree = ""; }; + 6564094E1BEABA6E00F82B4D /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/watchOS/SwiftyJSON.framework; sourceTree = ""; }; + 656409501BEABA7A00F82B4D /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/tvOS/SwiftyJSON.framework; sourceTree = ""; }; + 656409521BEABA8400F82B4D /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/Mac/SwiftyJSON.framework; sourceTree = ""; }; + 657C0B0D1BE10D2700CDB873 /* Currency.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Currency.swift; sourceTree = ""; }; + 657C0B121BE1211900CDB873 /* Support.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Support.swift; sourceTree = ""; }; + 657C0B1B1BE164B700CDB873 /* Autogenerated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Autogenerated.swift; sourceTree = ""; }; + 658863B61BEA2B0B003482ED /* Troll.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Troll.png; sourceTree = ""; }; + 658863BC1BEA34ED003482ED /* DVR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVR.framework; path = Carthage/Build/iOS/DVR.framework; sourceTree = ""; }; + 658863BE1BEA3514003482ED /* DVR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVR.framework; path = Carthage/Build/Mac/DVR.framework; sourceTree = ""; }; + 65A876D61BE6491800E26F22 /* Generate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Generate.swift; path = "Supporting Files/Generate.swift"; sourceTree = SOURCE_ROOT; }; + 65A876EE1BE7B88F00E26F22 /* FX.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FX.swift; sourceTree = ""; }; + 65A876F31BE7D1A100E26F22 /* FXTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FXTests.swift; sourceTree = ""; }; + 65B92AD31BE0E4A700F82024 /* Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92ADD1BE0E4A700F82024 /* Money-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Money-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92AF01BE0E4C800F82024 /* Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92AFD1BE0E4D800F82024 /* Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92B061BE0E4D800F82024 /* Money-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Money-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92B191BE0E4E700F82024 /* Money.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Money.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92B221BE0E4E700F82024 /* Money-OSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Money-OSXTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B92B321BE0E51E00F82024 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = SOURCE_ROOT; }; + 65B92B331BE0E51E00F82024 /* Money.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Money.h; path = "Supporting Files/Money.h"; sourceTree = SOURCE_ROOT; }; + 65B92B361BE0E57800F82024 /* Money.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Money.xcconfig; path = "Supporting Files/Money.xcconfig"; sourceTree = SOURCE_ROOT; }; + 65B92B381BE0E69500F82024 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 65B92B391BE0E69500F82024 /* MoneyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoneyTests.swift; sourceTree = ""; }; + 65B92B421BE0F93F00F82024 /* Money.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Money.swift; sourceTree = ""; }; + 65D305511BE8E8210032D99F /* DecimalTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecimalTests.swift; sourceTree = ""; }; + 65D305571BE94E850032D99F /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/tvOS/Result.framework; sourceTree = ""; }; + 65D305591BE94F860032D99F /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/watchOS/Result.framework; sourceTree = ""; }; + 65D3055C1BE94FD40032D99F /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/Mac/Result.framework; sourceTree = ""; }; + 65D3055F1BE955020032D99F /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 65B92ACF1BE0E4A700F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65D305601BE955020032D99F /* Result.framework in Frameworks */, + 6564094D1BEABA6100F82B4D /* SwiftyJSON.framework in Frameworks */, + 6557F4C71BEB7F32003CD2BF /* ValueCoding.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92ADA1BE0E4A700F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 658863BD1BEA34ED003482ED /* DVR.framework in Frameworks */, + 65B92ADE1BE0E4A700F82024 /* Money.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AEC1BE0E4C800F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65D3055A1BE94F860032D99F /* Result.framework in Frameworks */, + 6564094F1BEABA6E00F82B4D /* SwiftyJSON.framework in Frameworks */, + 6557F4C91BEB7F3D003CD2BF /* ValueCoding.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AF91BE0E4D800F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65D3055B1BE94FA70032D99F /* Result.framework in Frameworks */, + 656409511BEABA7A00F82B4D /* SwiftyJSON.framework in Frameworks */, + 6557F4CB1BEB7F46003CD2BF /* ValueCoding.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B031BE0E4D800F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B071BE0E4D800F82024 /* Money.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B151BE0E4E700F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65D3055D1BE94FD40032D99F /* Result.framework in Frameworks */, + 656409531BEABA8400F82B4D /* SwiftyJSON.framework in Frameworks */, + 6557F4CD1BEB7F51003CD2BF /* ValueCoding.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B1F1BE0E4E700F82024 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B231BE0E4E700F82024 /* Money.framework in Frameworks */, + 658863BF1BEA3514003482ED /* DVR.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6557F4D31BEB8720003CD2BF /* Decimal */ = { + isa = PBXGroup; + children = ( + 6557F4D41BEB8720003CD2BF /* Decimal.swift */, + 6557F4DE1BEB8737003CD2BF /* DecimalNumberType.swift */, + 6557F4D51BEB8720003CD2BF /* NSDecimalNumberExtensions.swift */, + 6557F4E31BEB8850003CD2BF /* NSDecimalExtensions.swift */, + ); + path = Decimal; + sourceTree = ""; + }; + 65B92AC71BE0E46C00F82024 = { + isa = PBXGroup; + children = ( + 65B92B301BE0E51E00F82024 /* Money */, + 65B92B371BE0E69500F82024 /* Tests */, + 65B92B311BE0E51E00F82024 /* Supporting Files */, + 65B92AD41BE0E4A700F82024 /* Products */, + 65D3055E1BE94FE10032D99F /* Dependencies */, + ); + sourceTree = ""; + }; + 65B92AD41BE0E4A700F82024 /* Products */ = { + isa = PBXGroup; + children = ( + 65B92AD31BE0E4A700F82024 /* Money.framework */, + 65B92ADD1BE0E4A700F82024 /* Money-iOSTests.xctest */, + 65B92AF01BE0E4C800F82024 /* Money.framework */, + 65B92AFD1BE0E4D800F82024 /* Money.framework */, + 65B92B061BE0E4D800F82024 /* Money-tvOSTests.xctest */, + 65B92B191BE0E4E700F82024 /* Money.framework */, + 65B92B221BE0E4E700F82024 /* Money-OSXTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 65B92B301BE0E51E00F82024 /* Money */ = { + isa = PBXGroup; + children = ( + 6557F4D31BEB8720003CD2BF /* Decimal */, + 657C0B1B1BE164B700CDB873 /* Autogenerated.swift */, + 657C0B0D1BE10D2700CDB873 /* Currency.swift */, + 65A876EE1BE7B88F00E26F22 /* FX.swift */, + 65B92B421BE0F93F00F82024 /* Money.swift */, + 657C0B121BE1211900CDB873 /* Support.swift */, + ); + path = Money; + sourceTree = ""; + }; + 65B92B311BE0E51E00F82024 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 65B92B331BE0E51E00F82024 /* Money.h */, + 65B92B321BE0E51E00F82024 /* Info.plist */, + 65A876D61BE6491800E26F22 /* Generate.swift */, + 65B92B361BE0E57800F82024 /* Money.xcconfig */, + ); + name = "Supporting Files"; + path = "Money/Supporting Files"; + sourceTree = ""; + }; + 65B92B371BE0E69500F82024 /* Tests */ = { + isa = PBXGroup; + children = ( + 65B92B381BE0E69500F82024 /* Info.plist */, + 658863B61BEA2B0B003482ED /* Troll.png */, + 65D305511BE8E8210032D99F /* DecimalTests.swift */, + 656409441BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift */, + 65A876F31BE7D1A100E26F22 /* FXTests.swift */, + 656409401BEAABCA00F82B4D /* FXYahooTests.swift */, + 65B92B391BE0E69500F82024 /* MoneyTests.swift */, + 6557F4E81BEB924D003CD2BF /* NSDecimalTests.swift */, + 6557F4EC1BEB97AC003CD2BF /* NSDecimalNumberTests.swift */, + 65FC56411BEA667300727556 /* Network Responses */, + ); + path = Tests; + sourceTree = ""; + }; + 65D3055E1BE94FE10032D99F /* Dependencies */ = { + isa = PBXGroup; + children = ( + 658863BE1BEA3514003482ED /* DVR.framework */, + 658863BC1BEA34ED003482ED /* DVR.framework */, + 65D3055F1BE955020032D99F /* Result.framework */, + 65D3055C1BE94FD40032D99F /* Result.framework */, + 65D305591BE94F860032D99F /* Result.framework */, + 65D305571BE94E850032D99F /* Result.framework */, + 656409521BEABA8400F82B4D /* SwiftyJSON.framework */, + 656409501BEABA7A00F82B4D /* SwiftyJSON.framework */, + 6564094E1BEABA6E00F82B4D /* SwiftyJSON.framework */, + 6564094C1BEABA6100F82B4D /* SwiftyJSON.framework */, + 6557F4CC1BEB7F51003CD2BF /* ValueCoding.framework */, + 6557F4CA1BEB7F46003CD2BF /* ValueCoding.framework */, + 6557F4C81BEB7F3D003CD2BF /* ValueCoding.framework */, + 6557F4C61BEB7F32003CD2BF /* ValueCoding.framework */, + ); + name = Dependencies; + sourceTree = ""; + }; + 65FC56411BEA667300727556 /* Network Responses */ = { + isa = PBXGroup; + children = ( + 6557F4F01BEBC5C1003CD2BF /* Yahoo GBPUSD.json */, + 656409481BEAB88700F82B4D /* OpenExchangeRates.org USDEUR.json */, + ); + name = "Network Responses"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 65B92AD01BE0E4A700F82024 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B351BE0E51E00F82024 /* Money.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AED1BE0E4C800F82024 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B3C1BE0E70500F82024 /* Money.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AFA1BE0E4D800F82024 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B3D1BE0E70500F82024 /* Money.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B161BE0E4E700F82024 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B3E1BE0E70600F82024 /* Money.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 65B92AD21BE0E4A700F82024 /* Money-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92AE91BE0E4A700F82024 /* Build configuration list for PBXNativeTarget "Money-iOS" */; + buildPhases = ( + 65B92ACE1BE0E4A700F82024 /* Sources */, + 65B92ACF1BE0E4A700F82024 /* Frameworks */, + 65B92AD01BE0E4A700F82024 /* Headers */, + 65B92AD11BE0E4A700F82024 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 65A876DE1BE65FF600E26F22 /* PBXTargetDependency */, + ); + name = "Money-iOS"; + productName = "Money-iOS"; + productReference = 65B92AD31BE0E4A700F82024 /* Money.framework */; + productType = "com.apple.product-type.framework"; + }; + 65B92ADC1BE0E4A700F82024 /* Money-iOSTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92AEA1BE0E4A700F82024 /* Build configuration list for PBXNativeTarget "Money-iOSTests" */; + buildPhases = ( + 65B92AD91BE0E4A700F82024 /* Sources */, + 65B92ADA1BE0E4A700F82024 /* Frameworks */, + 65B92ADB1BE0E4A700F82024 /* Resources */, + 65D305641BE955AE0032D99F /* Carthage Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 65B92AE01BE0E4A700F82024 /* PBXTargetDependency */, + ); + name = "Money-iOSTests"; + productName = "Money-iOSTests"; + productReference = 65B92ADD1BE0E4A700F82024 /* Money-iOSTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 65B92AEF1BE0E4C800F82024 /* Money-watchOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92AF51BE0E4C800F82024 /* Build configuration list for PBXNativeTarget "Money-watchOS" */; + buildPhases = ( + 65B92AEB1BE0E4C800F82024 /* Sources */, + 65B92AEC1BE0E4C800F82024 /* Frameworks */, + 65B92AED1BE0E4C800F82024 /* Headers */, + 65B92AEE1BE0E4C800F82024 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 65A876E01BE6600500E26F22 /* PBXTargetDependency */, + ); + name = "Money-watchOS"; + productName = "Money-watchOS"; + productReference = 65B92AF01BE0E4C800F82024 /* Money.framework */; + productType = "com.apple.product-type.framework"; + }; + 65B92AFC1BE0E4D800F82024 /* Money-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92B0E1BE0E4D800F82024 /* Build configuration list for PBXNativeTarget "Money-tvOS" */; + buildPhases = ( + 65B92AF81BE0E4D800F82024 /* Sources */, + 65B92AF91BE0E4D800F82024 /* Frameworks */, + 65B92AFA1BE0E4D800F82024 /* Headers */, + 65B92AFB1BE0E4D800F82024 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 65A876E21BE6602800E26F22 /* PBXTargetDependency */, + ); + name = "Money-tvOS"; + productName = "Money-tvOS"; + productReference = 65B92AFD1BE0E4D800F82024 /* Money.framework */; + productType = "com.apple.product-type.framework"; + }; + 65B92B051BE0E4D800F82024 /* Money-tvOSTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92B111BE0E4D800F82024 /* Build configuration list for PBXNativeTarget "Money-tvOSTests" */; + buildPhases = ( + 65B92B021BE0E4D800F82024 /* Sources */, + 65B92B031BE0E4D800F82024 /* Frameworks */, + 65B92B041BE0E4D800F82024 /* Resources */, + 65D305651BE956060032D99F /* Carthage Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 65B92B091BE0E4D800F82024 /* PBXTargetDependency */, + ); + name = "Money-tvOSTests"; + productName = "Money-tvOSTests"; + productReference = 65B92B061BE0E4D800F82024 /* Money-tvOSTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 65B92B181BE0E4E700F82024 /* Money-OSX */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92B2A1BE0E4E700F82024 /* Build configuration list for PBXNativeTarget "Money-OSX" */; + buildPhases = ( + 65B92B141BE0E4E700F82024 /* Sources */, + 65B92B151BE0E4E700F82024 /* Frameworks */, + 65B92B161BE0E4E700F82024 /* Headers */, + 65B92B171BE0E4E700F82024 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 65A876E41BE6603100E26F22 /* PBXTargetDependency */, + ); + name = "Money-OSX"; + productName = "Money-OSX"; + productReference = 65B92B191BE0E4E700F82024 /* Money.framework */; + productType = "com.apple.product-type.framework"; + }; + 65B92B211BE0E4E700F82024 /* Money-OSXTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B92B2D1BE0E4E700F82024 /* Build configuration list for PBXNativeTarget "Money-OSXTests" */; + buildPhases = ( + 65B92B1E1BE0E4E700F82024 /* Sources */, + 65B92B1F1BE0E4E700F82024 /* Frameworks */, + 65B92B201BE0E4E700F82024 /* Resources */, + 65D305661BE956230032D99F /* Carthage Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 65B92B251BE0E4E700F82024 /* PBXTargetDependency */, + ); + name = "Money-OSXTests"; + productName = "Money-OSXTests"; + productReference = 65B92B221BE0E4E700F82024 /* Money-OSXTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 65B92AC81BE0E46C00F82024 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0710; + LastUpgradeCheck = 0710; + TargetAttributes = { + 65A876D81BE65FAF00E26F22 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92AD21BE0E4A700F82024 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92ADC1BE0E4A700F82024 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92AEF1BE0E4C800F82024 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92AFC1BE0E4D800F82024 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92B051BE0E4D800F82024 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92B181BE0E4E700F82024 = { + CreatedOnToolsVersion = 7.1; + }; + 65B92B211BE0E4E700F82024 = { + CreatedOnToolsVersion = 7.1; + }; + }; + }; + buildConfigurationList = 65B92ACB1BE0E46C00F82024 /* Build configuration list for PBXProject "Money" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 65B92AC71BE0E46C00F82024; + productRefGroup = 65B92AD41BE0E4A700F82024 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 65A876D81BE65FAF00E26F22 /* Generate Swift */, + 65B92AD21BE0E4A700F82024 /* Money-iOS */, + 65B92ADC1BE0E4A700F82024 /* Money-iOSTests */, + 65B92AEF1BE0E4C800F82024 /* Money-watchOS */, + 65B92AFC1BE0E4D800F82024 /* Money-tvOS */, + 65B92B051BE0E4D800F82024 /* Money-tvOSTests */, + 65B92B181BE0E4E700F82024 /* Money-OSX */, + 65B92B211BE0E4E700F82024 /* Money-OSXTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 65B92AD11BE0E4A700F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B3A1BE0E69500F82024 /* Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92ADB1BE0E4A700F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6557F4F11BEBC5CD003CD2BF /* Yahoo GBPUSD.json in Resources */, + 656409491BEAB89400F82B4D /* OpenExchangeRates.org USDEUR.json in Resources */, + 658863B91BEA2B26003482ED /* Troll.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AEE1BE0E4C800F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AFB1BE0E4D800F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B041BE0E4D800F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6557F4F21BEBC5D2003CD2BF /* Yahoo GBPUSD.json in Resources */, + 6564094A1BEAB89B00F82B4D /* OpenExchangeRates.org USDEUR.json in Resources */, + 658863BA1BEA2B2C003482ED /* Troll.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B171BE0E4E700F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B201BE0E4E700F82024 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6557F4F31BEBC5D7003CD2BF /* Yahoo GBPUSD.json in Resources */, + 6564094B1BEAB8A100F82B4D /* OpenExchangeRates.org USDEUR.json in Resources */, + 658863BB1BEA2B30003482ED /* Troll.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 65A876DC1BE65FDA00E26F22 /* Generate Currency Type */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Supporting Files/Generate.swift", + ); + name = "Generate Currency Type"; + outputPaths = ( + "$(SRCROOT)/Money/Autogenerated.swift", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"Will generate currency types using: $SCRIPT_INPUT_FILE_0\"\n\"$SCRIPT_INPUT_FILE_0\" \"$SCRIPT_OUTPUT_FILE_0\"\necho \"Generate complete\"\n\n\n\n\n"; + }; + 65D305641BE955AE0032D99F /* Carthage Copy Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/Result.framework", + "$(SRCROOT)/Carthage/Build/iOS/DVR.framework", + "$(SRCROOT)/Carthage/Build/iOS/SwiftyJSON.framework", + "$(SRCROOT)/Carthage/Build/iOS/ValueCoding.framework", + ); + name = "Carthage Copy Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks"; + }; + 65D305651BE956060032D99F /* Carthage Copy Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/tvOS/Result.framework", + "$(SRCROOT)/Carthage/Build/tvOS/SwiftyJSON.framework", + "$(SRCROOT)/Carthage/Build/tvOS/ValueCoding.framework", + ); + name = "Carthage Copy Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks"; + }; + 65D305661BE956230032D99F /* Carthage Copy Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/Mac/Result.framework", + "$(SRCROOT)/Carthage/Build/Mac/DVR.framework", + "$(SRCROOT)/Carthage/Build/Mac/SwiftyJSON.framework", + "$(SRCROOT)/Carthage/Build/Mac/ValueCoding.framework", + ); + name = "Carthage Copy Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 65B92ACE1BE0E4A700F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 657C0B0E1BE10D2700CDB873 /* Currency.swift in Sources */, + 65B92B431BE0F93F00F82024 /* Money.swift in Sources */, + 6557F4E41BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */, + 65A876E51BE79A9300E26F22 /* Autogenerated.swift in Sources */, + 6557F4DA1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */, + 6557F4DF1BEB8737003CD2BF /* DecimalNumberType.swift in Sources */, + 6557F4D61BEB8720003CD2BF /* Decimal.swift in Sources */, + 657C0B131BE1211900CDB873 /* Support.swift in Sources */, + 65A876EF1BE7B88F00E26F22 /* FX.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AD91BE0E4A700F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B3F1BE0E72700F82024 /* MoneyTests.swift in Sources */, + 65D305521BE8E8210032D99F /* DecimalTests.swift in Sources */, + 6557F4E91BEB924D003CD2BF /* NSDecimalTests.swift in Sources */, + 656409411BEAABCA00F82B4D /* FXYahooTests.swift in Sources */, + 65A876F41BE7D1A100E26F22 /* FXTests.swift in Sources */, + 6557F4ED1BEB97AC003CD2BF /* NSDecimalNumberTests.swift in Sources */, + 656409451BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AEB1BE0E4C800F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 657C0B0F1BE10D2700CDB873 /* Currency.swift in Sources */, + 65B92B441BE0F93F00F82024 /* Money.swift in Sources */, + 6557F4E51BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */, + 65A876E61BE79A9400E26F22 /* Autogenerated.swift in Sources */, + 6557F4DB1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */, + 6557F4E01BEB8737003CD2BF /* DecimalNumberType.swift in Sources */, + 6557F4D71BEB8720003CD2BF /* Decimal.swift in Sources */, + 657C0B141BE1211900CDB873 /* Support.swift in Sources */, + 65A876F01BE7B88F00E26F22 /* FX.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92AF81BE0E4D800F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 657C0B101BE10D2700CDB873 /* Currency.swift in Sources */, + 65B92B451BE0F93F00F82024 /* Money.swift in Sources */, + 6557F4E61BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */, + 65A876E71BE79A9500E26F22 /* Autogenerated.swift in Sources */, + 6557F4DC1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */, + 6557F4E11BEB8737003CD2BF /* DecimalNumberType.swift in Sources */, + 6557F4D81BEB8720003CD2BF /* Decimal.swift in Sources */, + 657C0B151BE1211900CDB873 /* Support.swift in Sources */, + 65A876F11BE7B88F00E26F22 /* FX.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B021BE0E4D800F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B401BE0E72800F82024 /* MoneyTests.swift in Sources */, + 65D305531BE8E8210032D99F /* DecimalTests.swift in Sources */, + 6557F4EA1BEB924D003CD2BF /* NSDecimalTests.swift in Sources */, + 656409421BEAABCA00F82B4D /* FXYahooTests.swift in Sources */, + 65A876F51BE7D1A100E26F22 /* FXTests.swift in Sources */, + 6557F4EE1BEB97AC003CD2BF /* NSDecimalNumberTests.swift in Sources */, + 656409461BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B141BE0E4E700F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 657C0B111BE10D2700CDB873 /* Currency.swift in Sources */, + 65B92B461BE0F93F00F82024 /* Money.swift in Sources */, + 6557F4E71BEB8850003CD2BF /* NSDecimalExtensions.swift in Sources */, + 65A876E81BE79A9600E26F22 /* Autogenerated.swift in Sources */, + 6557F4DD1BEB8720003CD2BF /* NSDecimalNumberExtensions.swift in Sources */, + 6557F4E21BEB8737003CD2BF /* DecimalNumberType.swift in Sources */, + 6557F4D91BEB8720003CD2BF /* Decimal.swift in Sources */, + 657C0B161BE1211900CDB873 /* Support.swift in Sources */, + 65A876F21BE7B88F00E26F22 /* FX.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 65B92B1E1BE0E4E700F82024 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B92B411BE0E72900F82024 /* MoneyTests.swift in Sources */, + 65D305541BE8E8210032D99F /* DecimalTests.swift in Sources */, + 6557F4EB1BEB924D003CD2BF /* NSDecimalTests.swift in Sources */, + 656409431BEAABCA00F82B4D /* FXYahooTests.swift in Sources */, + 65A876F61BE7D1A100E26F22 /* FXTests.swift in Sources */, + 6557F4EF1BEB97AC003CD2BF /* NSDecimalNumberTests.swift in Sources */, + 656409471BEAB5DC00F82B4D /* FXOpenExchangeRatesTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 65A876DE1BE65FF600E26F22 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65A876D81BE65FAF00E26F22 /* Generate Swift */; + targetProxy = 65A876DD1BE65FF600E26F22 /* PBXContainerItemProxy */; + }; + 65A876E01BE6600500E26F22 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65A876D81BE65FAF00E26F22 /* Generate Swift */; + targetProxy = 65A876DF1BE6600500E26F22 /* PBXContainerItemProxy */; + }; + 65A876E21BE6602800E26F22 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65A876D81BE65FAF00E26F22 /* Generate Swift */; + targetProxy = 65A876E11BE6602800E26F22 /* PBXContainerItemProxy */; + }; + 65A876E41BE6603100E26F22 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65A876D81BE65FAF00E26F22 /* Generate Swift */; + targetProxy = 65A876E31BE6603100E26F22 /* PBXContainerItemProxy */; + }; + 65B92AE01BE0E4A700F82024 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65B92AD21BE0E4A700F82024 /* Money-iOS */; + targetProxy = 65B92ADF1BE0E4A700F82024 /* PBXContainerItemProxy */; + }; + 65B92B091BE0E4D800F82024 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65B92AFC1BE0E4D800F82024 /* Money-tvOS */; + targetProxy = 65B92B081BE0E4D800F82024 /* PBXContainerItemProxy */; + }; + 65B92B251BE0E4E700F82024 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 65B92B181BE0E4E700F82024 /* Money-OSX */; + targetProxy = 65B92B241BE0E4E700F82024 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 65A876DA1BE65FAF00E26F22 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 65A876DB1BE65FAF00E26F22 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 65B92ACC1BE0E46C00F82024 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Debug; + }; + 65B92ACD1BE0E46C00F82024 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Release; + }; + 65B92AE51BE0E4A700F82024 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Carthage/Build/iOS"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 65B92AE61BE0E4A700F82024 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Carthage/Build/iOS"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 65B92AE71BE0E4A700F82024 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Money-iOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 65B92AE81BE0E4A700F82024 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Money-iOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 65B92AF61BE0E4C800F82024 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/watchOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = 4; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 65B92AF71BE0E4C800F82024 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/watchOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + 65B92B0F1BE0E4D800F82024 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 65B92B101BE0E4D800F82024 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 65B92B121BE0E4D800F82024 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Money-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + 65B92B131BE0E4D800F82024 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Money-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 65B92B2B1BE0E4E700F82024 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + FRAMEWORK_VERSION = A; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 65B92B2C1BE0E4E700F82024 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 65B92B361BE0E57800F82024 /* Money.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + FRAMEWORK_VERSION = A; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 65B92B2E1BE0E4E700F82024 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Money-OSXTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 65B92B2F1BE0E4E700F82024 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.Money-OSXTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 65A876D91BE65FAF00E26F22 /* Build configuration list for PBXAggregateTarget "Generate Swift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65A876DA1BE65FAF00E26F22 /* Debug */, + 65A876DB1BE65FAF00E26F22 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92ACB1BE0E46C00F82024 /* Build configuration list for PBXProject "Money" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92ACC1BE0E46C00F82024 /* Debug */, + 65B92ACD1BE0E46C00F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92AE91BE0E4A700F82024 /* Build configuration list for PBXNativeTarget "Money-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92AE51BE0E4A700F82024 /* Debug */, + 65B92AE61BE0E4A700F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92AEA1BE0E4A700F82024 /* Build configuration list for PBXNativeTarget "Money-iOSTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92AE71BE0E4A700F82024 /* Debug */, + 65B92AE81BE0E4A700F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92AF51BE0E4C800F82024 /* Build configuration list for PBXNativeTarget "Money-watchOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92AF61BE0E4C800F82024 /* Debug */, + 65B92AF71BE0E4C800F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92B0E1BE0E4D800F82024 /* Build configuration list for PBXNativeTarget "Money-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92B0F1BE0E4D800F82024 /* Debug */, + 65B92B101BE0E4D800F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92B111BE0E4D800F82024 /* Build configuration list for PBXNativeTarget "Money-tvOSTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92B121BE0E4D800F82024 /* Debug */, + 65B92B131BE0E4D800F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92B2A1BE0E4E700F82024 /* Build configuration list for PBXNativeTarget "Money-OSX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92B2B1BE0E4E700F82024 /* Debug */, + 65B92B2C1BE0E4E700F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B92B2D1BE0E4E700F82024 /* Build configuration list for PBXNativeTarget "Money-OSXTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B92B2E1BE0E4E700F82024 /* Debug */, + 65B92B2F1BE0E4E700F82024 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 65B92AC81BE0E46C00F82024 /* Project object */; +} diff --git a/Money.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Money.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..355704c --- /dev/null +++ b/Money.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Money.xcodeproj/xcshareddata/xcschemes/Money-OSX.xcscheme b/Money.xcodeproj/xcshareddata/xcschemes/Money-OSX.xcscheme new file mode 100644 index 0000000..79f3185 --- /dev/null +++ b/Money.xcodeproj/xcshareddata/xcschemes/Money-OSX.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Money.xcodeproj/xcshareddata/xcschemes/Money-iOS.xcscheme b/Money.xcodeproj/xcshareddata/xcschemes/Money-iOS.xcscheme new file mode 100644 index 0000000..68cb34b --- /dev/null +++ b/Money.xcodeproj/xcshareddata/xcschemes/Money-iOS.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Money.xcodeproj/xcshareddata/xcschemes/Money-tvOS.xcscheme b/Money.xcodeproj/xcshareddata/xcschemes/Money-tvOS.xcscheme new file mode 100644 index 0000000..7550743 --- /dev/null +++ b/Money.xcodeproj/xcshareddata/xcschemes/Money-tvOS.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Money.xcodeproj/xcshareddata/xcschemes/Money-watchOS.xcscheme b/Money.xcodeproj/xcshareddata/xcschemes/Money-watchOS.xcscheme new file mode 100644 index 0000000..bf9c906 --- /dev/null +++ b/Money.xcodeproj/xcshareddata/xcschemes/Money-watchOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Money/Autogenerated.swift b/Money/Autogenerated.swift new file mode 100644 index 0000000..f1841a6 --- /dev/null +++ b/Money/Autogenerated.swift @@ -0,0 +1,2402 @@ +// +// Money, https://github.com/danthorpe/Money +// Created by Dan Thorpe, @danthorpe +// +// Autogenerated from build scripts, do not manually edit this file. + +extension Currency { + + /// Currency ADP + public final class ADP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ADP(code: "ADP") + } + + /// Currency AED + public final class AED: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AED(code: "AED") + } + + /// Currency AFA + public final class AFA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AFA(code: "AFA") + } + + /// Currency AFN + public final class AFN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AFN(code: "AFN") + } + + /// Currency ALK + public final class ALK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ALK(code: "ALK") + } + + /// Currency ALL + public final class ALL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ALL(code: "ALL") + } + + /// Currency AMD + public final class AMD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AMD(code: "AMD") + } + + /// Currency ANG + public final class ANG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ANG(code: "ANG") + } + + /// Currency AOA + public final class AOA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AOA(code: "AOA") + } + + /// Currency AOK + public final class AOK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AOK(code: "AOK") + } + + /// Currency AON + public final class AON: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AON(code: "AON") + } + + /// Currency AOR + public final class AOR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AOR(code: "AOR") + } + + /// Currency ARA + public final class ARA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ARA(code: "ARA") + } + + /// Currency ARL + public final class ARL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ARL(code: "ARL") + } + + /// Currency ARM + public final class ARM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ARM(code: "ARM") + } + + /// Currency ARP + public final class ARP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ARP(code: "ARP") + } + + /// Currency ARS + public final class ARS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ARS(code: "ARS") + } + + /// Currency ATS + public final class ATS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ATS(code: "ATS") + } + + /// Currency AUD + public final class AUD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AUD(code: "AUD") + } + + /// Currency AWG + public final class AWG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AWG(code: "AWG") + } + + /// Currency AZM + public final class AZM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AZM(code: "AZM") + } + + /// Currency AZN + public final class AZN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = AZN(code: "AZN") + } + + /// Currency BAD + public final class BAD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BAD(code: "BAD") + } + + /// Currency BAM + public final class BAM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BAM(code: "BAM") + } + + /// Currency BAN + public final class BAN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BAN(code: "BAN") + } + + /// Currency BBD + public final class BBD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BBD(code: "BBD") + } + + /// Currency BDT + public final class BDT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BDT(code: "BDT") + } + + /// Currency BEC + public final class BEC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BEC(code: "BEC") + } + + /// Currency BEF + public final class BEF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BEF(code: "BEF") + } + + /// Currency BEL + public final class BEL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BEL(code: "BEL") + } + + /// Currency BGL + public final class BGL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BGL(code: "BGL") + } + + /// Currency BGM + public final class BGM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BGM(code: "BGM") + } + + /// Currency BGN + public final class BGN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BGN(code: "BGN") + } + + /// Currency BGO + public final class BGO: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BGO(code: "BGO") + } + + /// Currency BHD + public final class BHD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BHD(code: "BHD") + } + + /// Currency BIF + public final class BIF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BIF(code: "BIF") + } + + /// Currency BMD + public final class BMD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BMD(code: "BMD") + } + + /// Currency BND + public final class BND: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BND(code: "BND") + } + + /// Currency BOB + public final class BOB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BOB(code: "BOB") + } + + /// Currency BOL + public final class BOL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BOL(code: "BOL") + } + + /// Currency BOP + public final class BOP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BOP(code: "BOP") + } + + /// Currency BOV + public final class BOV: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BOV(code: "BOV") + } + + /// Currency BRB + public final class BRB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRB(code: "BRB") + } + + /// Currency BRC + public final class BRC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRC(code: "BRC") + } + + /// Currency BRE + public final class BRE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRE(code: "BRE") + } + + /// Currency BRL + public final class BRL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRL(code: "BRL") + } + + /// Currency BRN + public final class BRN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRN(code: "BRN") + } + + /// Currency BRR + public final class BRR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRR(code: "BRR") + } + + /// Currency BRZ + public final class BRZ: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BRZ(code: "BRZ") + } + + /// Currency BSD + public final class BSD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BSD(code: "BSD") + } + + /// Currency BTN + public final class BTN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BTN(code: "BTN") + } + + /// Currency BUK + public final class BUK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BUK(code: "BUK") + } + + /// Currency BWP + public final class BWP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BWP(code: "BWP") + } + + /// Currency BYB + public final class BYB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BYB(code: "BYB") + } + + /// Currency BYR + public final class BYR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BYR(code: "BYR") + } + + /// Currency BZD + public final class BZD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = BZD(code: "BZD") + } + + /// Currency CAD + public final class CAD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CAD(code: "CAD") + } + + /// Currency CDF + public final class CDF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CDF(code: "CDF") + } + + /// Currency CHE + public final class CHE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CHE(code: "CHE") + } + + /// Currency CHF + public final class CHF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CHF(code: "CHF") + } + + /// Currency CHW + public final class CHW: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CHW(code: "CHW") + } + + /// Currency CLE + public final class CLE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CLE(code: "CLE") + } + + /// Currency CLF + public final class CLF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CLF(code: "CLF") + } + + /// Currency CLP + public final class CLP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CLP(code: "CLP") + } + + /// Currency CNX + public final class CNX: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CNX(code: "CNX") + } + + /// Currency CNY + public final class CNY: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CNY(code: "CNY") + } + + /// Currency COP + public final class COP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = COP(code: "COP") + } + + /// Currency COU + public final class COU: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = COU(code: "COU") + } + + /// Currency CRC + public final class CRC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CRC(code: "CRC") + } + + /// Currency CSD + public final class CSD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CSD(code: "CSD") + } + + /// Currency CSK + public final class CSK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CSK(code: "CSK") + } + + /// Currency CUC + public final class CUC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CUC(code: "CUC") + } + + /// Currency CUP + public final class CUP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CUP(code: "CUP") + } + + /// Currency CVE + public final class CVE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CVE(code: "CVE") + } + + /// Currency CYP + public final class CYP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CYP(code: "CYP") + } + + /// Currency CZK + public final class CZK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = CZK(code: "CZK") + } + + /// Currency DDM + public final class DDM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = DDM(code: "DDM") + } + + /// Currency DEM + public final class DEM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = DEM(code: "DEM") + } + + /// Currency DJF + public final class DJF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = DJF(code: "DJF") + } + + /// Currency DKK + public final class DKK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = DKK(code: "DKK") + } + + /// Currency DOP + public final class DOP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = DOP(code: "DOP") + } + + /// Currency DZD + public final class DZD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = DZD(code: "DZD") + } + + /// Currency ECS + public final class ECS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ECS(code: "ECS") + } + + /// Currency ECV + public final class ECV: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ECV(code: "ECV") + } + + /// Currency EEK + public final class EEK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = EEK(code: "EEK") + } + + /// Currency EGP + public final class EGP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = EGP(code: "EGP") + } + + /// Currency EQE + public final class EQE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = EQE(code: "EQE") + } + + /// Currency ERN + public final class ERN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ERN(code: "ERN") + } + + /// Currency ESA + public final class ESA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ESA(code: "ESA") + } + + /// Currency ESB + public final class ESB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ESB(code: "ESB") + } + + /// Currency ESP + public final class ESP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ESP(code: "ESP") + } + + /// Currency ETB + public final class ETB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ETB(code: "ETB") + } + + /// Currency EUR + public final class EUR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = EUR(code: "EUR") + } + + /// Currency FIM + public final class FIM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = FIM(code: "FIM") + } + + /// Currency FJD + public final class FJD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = FJD(code: "FJD") + } + + /// Currency FKP + public final class FKP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = FKP(code: "FKP") + } + + /// Currency FRF + public final class FRF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = FRF(code: "FRF") + } + + /// Currency GBP + public final class GBP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GBP(code: "GBP") + } + + /// Currency GEK + public final class GEK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GEK(code: "GEK") + } + + /// Currency GEL + public final class GEL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GEL(code: "GEL") + } + + /// Currency GHC + public final class GHC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GHC(code: "GHC") + } + + /// Currency GHS + public final class GHS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GHS(code: "GHS") + } + + /// Currency GIP + public final class GIP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GIP(code: "GIP") + } + + /// Currency GMD + public final class GMD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GMD(code: "GMD") + } + + /// Currency GNF + public final class GNF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GNF(code: "GNF") + } + + /// Currency GNS + public final class GNS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GNS(code: "GNS") + } + + /// Currency GQE + public final class GQE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GQE(code: "GQE") + } + + /// Currency GRD + public final class GRD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GRD(code: "GRD") + } + + /// Currency GTQ + public final class GTQ: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GTQ(code: "GTQ") + } + + /// Currency GWE + public final class GWE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GWE(code: "GWE") + } + + /// Currency GWP + public final class GWP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GWP(code: "GWP") + } + + /// Currency GYD + public final class GYD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = GYD(code: "GYD") + } + + /// Currency HKD + public final class HKD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = HKD(code: "HKD") + } + + /// Currency HNL + public final class HNL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = HNL(code: "HNL") + } + + /// Currency HRD + public final class HRD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = HRD(code: "HRD") + } + + /// Currency HRK + public final class HRK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = HRK(code: "HRK") + } + + /// Currency HTG + public final class HTG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = HTG(code: "HTG") + } + + /// Currency HUF + public final class HUF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = HUF(code: "HUF") + } + + /// Currency IDR + public final class IDR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = IDR(code: "IDR") + } + + /// Currency IEP + public final class IEP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = IEP(code: "IEP") + } + + /// Currency ILP + public final class ILP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ILP(code: "ILP") + } + + /// Currency ILR + public final class ILR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ILR(code: "ILR") + } + + /// Currency ILS + public final class ILS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ILS(code: "ILS") + } + + /// Currency INR + public final class INR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = INR(code: "INR") + } + + /// Currency IQD + public final class IQD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = IQD(code: "IQD") + } + + /// Currency IRR + public final class IRR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = IRR(code: "IRR") + } + + /// Currency ISJ + public final class ISJ: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ISJ(code: "ISJ") + } + + /// Currency ISK + public final class ISK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ISK(code: "ISK") + } + + /// Currency ITL + public final class ITL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ITL(code: "ITL") + } + + /// Currency JMD + public final class JMD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = JMD(code: "JMD") + } + + /// Currency JOD + public final class JOD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = JOD(code: "JOD") + } + + /// Currency JPY + public final class JPY: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = JPY(code: "JPY") + } + + /// Currency KES + public final class KES: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KES(code: "KES") + } + + /// Currency KGS + public final class KGS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KGS(code: "KGS") + } + + /// Currency KHR + public final class KHR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KHR(code: "KHR") + } + + /// Currency KMF + public final class KMF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KMF(code: "KMF") + } + + /// Currency KPW + public final class KPW: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KPW(code: "KPW") + } + + /// Currency KRH + public final class KRH: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KRH(code: "KRH") + } + + /// Currency KRO + public final class KRO: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KRO(code: "KRO") + } + + /// Currency KRW + public final class KRW: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KRW(code: "KRW") + } + + /// Currency KWD + public final class KWD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KWD(code: "KWD") + } + + /// Currency KYD + public final class KYD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KYD(code: "KYD") + } + + /// Currency KZT + public final class KZT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = KZT(code: "KZT") + } + + /// Currency LAK + public final class LAK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LAK(code: "LAK") + } + + /// Currency LBP + public final class LBP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LBP(code: "LBP") + } + + /// Currency LKR + public final class LKR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LKR(code: "LKR") + } + + /// Currency LRD + public final class LRD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LRD(code: "LRD") + } + + /// Currency LSL + public final class LSL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LSL(code: "LSL") + } + + /// Currency LSM + public final class LSM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LSM(code: "LSM") + } + + /// Currency LTL + public final class LTL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LTL(code: "LTL") + } + + /// Currency LTT + public final class LTT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LTT(code: "LTT") + } + + /// Currency LUC + public final class LUC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LUC(code: "LUC") + } + + /// Currency LUF + public final class LUF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LUF(code: "LUF") + } + + /// Currency LUL + public final class LUL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LUL(code: "LUL") + } + + /// Currency LVL + public final class LVL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LVL(code: "LVL") + } + + /// Currency LVR + public final class LVR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LVR(code: "LVR") + } + + /// Currency LYD + public final class LYD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = LYD(code: "LYD") + } + + /// Currency MAD + public final class MAD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MAD(code: "MAD") + } + + /// Currency MAF + public final class MAF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MAF(code: "MAF") + } + + /// Currency MCF + public final class MCF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MCF(code: "MCF") + } + + /// Currency MDC + public final class MDC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MDC(code: "MDC") + } + + /// Currency MDL + public final class MDL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MDL(code: "MDL") + } + + /// Currency MGA + public final class MGA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MGA(code: "MGA") + } + + /// Currency MGF + public final class MGF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MGF(code: "MGF") + } + + /// Currency MKD + public final class MKD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MKD(code: "MKD") + } + + /// Currency MKN + public final class MKN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MKN(code: "MKN") + } + + /// Currency MLF + public final class MLF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MLF(code: "MLF") + } + + /// Currency MMK + public final class MMK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MMK(code: "MMK") + } + + /// Currency MNT + public final class MNT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MNT(code: "MNT") + } + + /// Currency MOP + public final class MOP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MOP(code: "MOP") + } + + /// Currency MRO + public final class MRO: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MRO(code: "MRO") + } + + /// Currency MTL + public final class MTL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MTL(code: "MTL") + } + + /// Currency MTP + public final class MTP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MTP(code: "MTP") + } + + /// Currency MUR + public final class MUR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MUR(code: "MUR") + } + + /// Currency MVP + public final class MVP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MVP(code: "MVP") + } + + /// Currency MVR + public final class MVR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MVR(code: "MVR") + } + + /// Currency MWK + public final class MWK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MWK(code: "MWK") + } + + /// Currency MXN + public final class MXN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MXN(code: "MXN") + } + + /// Currency MXP + public final class MXP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MXP(code: "MXP") + } + + /// Currency MXV + public final class MXV: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MXV(code: "MXV") + } + + /// Currency MYR + public final class MYR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MYR(code: "MYR") + } + + /// Currency MZE + public final class MZE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MZE(code: "MZE") + } + + /// Currency MZM + public final class MZM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MZM(code: "MZM") + } + + /// Currency MZN + public final class MZN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = MZN(code: "MZN") + } + + /// Currency NAD + public final class NAD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NAD(code: "NAD") + } + + /// Currency NGN + public final class NGN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NGN(code: "NGN") + } + + /// Currency NIC + public final class NIC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NIC(code: "NIC") + } + + /// Currency NIO + public final class NIO: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NIO(code: "NIO") + } + + /// Currency NLG + public final class NLG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NLG(code: "NLG") + } + + /// Currency NOK + public final class NOK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NOK(code: "NOK") + } + + /// Currency NPR + public final class NPR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NPR(code: "NPR") + } + + /// Currency NZD + public final class NZD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = NZD(code: "NZD") + } + + /// Currency OMR + public final class OMR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = OMR(code: "OMR") + } + + /// Currency PAB + public final class PAB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PAB(code: "PAB") + } + + /// Currency PEI + public final class PEI: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PEI(code: "PEI") + } + + /// Currency PEN + public final class PEN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PEN(code: "PEN") + } + + /// Currency PES + public final class PES: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PES(code: "PES") + } + + /// Currency PGK + public final class PGK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PGK(code: "PGK") + } + + /// Currency PHP + public final class PHP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PHP(code: "PHP") + } + + /// Currency PKR + public final class PKR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PKR(code: "PKR") + } + + /// Currency PLN + public final class PLN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PLN(code: "PLN") + } + + /// Currency PLZ + public final class PLZ: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PLZ(code: "PLZ") + } + + /// Currency PTE + public final class PTE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PTE(code: "PTE") + } + + /// Currency PYG + public final class PYG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = PYG(code: "PYG") + } + + /// Currency QAR + public final class QAR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = QAR(code: "QAR") + } + + /// Currency RHD + public final class RHD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = RHD(code: "RHD") + } + + /// Currency ROL + public final class ROL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ROL(code: "ROL") + } + + /// Currency RON + public final class RON: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = RON(code: "RON") + } + + /// Currency RSD + public final class RSD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = RSD(code: "RSD") + } + + /// Currency RUB + public final class RUB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = RUB(code: "RUB") + } + + /// Currency RUR + public final class RUR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = RUR(code: "RUR") + } + + /// Currency RWF + public final class RWF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = RWF(code: "RWF") + } + + /// Currency SAR + public final class SAR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SAR(code: "SAR") + } + + /// Currency SBD + public final class SBD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SBD(code: "SBD") + } + + /// Currency SCR + public final class SCR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SCR(code: "SCR") + } + + /// Currency SDD + public final class SDD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SDD(code: "SDD") + } + + /// Currency SDG + public final class SDG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SDG(code: "SDG") + } + + /// Currency SDP + public final class SDP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SDP(code: "SDP") + } + + /// Currency SEK + public final class SEK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SEK(code: "SEK") + } + + /// Currency SGD + public final class SGD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SGD(code: "SGD") + } + + /// Currency SHP + public final class SHP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SHP(code: "SHP") + } + + /// Currency SIT + public final class SIT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SIT(code: "SIT") + } + + /// Currency SKK + public final class SKK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SKK(code: "SKK") + } + + /// Currency SLL + public final class SLL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SLL(code: "SLL") + } + + /// Currency SOS + public final class SOS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SOS(code: "SOS") + } + + /// Currency SRD + public final class SRD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SRD(code: "SRD") + } + + /// Currency SRG + public final class SRG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SRG(code: "SRG") + } + + /// Currency SSP + public final class SSP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SSP(code: "SSP") + } + + /// Currency STD + public final class STD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = STD(code: "STD") + } + + /// Currency SUR + public final class SUR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SUR(code: "SUR") + } + + /// Currency SVC + public final class SVC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SVC(code: "SVC") + } + + /// Currency SYP + public final class SYP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SYP(code: "SYP") + } + + /// Currency SZL + public final class SZL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = SZL(code: "SZL") + } + + /// Currency THB + public final class THB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = THB(code: "THB") + } + + /// Currency TJR + public final class TJR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TJR(code: "TJR") + } + + /// Currency TJS + public final class TJS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TJS(code: "TJS") + } + + /// Currency TMM + public final class TMM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TMM(code: "TMM") + } + + /// Currency TMT + public final class TMT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TMT(code: "TMT") + } + + /// Currency TND + public final class TND: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TND(code: "TND") + } + + /// Currency TOP + public final class TOP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TOP(code: "TOP") + } + + /// Currency TPE + public final class TPE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TPE(code: "TPE") + } + + /// Currency TRL + public final class TRL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TRL(code: "TRL") + } + + /// Currency TRY + public final class TRY: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TRY(code: "TRY") + } + + /// Currency TTD + public final class TTD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TTD(code: "TTD") + } + + /// Currency TWD + public final class TWD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TWD(code: "TWD") + } + + /// Currency TZS + public final class TZS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = TZS(code: "TZS") + } + + /// Currency UAH + public final class UAH: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UAH(code: "UAH") + } + + /// Currency UAK + public final class UAK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UAK(code: "UAK") + } + + /// Currency UGS + public final class UGS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UGS(code: "UGS") + } + + /// Currency UGX + public final class UGX: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UGX(code: "UGX") + } + + /// Currency USD + public final class USD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = USD(code: "USD") + } + + /// Currency USN + public final class USN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = USN(code: "USN") + } + + /// Currency USS + public final class USS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = USS(code: "USS") + } + + /// Currency UYI + public final class UYI: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UYI(code: "UYI") + } + + /// Currency UYP + public final class UYP: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UYP(code: "UYP") + } + + /// Currency UYU + public final class UYU: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UYU(code: "UYU") + } + + /// Currency UZS + public final class UZS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = UZS(code: "UZS") + } + + /// Currency VEB + public final class VEB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = VEB(code: "VEB") + } + + /// Currency VEF + public final class VEF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = VEF(code: "VEF") + } + + /// Currency VND + public final class VND: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = VND(code: "VND") + } + + /// Currency VNN + public final class VNN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = VNN(code: "VNN") + } + + /// Currency VUV + public final class VUV: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = VUV(code: "VUV") + } + + /// Currency WST + public final class WST: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = WST(code: "WST") + } + + /// Currency XAF + public final class XAF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XAF(code: "XAF") + } + + /// Currency XAG + public final class XAG: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XAG(code: "XAG") + } + + /// Currency XAU + public final class XAU: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XAU(code: "XAU") + } + + /// Currency XBA + public final class XBA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XBA(code: "XBA") + } + + /// Currency XBB + public final class XBB: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XBB(code: "XBB") + } + + /// Currency XBC + public final class XBC: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XBC(code: "XBC") + } + + /// Currency XBD + public final class XBD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XBD(code: "XBD") + } + + /// Currency XCD + public final class XCD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XCD(code: "XCD") + } + + /// Currency XDR + public final class XDR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XDR(code: "XDR") + } + + /// Currency XEU + public final class XEU: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XEU(code: "XEU") + } + + /// Currency XFO + public final class XFO: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XFO(code: "XFO") + } + + /// Currency XFU + public final class XFU: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XFU(code: "XFU") + } + + /// Currency XOF + public final class XOF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XOF(code: "XOF") + } + + /// Currency XPD + public final class XPD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XPD(code: "XPD") + } + + /// Currency XPF + public final class XPF: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XPF(code: "XPF") + } + + /// Currency XPT + public final class XPT: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XPT(code: "XPT") + } + + /// Currency XRE + public final class XRE: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XRE(code: "XRE") + } + + /// Currency XSU + public final class XSU: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XSU(code: "XSU") + } + + /// Currency XTS + public final class XTS: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XTS(code: "XTS") + } + + /// Currency XUA + public final class XUA: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XUA(code: "XUA") + } + + /// Currency XXX + public final class XXX: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = XXX(code: "XXX") + } + + /// Currency YDD + public final class YDD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = YDD(code: "YDD") + } + + /// Currency YER + public final class YER: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = YER(code: "YER") + } + + /// Currency YUD + public final class YUD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = YUD(code: "YUD") + } + + /// Currency YUM + public final class YUM: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = YUM(code: "YUM") + } + + /// Currency YUN + public final class YUN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = YUN(code: "YUN") + } + + /// Currency YUR + public final class YUR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = YUR(code: "YUR") + } + + /// Currency ZAL + public final class ZAL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZAL(code: "ZAL") + } + + /// Currency ZAR + public final class ZAR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZAR(code: "ZAR") + } + + /// Currency ZMK + public final class ZMK: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZMK(code: "ZMK") + } + + /// Currency ZMW + public final class ZMW: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZMW(code: "ZMW") + } + + /// Currency ZRN + public final class ZRN: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZRN(code: "ZRN") + } + + /// Currency ZRZ + public final class ZRZ: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZRZ(code: "ZRZ") + } + + /// Currency ZWL + public final class ZWL: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZWL(code: "ZWL") + } + + /// Currency ZWR + public final class ZWR: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZWR(code: "ZWR") + } + + /// Currency ZWD + public final class ZWD: Currency.Base, _CurrencyType { + /// Lazy static storage for currency. + public static var sharedInstance = ZWD(code: "ZWD") + } +} + + +/// ADP Money +public typealias ADP = _Money +/// AED Money +public typealias AED = _Money +/// AFA Money +public typealias AFA = _Money +/// AFN Money +public typealias AFN = _Money +/// ALK Money +public typealias ALK = _Money +/// ALL Money +public typealias ALL = _Money +/// AMD Money +public typealias AMD = _Money +/// ANG Money +public typealias ANG = _Money +/// AOA Money +public typealias AOA = _Money +/// AOK Money +public typealias AOK = _Money +/// AON Money +public typealias AON = _Money +/// AOR Money +public typealias AOR = _Money +/// ARA Money +public typealias ARA = _Money +/// ARL Money +public typealias ARL = _Money +/// ARM Money +public typealias ARM = _Money +/// ARP Money +public typealias ARP = _Money +/// ARS Money +public typealias ARS = _Money +/// ATS Money +public typealias ATS = _Money +/// AUD Money +public typealias AUD = _Money +/// AWG Money +public typealias AWG = _Money +/// AZM Money +public typealias AZM = _Money +/// AZN Money +public typealias AZN = _Money +/// BAD Money +public typealias BAD = _Money +/// BAM Money +public typealias BAM = _Money +/// BAN Money +public typealias BAN = _Money +/// BBD Money +public typealias BBD = _Money +/// BDT Money +public typealias BDT = _Money +/// BEC Money +public typealias BEC = _Money +/// BEF Money +public typealias BEF = _Money +/// BEL Money +public typealias BEL = _Money +/// BGL Money +public typealias BGL = _Money +/// BGM Money +public typealias BGM = _Money +/// BGN Money +public typealias BGN = _Money +/// BGO Money +public typealias BGO = _Money +/// BHD Money +public typealias BHD = _Money +/// BIF Money +public typealias BIF = _Money +/// BMD Money +public typealias BMD = _Money +/// BND Money +public typealias BND = _Money +/// BOB Money +public typealias BOB = _Money +/// BOL Money +public typealias BOL = _Money +/// BOP Money +public typealias BOP = _Money +/// BOV Money +public typealias BOV = _Money +/// BRB Money +public typealias BRB = _Money +/// BRC Money +public typealias BRC = _Money +/// BRE Money +public typealias BRE = _Money +/// BRL Money +public typealias BRL = _Money +/// BRN Money +public typealias BRN = _Money +/// BRR Money +public typealias BRR = _Money +/// BRZ Money +public typealias BRZ = _Money +/// BSD Money +public typealias BSD = _Money +/// BTN Money +public typealias BTN = _Money +/// BUK Money +public typealias BUK = _Money +/// BWP Money +public typealias BWP = _Money +/// BYB Money +public typealias BYB = _Money +/// BYR Money +public typealias BYR = _Money +/// BZD Money +public typealias BZD = _Money +/// CAD Money +public typealias CAD = _Money +/// CDF Money +public typealias CDF = _Money +/// CHE Money +public typealias CHE = _Money +/// CHF Money +public typealias CHF = _Money +/// CHW Money +public typealias CHW = _Money +/// CLE Money +public typealias CLE = _Money +/// CLF Money +public typealias CLF = _Money +/// CLP Money +public typealias CLP = _Money +/// CNX Money +public typealias CNX = _Money +/// CNY Money +public typealias CNY = _Money +/// COP Money +public typealias COP = _Money +/// COU Money +public typealias COU = _Money +/// CRC Money +public typealias CRC = _Money +/// CSD Money +public typealias CSD = _Money +/// CSK Money +public typealias CSK = _Money +/// CUC Money +public typealias CUC = _Money +/// CUP Money +public typealias CUP = _Money +/// CVE Money +public typealias CVE = _Money +/// CYP Money +public typealias CYP = _Money +/// CZK Money +public typealias CZK = _Money +/// DDM Money +public typealias DDM = _Money +/// DEM Money +public typealias DEM = _Money +/// DJF Money +public typealias DJF = _Money +/// DKK Money +public typealias DKK = _Money +/// DOP Money +public typealias DOP = _Money +/// DZD Money +public typealias DZD = _Money +/// ECS Money +public typealias ECS = _Money +/// ECV Money +public typealias ECV = _Money +/// EEK Money +public typealias EEK = _Money +/// EGP Money +public typealias EGP = _Money +/// EQE Money +public typealias EQE = _Money +/// ERN Money +public typealias ERN = _Money +/// ESA Money +public typealias ESA = _Money +/// ESB Money +public typealias ESB = _Money +/// ESP Money +public typealias ESP = _Money +/// ETB Money +public typealias ETB = _Money +/// EUR Money +public typealias EUR = _Money +/// FIM Money +public typealias FIM = _Money +/// FJD Money +public typealias FJD = _Money +/// FKP Money +public typealias FKP = _Money +/// FRF Money +public typealias FRF = _Money +/// GBP Money +public typealias GBP = _Money +/// GEK Money +public typealias GEK = _Money +/// GEL Money +public typealias GEL = _Money +/// GHC Money +public typealias GHC = _Money +/// GHS Money +public typealias GHS = _Money +/// GIP Money +public typealias GIP = _Money +/// GMD Money +public typealias GMD = _Money +/// GNF Money +public typealias GNF = _Money +/// GNS Money +public typealias GNS = _Money +/// GQE Money +public typealias GQE = _Money +/// GRD Money +public typealias GRD = _Money +/// GTQ Money +public typealias GTQ = _Money +/// GWE Money +public typealias GWE = _Money +/// GWP Money +public typealias GWP = _Money +/// GYD Money +public typealias GYD = _Money +/// HKD Money +public typealias HKD = _Money +/// HNL Money +public typealias HNL = _Money +/// HRD Money +public typealias HRD = _Money +/// HRK Money +public typealias HRK = _Money +/// HTG Money +public typealias HTG = _Money +/// HUF Money +public typealias HUF = _Money +/// IDR Money +public typealias IDR = _Money +/// IEP Money +public typealias IEP = _Money +/// ILP Money +public typealias ILP = _Money +/// ILR Money +public typealias ILR = _Money +/// ILS Money +public typealias ILS = _Money +/// INR Money +public typealias INR = _Money +/// IQD Money +public typealias IQD = _Money +/// IRR Money +public typealias IRR = _Money +/// ISJ Money +public typealias ISJ = _Money +/// ISK Money +public typealias ISK = _Money +/// ITL Money +public typealias ITL = _Money +/// JMD Money +public typealias JMD = _Money +/// JOD Money +public typealias JOD = _Money +/// JPY Money +public typealias JPY = _Money +/// KES Money +public typealias KES = _Money +/// KGS Money +public typealias KGS = _Money +/// KHR Money +public typealias KHR = _Money +/// KMF Money +public typealias KMF = _Money +/// KPW Money +public typealias KPW = _Money +/// KRH Money +public typealias KRH = _Money +/// KRO Money +public typealias KRO = _Money +/// KRW Money +public typealias KRW = _Money +/// KWD Money +public typealias KWD = _Money +/// KYD Money +public typealias KYD = _Money +/// KZT Money +public typealias KZT = _Money +/// LAK Money +public typealias LAK = _Money +/// LBP Money +public typealias LBP = _Money +/// LKR Money +public typealias LKR = _Money +/// LRD Money +public typealias LRD = _Money +/// LSL Money +public typealias LSL = _Money +/// LSM Money +public typealias LSM = _Money +/// LTL Money +public typealias LTL = _Money +/// LTT Money +public typealias LTT = _Money +/// LUC Money +public typealias LUC = _Money +/// LUF Money +public typealias LUF = _Money +/// LUL Money +public typealias LUL = _Money +/// LVL Money +public typealias LVL = _Money +/// LVR Money +public typealias LVR = _Money +/// LYD Money +public typealias LYD = _Money +/// MAD Money +public typealias MAD = _Money +/// MAF Money +public typealias MAF = _Money +/// MCF Money +public typealias MCF = _Money +/// MDC Money +public typealias MDC = _Money +/// MDL Money +public typealias MDL = _Money +/// MGA Money +public typealias MGA = _Money +/// MGF Money +public typealias MGF = _Money +/// MKD Money +public typealias MKD = _Money +/// MKN Money +public typealias MKN = _Money +/// MLF Money +public typealias MLF = _Money +/// MMK Money +public typealias MMK = _Money +/// MNT Money +public typealias MNT = _Money +/// MOP Money +public typealias MOP = _Money +/// MRO Money +public typealias MRO = _Money +/// MTL Money +public typealias MTL = _Money +/// MTP Money +public typealias MTP = _Money +/// MUR Money +public typealias MUR = _Money +/// MVP Money +public typealias MVP = _Money +/// MVR Money +public typealias MVR = _Money +/// MWK Money +public typealias MWK = _Money +/// MXN Money +public typealias MXN = _Money +/// MXP Money +public typealias MXP = _Money +/// MXV Money +public typealias MXV = _Money +/// MYR Money +public typealias MYR = _Money +/// MZE Money +public typealias MZE = _Money +/// MZM Money +public typealias MZM = _Money +/// MZN Money +public typealias MZN = _Money +/// NAD Money +public typealias NAD = _Money +/// NGN Money +public typealias NGN = _Money +/// NIC Money +public typealias NIC = _Money +/// NIO Money +public typealias NIO = _Money +/// NLG Money +public typealias NLG = _Money +/// NOK Money +public typealias NOK = _Money +/// NPR Money +public typealias NPR = _Money +/// NZD Money +public typealias NZD = _Money +/// OMR Money +public typealias OMR = _Money +/// PAB Money +public typealias PAB = _Money +/// PEI Money +public typealias PEI = _Money +/// PEN Money +public typealias PEN = _Money +/// PES Money +public typealias PES = _Money +/// PGK Money +public typealias PGK = _Money +/// PHP Money +public typealias PHP = _Money +/// PKR Money +public typealias PKR = _Money +/// PLN Money +public typealias PLN = _Money +/// PLZ Money +public typealias PLZ = _Money +/// PTE Money +public typealias PTE = _Money +/// PYG Money +public typealias PYG = _Money +/// QAR Money +public typealias QAR = _Money +/// RHD Money +public typealias RHD = _Money +/// ROL Money +public typealias ROL = _Money +/// RON Money +public typealias RON = _Money +/// RSD Money +public typealias RSD = _Money +/// RUB Money +public typealias RUB = _Money +/// RUR Money +public typealias RUR = _Money +/// RWF Money +public typealias RWF = _Money +/// SAR Money +public typealias SAR = _Money +/// SBD Money +public typealias SBD = _Money +/// SCR Money +public typealias SCR = _Money +/// SDD Money +public typealias SDD = _Money +/// SDG Money +public typealias SDG = _Money +/// SDP Money +public typealias SDP = _Money +/// SEK Money +public typealias SEK = _Money +/// SGD Money +public typealias SGD = _Money +/// SHP Money +public typealias SHP = _Money +/// SIT Money +public typealias SIT = _Money +/// SKK Money +public typealias SKK = _Money +/// SLL Money +public typealias SLL = _Money +/// SOS Money +public typealias SOS = _Money +/// SRD Money +public typealias SRD = _Money +/// SRG Money +public typealias SRG = _Money +/// SSP Money +public typealias SSP = _Money +/// STD Money +public typealias STD = _Money +/// SUR Money +public typealias SUR = _Money +/// SVC Money +public typealias SVC = _Money +/// SYP Money +public typealias SYP = _Money +/// SZL Money +public typealias SZL = _Money +/// THB Money +public typealias THB = _Money +/// TJR Money +public typealias TJR = _Money +/// TJS Money +public typealias TJS = _Money +/// TMM Money +public typealias TMM = _Money +/// TMT Money +public typealias TMT = _Money +/// TND Money +public typealias TND = _Money +/// TOP Money +public typealias TOP = _Money +/// TPE Money +public typealias TPE = _Money +/// TRL Money +public typealias TRL = _Money +/// TRY Money +public typealias TRY = _Money +/// TTD Money +public typealias TTD = _Money +/// TWD Money +public typealias TWD = _Money +/// TZS Money +public typealias TZS = _Money +/// UAH Money +public typealias UAH = _Money +/// UAK Money +public typealias UAK = _Money +/// UGS Money +public typealias UGS = _Money +/// UGX Money +public typealias UGX = _Money +/// USD Money +public typealias USD = _Money +/// USN Money +public typealias USN = _Money +/// USS Money +public typealias USS = _Money +/// UYI Money +public typealias UYI = _Money +/// UYP Money +public typealias UYP = _Money +/// UYU Money +public typealias UYU = _Money +/// UZS Money +public typealias UZS = _Money +/// VEB Money +public typealias VEB = _Money +/// VEF Money +public typealias VEF = _Money +/// VND Money +public typealias VND = _Money +/// VNN Money +public typealias VNN = _Money +/// VUV Money +public typealias VUV = _Money +/// WST Money +public typealias WST = _Money +/// XAF Money +public typealias XAF = _Money +/// XAG Money +public typealias XAG = _Money +/// XAU Money +public typealias XAU = _Money +/// XBA Money +public typealias XBA = _Money +/// XBB Money +public typealias XBB = _Money +/// XBC Money +public typealias XBC = _Money +/// XBD Money +public typealias XBD = _Money +/// XCD Money +public typealias XCD = _Money +/// XDR Money +public typealias XDR = _Money +/// XEU Money +public typealias XEU = _Money +/// XFO Money +public typealias XFO = _Money +/// XFU Money +public typealias XFU = _Money +/// XOF Money +public typealias XOF = _Money +/// XPD Money +public typealias XPD = _Money +/// XPF Money +public typealias XPF = _Money +/// XPT Money +public typealias XPT = _Money +/// XRE Money +public typealias XRE = _Money +/// XSU Money +public typealias XSU = _Money +/// XTS Money +public typealias XTS = _Money +/// XUA Money +public typealias XUA = _Money +/// XXX Money +public typealias XXX = _Money +/// YDD Money +public typealias YDD = _Money +/// YER Money +public typealias YER = _Money +/// YUD Money +public typealias YUD = _Money +/// YUM Money +public typealias YUM = _Money +/// YUN Money +public typealias YUN = _Money +/// YUR Money +public typealias YUR = _Money +/// ZAL Money +public typealias ZAL = _Money +/// ZAR Money +public typealias ZAR = _Money +/// ZMK Money +public typealias ZMK = _Money +/// ZMW Money +public typealias ZMW = _Money +/// ZRN Money +public typealias ZRN = _Money +/// ZRZ Money +public typealias ZRZ = _Money +/// ZWL Money +public typealias ZWL = _Money +/// ZWR Money +public typealias ZWR = _Money +/// ZWD Money +public typealias ZWD = _Money diff --git a/Money/Currency.swift b/Money/Currency.swift new file mode 100644 index 0000000..9726930 --- /dev/null +++ b/Money/Currency.swift @@ -0,0 +1,159 @@ +// +// Currency.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation + +/** + # CurrencyType + This protocol defines the minimum interface needed for a + CurrencyType. + + The interface used to represent a single currency. Note + that it is always used as a generic constraint on other + types. + + Typically framework consumers will not need to conform to + this protocol, unless creating their own currencies. See + the example project "Custom Money" for an example of this. +*/ +public protocol CurrencyType: DecimalNumberBehaviorType { + + /// The currency code + static var code: String { get } + + /// The currency symbol + static var symbol: String { get } + + /// The currency scale + static var scale: Int { get } + + /// A number formatter for the currency + static var formatter: NSNumberFormatter { get } +} + +public extension CurrencyType { + + /** + Default implementation of the `NSDecimalNumberBehaviors` for + the currency. This uses `NSRoundingMode.RoundBankers` and the + scale of the currency as given by the localized formatter. + + - returns: a `NSDecimalNumberBehaviors` + */ + static var decimalNumberBehaviors: NSDecimalNumberBehaviors { + return NSDecimalNumberHandler( + roundingMode: .RoundBankers, + scale: Int16(scale), + raiseOnExactness: true, + raiseOnOverflow: true, + raiseOnUnderflow: true, + raiseOnDivideByZero: true + ) + } +} + +/** + `_CurrencyType` is a refinement of `CurrencyType` so that + autogenerated currencies can be created. +*/ +public protocol _CurrencyType: CurrencyType { + + static var sharedInstance: Self { get } + + var _locale: NSLocale { get } + + var _formatter: NSNumberFormatter { get } +} + +public extension _CurrencyType { + + /// The currency code + static var code: String { + return formatter.currencyCode + } + + /// The currency symbol + static var symbol: String { + return formatter.currencySymbol + } + + /// The currency scale + static var scale: Int { + return formatter.maximumFractionDigits + } + + /// Returns a formatter from the shared instance + static var formatter: NSNumberFormatter { + return sharedInstance._formatter + } +} + +/** + # Currency + A namespace for currency related types. +*/ +public struct Currency { + + /** + # Currency.Base + `Currency.Base` is a class which composes a number formatter + and a locale. It doesn't conform to `CurrencyType` but it can + be used as a base class for currency types which only require + a shared instance. + */ + public class Base { + + public let _formatter: NSNumberFormatter + public let _locale: NSLocale + + init(locale: NSLocale) { + _formatter = { + let fmtr = NSNumberFormatter() + fmtr.numberStyle = .CurrencyStyle + fmtr.locale = locale + return fmtr + }() + _locale = locale + } + + convenience init(code: String) { + self.init(locale: NSLocale(localeIdentifier: NSLocale.localeIdentifierFromComponents([NSLocaleCurrencyCode: code]))) + } + } + + /** + # Currency.Local + `Currency.Local` is a `BaseCurrency` subclass which represents + the device's current currency, using `NSLocale.currencyLocale()`. + */ + public final class Local: Currency.Base, _CurrencyType { + public static var sharedInstance = Local(locale: NSLocale.currentLocale()) + } +} + + + diff --git a/Money/Decimal/Decimal.swift b/Money/Decimal/Decimal.swift new file mode 100644 index 0000000..aaad6f7 --- /dev/null +++ b/Money/Decimal/Decimal.swift @@ -0,0 +1,218 @@ +// +// Decimal.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation +import ValueCoding + +/** + # Decimal + A value type which implements `DecimalNumberType` using `NSDecimalNumber` internally. + + It is generic over the decimal number behavior type, which defines the rounding + and scale rules for base 10 decimal arithmetic. +*/ +public struct _Decimal: DecimalNumberType { + public typealias DecimalNumberBehavior = Behavior + + /// Access the underlying decimal storage. + /// - returns: the `NSDecimalNumber` + public let storage: NSDecimalNumber + + /// Flag to indicate if the decimal number is less than zero + public var isNegative: Bool { + return storage.isNegative + } + + /// The negative of Self. + /// - returns: a `_Decimal` + public var negative: _Decimal { + return _Decimal(storage: storage.negateWithBehaviors(Behavior.decimalNumberBehaviors)) + } + + /// Text description. + public var description: String { + return "\(storage.description)" + } + + /** + Initialize a new value using the underlying decimal storage. + + - parameter storage: a `NSDecimalNumber` defaults to zero. + */ + public init(storage: NSDecimalNumber = NSDecimalNumber.zero()) { + self.storage = storage + } + + /** + Initialize a new value using a `FloatLiteralType` + + - parameter floatLiteral: a `FloatLiteralType` for the system, probably `Double`. + */ + public init(floatLiteral value: FloatLiteralType) { + self.init(storage: NSDecimalNumber(floatLiteral: value).decimalNumberByRoundingAccordingToBehavior(Behavior.decimalNumberBehaviors)) + } + + /** + Initialize a new value using a `IntegerLiteralType` + + - parameter integerLiteral: a `IntegerLiteralType` for the system, probably `Int`. + */ + public init(integerLiteral value: IntegerLiteralType) { + switch value { + case 0: + self.init(storage: NSDecimalNumber.zero()) + case 1: + self.init(storage: NSDecimalNumber.one()) + default: + self.init(storage: NSDecimalNumber(integerLiteral: value).decimalNumberByRoundingAccordingToBehavior(Behavior.decimalNumberBehaviors)) + } + } + + /** + Subtract a matching `_Decimal` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func subtract(other: _Decimal, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Decimal { + return _Decimal(storage: storage.subtract(other.storage, withBehaviors: behaviors)) + } + + /** + Add a matching `_Decimal` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func add(other: _Decimal, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Decimal { + return _Decimal(storage: storage.add(other.storage, withBehaviors: behaviors)) + } + + /** + Multiply a matching `_Decimal` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func multiplyBy(other: _Decimal, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Decimal { + return _Decimal(storage: storage.multiplyBy(other.storage, withBehaviors: behaviors)) + } + + /** + Divide a matching `_Decimal` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func divideBy(other: _Decimal, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Decimal { + return _Decimal(storage: storage.divideBy(other.storage, withBehaviors: behaviors)) + } + + /** + The remainder of dividing another `_Decimal` into the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func remainder(other: _Decimal, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Decimal { + return _Decimal(storage: storage.remainder(other.storage, withBehaviors: behaviors)) + } +} + +public func ==(lhs: _Decimal, rhs: _Decimal) -> Bool { + return lhs.storage == rhs.storage +} + +public func <(lhs: _Decimal, rhs: _Decimal) -> Bool { + return lhs.storage < rhs.storage +} + +/// `Decimal` with plain decimal number behavior +public typealias Decimal = _Decimal + +/// `BankersDecimal` with banking decimal number behavior +public typealias BankersDecimal = _Decimal + +// MARK: - Value Coding + +extension _Decimal: ValueCoding { + public typealias Coder = _DecimalCoder +} + +/** + Coding class to support `_Decimal` `ValueCoding` conformance. +*/ +public final class _DecimalCoder: NSObject, NSCoding, CodingType { + + public let value: _Decimal + + public required init(_ v: _Decimal) { + value = v + } + + public init?(coder aDecoder: NSCoder) { + let storage = aDecoder.decodeObjectForKey("storage") as! NSDecimalNumber + value = _Decimal(storage: storage) + } + + public func encodeWithCoder(aCoder: NSCoder) { + aCoder.encodeObject(value.storage, forKey: "storage") + } +} + + + +// TODO: - Move these into DecimalNumberType + +extension NSNumberFormatter { + + func stringFromDecimal(decimal: _Decimal) -> String? { + return stringFromNumber(decimal.storage) + } + + func formattedStringWithStyle(style: NSNumberFormatterStyle) -> _Decimal -> String { + let currentStyle = numberStyle + numberStyle = style + let result: _Decimal -> String = { decimal in + return self.stringFromDecimal(decimal)! + } + numberStyle = currentStyle + return result + } +} + + diff --git a/Money/Decimal/DecimalNumberType.swift b/Money/Decimal/DecimalNumberType.swift new file mode 100644 index 0000000..abf95e6 --- /dev/null +++ b/Money/Decimal/DecimalNumberType.swift @@ -0,0 +1,310 @@ +// +// DecimalNumberType.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation + +public protocol DecimalNumberBehaviorType { + + /// Specify the decimal number (i.e. rounding, scale etc) for base 10 calculations + static var decimalNumberBehaviors: NSDecimalNumberBehaviors { get } +} + +public struct DecimalNumberBehavior { + + private static func behaviorWithRoundingMode(mode: NSRoundingMode) -> NSDecimalNumberBehaviors { + return NSDecimalNumberHandler(roundingMode: mode, scale: 38, raiseOnExactness: false, raiseOnOverflow: true, raiseOnUnderflow: true, raiseOnDivideByZero: true) + } + + public struct Plain: DecimalNumberBehaviorType { + public static let decimalNumberBehaviors = DecimalNumberBehavior.behaviorWithRoundingMode(.RoundPlain) + } + + public struct RoundDown: DecimalNumberBehaviorType { + public static let decimalNumberBehaviors = DecimalNumberBehavior.behaviorWithRoundingMode(.RoundDown) + } + + public struct RoundUp: DecimalNumberBehaviorType { + public static let decimalNumberBehaviors = DecimalNumberBehavior.behaviorWithRoundingMode(.RoundUp) + } + + public struct Bankers: DecimalNumberBehaviorType { + public static let decimalNumberBehaviors = DecimalNumberBehavior.behaviorWithRoundingMode(.RoundBankers) + } +} + + +/** + # DecimalNumberType + A protocol which defines the necessary interface to support decimal number + calculations and operators. + */ +public protocol DecimalNumberType: SignedNumberType, IntegerLiteralConvertible, FloatLiteralConvertible, CustomStringConvertible { + + typealias DecimalStorageType + typealias DecimalNumberBehavior: DecimalNumberBehaviorType + + /// Access the underlying storage + var storage: DecimalStorageType { get } + + /// Flag to indicate if the decimal number is less than zero + var isNegative: Bool { get } + + /** + Negates the receiver, equivalent to multiplying it by -1 + - returns: another instance of this type. + */ + var negative: Self { get } + + /** + Initialize a new `DecimalNumberType` with the underlying storage. + This is necessary in order to convert between different decimal number + types. + + - parameter storage: the underlying decimal storage type + e.g. NSDecimalNumber or NSDecimal + */ + init(storage: DecimalStorageType) + + /** + Subtract a matching `DecimalNumberType` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + func subtract(_: Self, withBehaviors: NSDecimalNumberBehaviors) -> Self + + /** + Add a matching `DecimalNumberType` to the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + func add(_: Self, withBehaviors: NSDecimalNumberBehaviors) -> Self + + /** + Multiply a matching `DecimalNumberType` with the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + func multiplyBy(_: Self, withBehaviors: NSDecimalNumberBehaviors) -> Self + + /** + Multiply another `DecimalNumberType` with the receiver. The other + `DecimalNumberType` must have the same underlying `DecimalStorageType` as + this `DecimalNumberType`. + + - parameter other: another `DecimalNumberType` value of different type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a different `DecimalNumberType` value. + */ + @warn_unused_result + func multiplyBy(_: Other, withBehaviors: NSDecimalNumberBehaviors) -> Other + + /** + Divide the receiver by a matching `DecimalNumberType`. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + func divideBy(_: Self, withBehaviors: NSDecimalNumberBehaviors) -> Self + + /** + Divide the receiver by another `DecimalNumberType`. The other + `DecimalNumberType` must have the same underlying `DecimalStorageType` as + this `DecimalNumberType`. + + - parameter other: another `DecimalNumberType` value of different type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + func divideBy(_: Other, withBehaviors: NSDecimalNumberBehaviors) -> Other + + /** + The remainder of dividing another `DecimalNumberType` into the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + func remainder(_: Self, withBehaviors: NSDecimalNumberBehaviors) -> Self +} + +// MARK: - Subtraction + +@warn_unused_result +public func -(lhs: T, rhs: T) -> T { + return lhs.subtract(rhs, withBehaviors: T.DecimalNumberBehavior.decimalNumberBehaviors) +} + +@warn_unused_result +public func -(lhs: T, rhs: T.IntegerLiteralType) -> T { + return lhs - T(integerLiteral: rhs) +} + +@warn_unused_result +public func -(lhs: T.IntegerLiteralType, rhs: T) -> T { + return T(integerLiteral: lhs) - rhs +} + +@warn_unused_result +public func -(lhs: T, rhs: T.FloatLiteralType) -> T { + return lhs - T(floatLiteral: rhs) +} + +@warn_unused_result +public func -(lhs: T.FloatLiteralType, rhs: T) -> T { + return T(floatLiteral: lhs) - rhs +} + +// MARK: - Remainder + +@warn_unused_result +public func %(lhs: T, rhs: T) -> T { + return lhs.remainder(rhs, withBehaviors: T.DecimalNumberBehavior.decimalNumberBehaviors) +} + +// MARK: - Addition + +@warn_unused_result +public func +(lhs: T, rhs: T) -> T { + return lhs.add(rhs, withBehaviors: T.DecimalNumberBehavior.decimalNumberBehaviors) +} + +@warn_unused_result +public func +(lhs: T, rhs: T.IntegerLiteralType) -> T { + return lhs + T(integerLiteral: rhs) +} + +@warn_unused_result +public func +(lhs: T.IntegerLiteralType, rhs: T) -> T { + return T(integerLiteral: lhs) + rhs +} + +@warn_unused_result +public func +(lhs: T, rhs: T.FloatLiteralType) -> T { + return lhs + T(floatLiteral: rhs) +} + +@warn_unused_result +public func +(lhs: T.FloatLiteralType, rhs: T) -> T { + return T(floatLiteral: lhs) + rhs +} + +// MARK: - Multiplication + +@warn_unused_result +public func *(lhs: T, rhs: T) -> T { + return lhs.multiplyBy(rhs, withBehaviors: T.DecimalNumberBehavior.decimalNumberBehaviors) +} + +@warn_unused_result +public func *(lhs: T, rhs: T.IntegerLiteralType) -> T { + return lhs * T(integerLiteral: rhs) +} + +@warn_unused_result +public func *(lhs: T, rhs: T.FloatLiteralType) -> T { + return lhs * T(floatLiteral: rhs) +} + +@warn_unused_result +public func *(lhs: T.IntegerLiteralType, rhs: T) -> T { + return rhs * lhs +} + +@warn_unused_result +public func *(lhs: T.FloatLiteralType, rhs: T) -> T { + return rhs * lhs +} + +@warn_unused_result +public func *(lhs: T, rhs: V) -> V { + return lhs.multiplyBy(rhs, withBehaviors: V.DecimalNumberBehavior.decimalNumberBehaviors) +} + +// MARK: - Division + +@warn_unused_result +public func /(lhs: T, rhs: T) -> T { + return lhs.divideBy(rhs, withBehaviors: T.DecimalNumberBehavior.decimalNumberBehaviors) +} + +@warn_unused_result +public func /(lhs: T, rhs: T.IntegerLiteralType) -> T { + return lhs / T(integerLiteral: rhs) +} + +@warn_unused_result +public func /(lhs: T, rhs: T.FloatLiteralType) -> T { + return lhs / T(floatLiteral: rhs) +} + +@warn_unused_result +public func /(lhs: T, rhs: V) -> V { + return lhs.divideBy(rhs, withBehaviors: V.DecimalNumberBehavior.decimalNumberBehaviors) +} + +extension DecimalNumberType where DecimalStorageType == NSDecimalNumber { + + @warn_unused_result + public func multiplyBy(other: Other, withBehaviors behaviors: NSDecimalNumberBehaviors) -> Other { + return Other(storage: storage.multiplyBy(other.storage, withBehaviors: behaviors)) + } + + @warn_unused_result + public func divideBy(other: Other, withBehaviors behaviors: NSDecimalNumberBehaviors) -> Other { + return Other(storage: storage.divideBy(other.storage, withBehaviors: behaviors)) + } +} + +extension DecimalNumberType where Self.IntegerLiteralType == Int { + + /// Get the reciprocal of the receiver. + public var reciprocal: Self { + return Self(integerLiteral: 1).divideBy(self, withBehaviors: DecimalNumberBehavior.decimalNumberBehaviors) + } +} + + + diff --git a/Money/Decimal/NSDecimalExtensions.swift b/Money/Decimal/NSDecimalExtensions.swift new file mode 100644 index 0000000..68edfb0 --- /dev/null +++ b/Money/Decimal/NSDecimalExtensions.swift @@ -0,0 +1,170 @@ +// +// NSDecimalExtensions.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation + +// MARK: - Equality + +public func ==(var lhs: NSDecimal, var rhs: NSDecimal) -> Bool { + return NSDecimalCompare(&lhs, &rhs) == .OrderedSame +} + +// MARK: - Comparable + +public func <(var lhs: NSDecimal, var rhs: NSDecimal) -> Bool { + return NSDecimalCompare(&lhs, &rhs) == .OrderedAscending +} + +/** + # NSDecimal Extension + This is an extension on NSDecimal to support `DecimalNumberType` and + `Decimal`. + */ +extension NSDecimal: Comparable { + + /** + Static function to get the `NSDecimal` representation of + zero. + + - returns: a `NSDecimal` of zero. + */ + public static func zero() -> NSDecimal { + return NSDecimalNumber.zero().decimalValue + } + + /** + Static function to get the `NSDecimal` representation of + positive one. + + - returns: a `NSDecimal` of one. + */ + public static func one() -> NSDecimal { + return NSDecimalNumber.one().decimalValue + } + + /** + Boolean flag to indicate if the receive is a negative + number. + + - returns: a `Bool` if the value is below zero. + */ + public var isNegative: Bool { + return self < NSDecimal.zero() + } + + internal init() { + self = NSDecimal.zero() + } + + /** + Subtract a `NSDecimal` from the receiver. + + - parameter other: another `NSDecimal`. + - parameter roundingMode: the NSRoundingMode to use for the calculation. + - returns: a `NSDecimal`. + */ + @warn_unused_result + public func subtract(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal { + var lhs = self + var result = NSDecimal() + NSDecimalSubtract(&result, &lhs, &rhs, roundingMode) + return result + } + + /** + Add a `NSDecimal` to the receiver. + + - parameter other: another `NSDecimal`. + - parameter roundingMode: the NSRoundingMode to use for the calculation. + - returns: a `NSDecimal`. + */ + @warn_unused_result + public func add(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal { + var lhs = self + var result = NSDecimal() + NSDecimalAdd(&result, &lhs, &rhs, roundingMode) + return result + } + + /** + Multiply a `NSDecimal` with the receiver. + + - parameter other: another `NSDecimal`. + - parameter roundingMode: the NSRoundingMode to use for the calculation. + - returns: a `NSDecimal`. + */ + @warn_unused_result + public func multiplyBy(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal { + var lhs = self + var result = NSDecimal() + NSDecimalMultiply(&result, &lhs, &rhs, roundingMode) + return result + } + + /** + Divide the receiver by a matching `NSDecimal`. + + - parameter other: another `NSDecimal`. + - parameter roundingMode: the NSRoundingMode to use for the calculation. + - returns: a `NSDecimal`. + */ + @warn_unused_result + public func divideBy(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal { + var lhs = self + var result = NSDecimal() + NSDecimalDivide(&result, &lhs, &rhs, roundingMode) + return result + } + + /** + Calculates the negative of the receiver. + + - parameter roundingMode: the NSRoundingMode to use for the calculation. + - returns: a `NSDecimal`. + */ + public func negateWithRoundingMode(roundingMode: NSRoundingMode) -> NSDecimal { + let negativeOne = NSDecimal.zero().subtract(NSDecimal.one(), withRoundingMode: roundingMode) + let result = multiplyBy(negativeOne, withRoundingMode: roundingMode) + return result + } + + /** + The remainder of dividing another `NSDecimal` into the receiver. + + - parameter other: another `NSDecimal`. + - parameter roundingMode: the NSRoundingMode to use for the calculation. + - returns: a `NSDecimal`. + */ + @warn_unused_result + public func remainder(_rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal { + let lhs = NSDecimalNumber(decimal: self) + let rhs = NSDecimalNumber(decimal: _rhs) + let behaviors = NSDecimalNumberHandler(roundingMode: roundingMode, scale: 38, raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: true) + let result = lhs.remainder(rhs, withBehaviors: behaviors) + return result.decimalValue + } +} diff --git a/Money/Decimal/NSDecimalNumberExtensions.swift b/Money/Decimal/NSDecimalNumberExtensions.swift new file mode 100644 index 0000000..bb37faf --- /dev/null +++ b/Money/Decimal/NSDecimalNumberExtensions.swift @@ -0,0 +1,136 @@ +// +// NSDecimalNumberExtensions.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation + +// MARK: - Equality + +public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool { + return lhs.isEqualToNumber(rhs) +} + +// MARK: - Comparable + +public func <(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool { + return lhs.compare(rhs) == .OrderedAscending +} + +/** + # NSDecimalNumber Extension + This is an extension on NSDecimalNumber to support `DecimalNumberType` and + `Decimal`. + + Note that NSDecimalNumber cannot conform to `DecimalNumberType` directly + because it is a framework class which cannot be made final, and the protocol + has functions which return Self. + */ +extension NSDecimalNumber: Comparable { + + public var isNegative: Bool { + return self < NSDecimalNumber.zero() + } + + /** + Subtract a `NSDecimalNumber` from the receiver. + + - parameter other: another `NSDecimalNumber`. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a `NSDecimalNumber`. + */ + @warn_unused_result + public func subtract(other: NSDecimalNumber, withBehaviors behaviors: NSDecimalNumberBehaviors?) -> NSDecimalNumber { + return decimalNumberBySubtracting(other, withBehavior: behaviors) + } + + /** + Add a `NSDecimalNumber` to the receiver. + + - parameter other: another `NSDecimalNumber`. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a `NSDecimalNumber`. + */ + @warn_unused_result + public func add(other: NSDecimalNumber, withBehaviors behaviors: NSDecimalNumberBehaviors?) -> NSDecimalNumber { + return decimalNumberByAdding(other, withBehavior: behaviors) + } + + /** + Multiply a `NSDecimalNumber` with the receiver. + + - parameter other: another `NSDecimalNumber`. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a `NSDecimalNumber`. + */ + @warn_unused_result + public func multiplyBy(other: NSDecimalNumber, withBehaviors behaviors: NSDecimalNumberBehaviors?) -> NSDecimalNumber { + return decimalNumberByMultiplyingBy(other, withBehavior: behaviors) + } + + /** + Divide the receiver by a matching `NSDecimalNumber`. + + - parameter other: another `NSDecimalNumber`. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a `NSDecimalNumber`. + */ + @warn_unused_result + public func divideBy(other: NSDecimalNumber, withBehaviors behaviors: NSDecimalNumberBehaviors?) -> NSDecimalNumber { + return decimalNumberByDividingBy(other, withBehavior: behaviors) + } + + /** + Calculates the negative of the receiver. + + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a `NSDecimalNumber`. + */ + public func negateWithBehaviors(behaviors: NSDecimalNumberBehaviors?) -> NSDecimalNumber { + let negativeOne = NSDecimalNumber(mantissa: 1, exponent: 0, isNegative: true) + let result = decimalNumberByMultiplyingBy(negativeOne, withBehavior: behaviors) + return result + } + + /** + The remainder of dividing another `NSDecimalNumber` into the receiver. + + - parameter other: another `NSDecimalNumber`. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: a `NSDecimalNumber`. + */ + @warn_unused_result + public func remainder(other: NSDecimalNumber, withBehaviors behaviors: NSDecimalNumberBehaviors?) -> NSDecimalNumber { + let roundingMode: NSRoundingMode = Int(isNegative) ^ Int(other.isNegative) ? .RoundUp : .RoundDown + let roundingBehaviors = NSDecimalNumberHandler(roundingMode: roundingMode, scale: 0, raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: false) + let quotient = divideBy(other, withBehaviors: roundingBehaviors) + let toSubtract = quotient.multiplyBy(other, withBehaviors: behaviors) + let result = subtract(toSubtract, withBehaviors: behaviors) + + return result + } +} + + diff --git a/Money/FX.swift b/Money/FX.swift new file mode 100644 index 0000000..4098bae --- /dev/null +++ b/Money/FX.swift @@ -0,0 +1,484 @@ +// +// FX.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation +import Result +import SwiftyJSON + +/** + # MoneyPairType + Used to represent currency pairs. + + - see: [Wikipedia](https://en.wikipedia.org/wiki/Currency_pair) + */ +public protocol MoneyPairType { + + /// The currency which the quote is in relation to. + typealias BaseMoney: MoneyType + + /// The currency which is being traded/quoted + typealias CounterMoney: MoneyType +} + +// MARK: - FX Types + +/** + # Quote + The minimum interface required to perform a foreign + currency exchange. +*/ +public class FXQuote { + + /// The exchange rate, stored as a `BankersDecimal`. + public let rate: BankersDecimal + + /** + Construct with the rate + */ + public init(rate: BankersDecimal) { + self.rate = rate + } + + /** + ## Calculate transaction value + Lets assume we want to convert EUR 100 in to USD. The + quote type has the rate of EUR/USD stored in a + bankers decimal. The framework will effectively do + something like this: + + let eur: EUR = 100 + let usd: USD = rate.transactionValueForBaseValue(eur) + + Most foreign exchange services will build their commission + into their rates. So to implement a provider for a serivce + can work just like the `Yahoo` one here. + */ + public func transactionValueForBaseValue(base: B) -> C { + return base.convertWithRate(rate) + } +} + +// MARK: - FX Provider Errors + +/** + # FXError + This is an error type used in FX methods. +*/ +public enum FXError: ErrorType, Equatable { + + /// When there is a network error + case NetworkError(NSError) + + /// If there was no data/response + case NoData + + /// If the data was corrupted or invalid + case InvalidData(NSData) + + /// If a rate could not be found + case RateNotFound(String) +} + +/** + # FX Provider + `FXProviderType` defines the interface for a FX + provider. + + `FXProviderType` refines `CurrencyPairType` which + means that FX Providers should be generic types. E.g. + + AcmeFX + + would be the provider type, to exchange EUR to USD + using AcmeFX services. +*/ +public protocol FXProviderType: MoneyPairType { + + /// The name of the provider. + static func name() -> String +} + +// MARK: - Protocol: Local Provider + +/** + # FX Local Provider + `FXLocalProvider` defines an interface for a FX service + which stores its rates locally, and can make synchronous + exchanges. + + A typical usage for this would be when converting between + your applications custom currencies, for example in a game. +*/ +public protocol FXLocalProviderType: FXProviderType { + + /** + Generate the quote using the `BaseMoney` and + `CounterMoney` generic types. + + - returns: a `FXQuote` which contains the rate. + */ + static func quote() -> FXQuote +} + +extension FXLocalProviderType where BaseMoney.DecimalStorageType == BankersDecimal.DecimalStorageType, CounterMoney.DecimalStorageType == BankersDecimal.DecimalStorageType { + + /** + This is the primary API used to determine for Foreign Exchange transactions. + */ + public static func fx(base: BaseMoney) -> CounterMoney { + return base.convertWithRate(quote().rate) + } +} + +// MARK: - Protocol: Remote Provider + +/** + FX Providers which get their rates via a network request + should conform to `FXRemoteProviderType`, which defines + how the network request should be made. +*/ +public protocol FXRemoteProviderType: FXProviderType { + + /** + Return the NSURLSession to use to make the request. It + should be notes that this session must be retained by + something in memory, e.g. use a shared session, or + a session owned by a singleton. + + By default, returns `NSURLSession.sharedSession()`. + + - returns: a `NSURLSession`. + */ + static func session() -> NSURLSession + + /** + Create a suitable NSURLRequest to convert from the + base currency code to the target currency code. + + Typically, these will just be contatanted together + to form a ticker, however, some providers may use + query paramters. + + - parameter base: the currency code of the base currency, a `String` + - parameter symbol: the currency code of the target currency, a `String` + - returns: a `NSURLRequest` + */ + static func request() -> NSURLRequest + + /** + Parse the received NSData into the providers own QuoteType. More + than likely, this will just be `FXQuote`, but providers may + support fees/commission info which needs representing. + + - parameter data: the `NSData` received from the service provider + - returns: a `Result` generic over the `QuoteType` and `FX.Error` which + supports general errors for mal-formed or missing information. + */ + static func quoteFromNetworkResult(result: Result<(NSData?, NSURLResponse?), NSError>) -> Result +} + +// MARK: - FXRemoteProviderType Extension + +extension FXRemoteProviderType { + + /** + Default implementation to return the shared + `NSURLSession`. + */ + public static func session() -> NSURLSession { + return NSURLSession.sharedSession() + } +} + +extension FXRemoteProviderType where BaseMoney.DecimalStorageType == BankersDecimal.DecimalStorageType, CounterMoney.DecimalStorageType == BankersDecimal.DecimalStorageType { + + internal static func fxFromQuoteWithBase(base: BaseMoney) -> FXQuote -> CounterMoney { + return { $0.transactionValueForBaseValue(base) } + } + + /** + # FX + This is the primary API used to determine for Foreign Exchange transactions. Using the + `Yahoo` FX Provider as an example, we would use it like this.. + + let gbp: GBP = 100 // We have £100 + Yahoo.fx(gbp) { result in + guard let usd = result.value?.counter else { + print("Received an `FXError`") + } + print("We have \(usd)") // We have $119 (or whatever) + } + */ + public static func fx(base: BaseMoney, completion: Result -> Void) -> NSURLSessionDataTask { + let client = FXServiceProviderNetworkClient(session: session()) + let fxFromQuote = fxFromQuoteWithBase(base) + return client.get(request(), adaptor: quoteFromNetworkResult) { completion($0.map(fxFromQuote)) } + } +} + +// MARK: - FX Network Client + +internal class FXServiceProviderNetworkClient { + let session: NSURLSession + + init(session: NSURLSession = NSURLSession.sharedSession()) { + self.session = session + } + + func get(request: NSURLRequest, adaptor: Result<(NSData?, NSURLResponse?), NSError> -> Result, completion: Result -> Void) -> NSURLSessionDataTask { + let task = session.dataTaskWithRequest(request) { data, response, error in + let result = error.map { Result(error: $0) } ?? Result(value: (data, response)) + completion(adaptor(result)) + } + task.resume() + return task + } +} + +public class FXRemoteProvider { + public typealias BaseMoney = B + public typealias CounterMoney = T +} + +// MARK: - Yahoo FX Service Provider + +/** + # Yahoo FX + This type uses Yahoo's Currency Converter. E.g. + + It is generic over two `MoneyType`s, and is only + used as a type - there is no initializer. + + ```swift + Yahoo.fx(100) { jpy in + print("\(jpy)") // is a Result + } + ``` + +*/ +public final class Yahoo: FXRemoteProvider, FXRemoteProviderType { + + /** + Access the name of the FX provider (e.g. "Yahoo USDEUR" + + - returns: a `String`. + */ + public static func name() -> String { + return "Yahoo \(Base.Currency.code)\(Counter.Currency.code)" + } + + /** + Constructs the `NSURLRequest` to Yahoo's currency convertor service. + + - returns: a `NSURLRequest`. + */ + public static func request() -> NSURLRequest { + return NSURLRequest(URL: NSURL(string: "https://download.finance.yahoo.com/d/quotes.csv?s=\(BaseMoney.Currency.code)\(CounterMoney.Currency.code)=X&f=nl1")!) + } + + /** + This function is used to map the network result into a quote. + + - paramter result: the network result, represented as `Result` where + the value, T, is a tuple of data and response. The error, E, is an `NSError`. + - returns: a `Result`. + */ + public static func quoteFromNetworkResult(result: Result<(NSData?, NSURLResponse?), NSError>) -> Result { + return result.analysis( + + ifSuccess: { data, response in + + guard let data = data else { + return Result(error: .NoData) + } + + guard let str = String(data: data, encoding: NSUTF8StringEncoding) else { + return Result(error: .InvalidData(data)) + } + + let components = str.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).componentsSeparatedByString(",") + + if components.count < 2 { + return Result(error: .InvalidData(data)) + } + + guard let rate = Double(components[1]) else { + return Result(error: .RateNotFound(str)) + } + + return Result(value: FXQuote(rate: BankersDecimal(floatLiteral: rate))) + }, + + ifFailure: { error in + return Result(error: .NetworkError(error)) + } + ) + } +} + +// MARK: - Open Exchange Rates FX Service Provider + +/** + # Open Exchange Rates + Open Exchange Rates (OER) is a popular FX provider, + which does have a "forever free" service, which will + only return rates for all supported currencies with + USD as the base currency. + + Paid for access allows specification of the base & + counter currency. + + All access requires an "app_id", even the forever + free one. + + This protocol defines a type which can return the + app_id. Therefore, consumers should define their + own type which conforms, and then using whatever + mechanism you want, return your OER app_id. I + recommend using something like [CocoaPod Keys](https://github.com/orta/cocoapods-keys) + + Lets say, you create this... + + + struct MyOpenExchangeRatesAppID: OpenExchangeRatesAppID { + static let app_id = "blarblarblarblar" + } + + Now, create subclasses of `_OpenExchangeRates` or + `_ForeverFreeOpenExchangeRates` depending on your access level. + + e.g. If you have a forever free app_id: + + + class OpenExchangeRates: _ForeverFreeOpenExchangeRates { } + + usage would then be like this: + + + let usd: USD = 100 + OpenExchangeRates.fx(usd) { result in + // etc, result will include the GBP exchanged for US$ 100 + } + + If you have paid for access to OpenExchangeRates then instead + create the following subclass: + + + class OpenExchangeRates: _OpenExchangeRates { } + + - see: [https://openexchangerates.org](https://openexchangerates.org) + - see: [CocoaPod Keys](https://github.com/orta/cocoapods-keys) + +*/ +public protocol OpenExchangeRatesAppID { + static var app_id: String { get } +} + +/** + # Open Exchange Rates + Base class for OpenExchangeRates.org. See the docs above. + + - see: `OpenExchangeRatesAppID` +*/ +public class _OpenExchangeRates: FXRemoteProvider, FXRemoteProviderType { + + public static func name() -> String { + return "OpenExchangeRates.org \(Base.Currency.code)\(Counter.Currency.code)" + } + + public static func request() -> NSURLRequest { + var url = NSURL(string: "https://openexchangerates.org/api/latest.json?app_id=\(ID.app_id)")! + + switch BaseMoney.Currency.code { + case Currency.USD.code: + break + default: + url = url.URLByAppendingPathComponent("&base=\(BaseMoney.Currency.code)") + } + + return NSURLRequest(URL: url) + } + + public static func quoteFromNetworkResult(result: Result<(NSData?, NSURLResponse?), NSError>) -> Result { + return result.analysis( + + ifSuccess: { data, response in + + guard let data = data else { + return Result(error: .NoData) + } + + let json = JSON(data: data) + + if json.isEmpty { + return Result(error: .InvalidData(data)) + } + + guard let rate = json[["rates", CounterMoney.Currency.code]].double else { + return Result(error: .RateNotFound(name())) + } + + return Result(value: FXQuote(rate: BankersDecimal(floatLiteral: rate))) + }, + + ifFailure: { error in + return Result(error: .NetworkError(error)) + } + ) + } +} + +/** + # Open Exchange Rates + Forever Free class for OpenExchangeRates.org. See the docs above. + + - see: `OpenExchangeRatesAppID` + */ +public class _ForeverFreeOpenExchangeRates: _OpenExchangeRates { } + + + + + + + + +public func ==(lhs: FXError, rhs: FXError) -> Bool { + switch (lhs, rhs) { + case let (.NetworkError(aError), .NetworkError(bError)): + return aError.isEqual(bError) + case (.NoData, .NoData): + return true + case let (.InvalidData(aData), .InvalidData(bData)): + return aData.isEqualToData(bData) + case let (.RateNotFound(aStr), .RateNotFound(bStr)): + return aStr == bStr + default: + return false + } +} + diff --git a/Money/Money.swift b/Money/Money.swift new file mode 100644 index 0000000..7e5e7f3 --- /dev/null +++ b/Money/Money.swift @@ -0,0 +1,262 @@ +// +// Money.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation +import ValueCoding + +/** + # MoneyType + `MoneyType` is a protocol which refines `DecimalNumberType`. It + adds a generic type for the currency. +*/ +public protocol MoneyType: DecimalNumberType { + typealias Currency: CurrencyType + + /// Access the underlying decimal + var decimal: _Decimal { get } + + init(_: _Decimal) +} + +/** + # Money + `_Money` is a value type, conforming to `MoneyType`, which is generic over the currency type. + + To work in whatever the local currency is, use `Money`. It should not + be necessary to use `_Money` directly, instead, use a currency + typealias, such as `USD` or `GBP`. +*/ +public struct _Money: MoneyType { + + public typealias DecimalNumberBehavior = C + public typealias Currency = C + + /// Access the underlying decimal. + /// - returns: the `_Decimal` + public let decimal: _Decimal + + /// Access the underlying decimal storage. + /// - returns: the `_Decimal.DecimalStorageType` + public var storage: _Decimal.DecimalStorageType { + return decimal.storage + } + + /// Flag to indicate if the decimal number is less than zero + public var isNegative: Bool { + return decimal.isNegative + } + + /// The negative of Self. + /// - returns: a `_Money` + public var negative: _Money { + return _Money(decimal.negative) + } + + /** + Initialize a new value using an underlying decimal. + + - parameter value: a `_Decimal` defaults to zero. + */ + public init(_ value: _Decimal = _Decimal()) { + decimal = value + } + + /** + Initialize a new value using the underlying decimal storage. + At the moment, this is a `NSDecimalNumber`. + + - parameter storage: a `_Decimal.DecimalStorageType` + */ + public init(storage: _Decimal.DecimalStorageType) { + decimal = _Decimal(storage: storage) + } + + /** + Initialize a new value using a `FloatLiteralType` + + - parameter floatLiteral: a `FloatLiteralType` for the system, probably `Double`. + */ + public init(integerLiteral value: IntegerLiteralType) { + decimal = _Decimal(integerLiteral: value) + } + + /** + Initialize a new value using a `IntegerLiteralType` + + - parameter integerLiteral: a `IntegerLiteralType` for the system, probably `Int`. + */ + public init(floatLiteral value: FloatLiteralType) { + decimal = _Decimal(floatLiteral: value) + } + + /** + Subtract a matching `_Money` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func subtract(other: _Money, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Money { + return _Money(decimal.subtract(other.decimal, withBehaviors: behaviors)) + } + + /** + Add a matching `_Money` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func add(other: _Money, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Money { + return _Money(decimal.add(other.decimal, withBehaviors: behaviors)) + } + + /** + Multiply a matching `_Money` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + + @warn_unused_result + public func multiplyBy(other: _Money, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Money { + return _Money(decimal.multiplyBy(other.decimal, withBehaviors: behaviors)) + } + + /** + Divide a matching `_Money` from the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func divideBy(other: _Money, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Money { + return _Money(decimal.divideBy(other.decimal, withBehaviors: behaviors)) + } + + /** + The remainder of dividing another `_Money` into the receiver. + + - parameter other: another instance of this type. + - parameter behaviors: an optional NSDecimalNumberBehaviors? + - returns: another instance of this type. + */ + @warn_unused_result + public func remainder(other: _Money, withBehaviors behaviors: NSDecimalNumberBehaviors) -> _Money { + return _Money(decimal.remainder(other.decimal, withBehaviors: behaviors)) + } +} + +// MARK: - Equality + +public func ==(lhs: _Money, rhs: _Money) -> Bool { + return lhs.decimal == rhs.decimal +} + +// MARK: - Comparable + +public func <(lhs: _Money, rhs: _Money) -> Bool { + return lhs.decimal < rhs.decimal +} + +// MARK: - Consumption Types + +/// The current locale money +public typealias Money = _Money + +// MARK: - CustomStringConvertible + +extension _Money: CustomStringConvertible { + + /** + Returns the result of the `formatted` function using + NSNumberFormatterStyle.CurrencyStyle. + */ + public var description: String { + return formatted(.CurrencyStyle) + } + + /** + ### Localized Formatted String + This function will format the Money type into a string suitable + for the current localization. It accepts an parameter for the + style `NSNumberFormatterStyle`. Note that iOS 9 and OS X 10.11 + added new styles which are relevant for currency. + + These are `.CurrencyISOCodeStyle`, `.CurrencyPluralStyle`, and + `.CurrencyAccountingStyle`. + */ + public func formatted(style: NSNumberFormatterStyle) -> String { + return C.formatter.formattedStringWithStyle(style)(decimal) + } +} + + +// MARK: - MoneyType Extension + +extension MoneyType where DecimalStorageType == BankersDecimal.DecimalStorageType { + + /** + Use a `BankersDecimal` to convert the receive into another `MoneyType`. To use this + API the underlying `DecimalStorageType`s between the receiver, the other `MoneyType` + must both be the same a that of `BankersDecimal` (which luckily they are). + */ + public func convertWithRate(rate: BankersDecimal) -> Other { + return multiplyBy(Other(storage: rate.storage), withBehaviors: Other.DecimalNumberBehavior.decimalNumberBehaviors) + } +} + +// MARK: - Value Coding + +extension _Money: ValueCoding { + public typealias Coder = _MoneyCoder +} + +/** + Coding class to support `_Decimal` `ValueCoding` conformance. + */ +public final class _MoneyCoder: NSObject, NSCoding, CodingType { + + public let value: _Money + + public required init(_ v: _Money) { + value = v + } + + public init?(coder aDecoder: NSCoder) { + let decimal = _Decimal.decode(aDecoder.decodeObjectForKey("decimal")) + value = _Money(decimal!) + } + + public func encodeWithCoder(aCoder: NSCoder) { + aCoder.encodeObject(value.decimal.encoded, forKey: "decimal") + } +} \ No newline at end of file diff --git a/Money/Support.swift b/Money/Support.swift new file mode 100644 index 0000000..4f8aada --- /dev/null +++ b/Money/Support.swift @@ -0,0 +1,39 @@ +// +// Support.swift +// Money +// +// The MIT License (MIT) +// +// Copyright (c) 2015 Daniel Thorpe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +import Foundation + +extension Int: BooleanType { + + public var boolValue: Bool { + switch self { + case 0: return false + default: return true + } + } +} + diff --git a/README.md b/README.md index ac0b935..66d0b20 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,229 @@ +![](header.png) + +[![Build status](https://badge.buildkite.com/265eb9670a2ef6b73eebf37769a8455c402509f71f09c4f51e.svg)](https://buildkite.com/blindingskies/money?branch=development) +[![codecov.io](https://codecov.io/github/danthorpe/Money/coverage.svg?branch=development&token=gI70muNOjA)](https://codecov.io/github/danthorpe/Money?branch=development) +[![Doc-Percent](https://img.shields.io/cocoapods/metrics/doc-percent/Money.svg)](http://cocoadocs.org/docsets/Money/1.0.0) +[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/Money.svg)](https://img.shields.io/cocoapods/v/Money.svg) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Platform](https://img.shields.io/cocoapods/p/Money.svg?style=flat)](http://cocoadocs.org/docsets/Money) + # Money -Swift value types for working with money & currency + +Money is a Swift framework for iOS, watchOS, tvOS and OS X. It provides types and functionality to represent, calculate and convert money in the 298 [ISO currencies](https://en.wikipedia.org/wiki/ISO_4217). + +## Usage + +The Money framework defines the type, `Money` which represents money in the device’s current locale. The following code: + +```swift +let money: Money = 100 +print("I'll give \(money) to charity.”) +``` + +will print out + +> I'll give $100.00 to charity + +when the region is set to United States + +> I'll give £100.00 to charity + +when the region is set to United Kingdom + +> I'll give CN¥100.00 to charity + +when the region is set to China + +You get the idea. + +`Money` is `IntegerLiteralConvertible` and `FloatLiteralConvertible`. Which means values can be initialized using literal `Int`s and `Double`s as shown in these code snippets. + +## Specific Currency + +Under the hood, `Money` is a `typealias` for `_Money` where `Currency.Local` is a specific `CurrencyType` which represents the currency for the current local. This means that it is strongly typed to the local currency. + +In a similar way, there are 298 foreign currency types supported. + +```swift +let pounds: GBP = 99.99 +let euros: EUR = 149.50 + +print(“You have \(pounds / 2) and \(euros + 30)”) +``` + +> You have £ 50.00 and € 179.50 + +Because the currencies are typed, it means that they cannot be combined together. + +```swift +let money = pounds + euros +``` +> // Binary operator '+' cannot be applied to operands of type 'GBP' (aka '_Money<Currency.GBP>') and 'EUR' (aka '_Money<Currency.EUR>') + +Of course, `Money` supports the usual suspects of decimal arithmetic operators, so you can add, subtract, multiply, divide values of the same type, and values with `Int` and `Double` with some limitations. + +## Foreign Currency Exchange (FX) +To represent a foreign exchange transaction, i.e. converting `USD` to `EUR`, use a FX service provider. There is built in support for [Yahoo](https://finance.yahoo.com/currency-converter/#from=USD;to=EUR;amt=1) and [OpenExchangeRates.org](https://openexchangerates.org) services. But it’s possible for consumers to create their own. + +The following code snippet represent a currency exchange using Yahoo’s currency converter. + +```swift +Yahoo.fx(100) { euros in + print("You got \(euros)") +} +``` + +> You got .Success(€ 92.00) + +The result, delivered asynchronously, uses [`Result`](http://github.com/antitypical/Result) to encapsulate either the `FXProviderType.CounterMoney` or an `FXError` value. Obviously, in real code - you’d need to check for errors ;) + +### Creating custom FX service providers + +Creating a custom FX service provider is straightforward. The protocols `FXLocalProviderType` and `FXRemoteProviderType` define the minimum requirements. The `fx` method is provided via extensions on the protocols. + +For a remote FX service provider, i.e. one which will make a network request to get a rate, we can look at the `Yahoo` provider to see how it works. + +Firstly, we subclass the generic class `FXRemoteProvider`. The generic types are both constrained to `MoneyType`. The naming conventions follow those of a [currency pair](https://en.wikipedia.org/wiki/Currency_pair). + +```swift +public class Yahoo: FXRemoteProvider, FXRemoteProviderType { + // etc +} +``` + +`FXRemoteProvider` provides the typealiases for `BaseMoney` and `CounterMoney` which will be needed to introspect the currency codes. + +The protocol requires that we can construct a `NSURLRequest`. + +```swift +public static func request() -> NSURLRequest { + return NSURLRequest(URL: NSURL(string: "https://download.finance.yahoo.com/d/quotes.csv?s=\(BaseMoney.Currency.code)\(CounterMoney.Currency.code)=X&f=nl1")!) +} +``` + +The last requirement, is that the network result can be mapped into a `Result`. + +`FXQuote` is a class (so it can be subclassed if needed), which composes the exchange rate to be used. The rate is a `BankersDecimal` (see below on the decimal implementation details). + +```swift +public static func quoteFromNetworkResult(result: Result<(NSData?, NSURLResponse?), NSError>) -> Result { + return result.analysis( + ifSuccess: { data, response in + let rate: BankersDecimal = 1.5 // or whatever + return Result(value: FXQuote(rate: BankersDecimal(floatLiteral: rate))) + }, + ifFailure: { error in + return Result(error: .NetworkError(error)) + } + ) +} +``` + +Note that the provider doesn’t need to perform any networking itself. It is all done by the framework. This is a deliberate architectural design as it makes it much easier to unit test the adaptor code. + +# Creating custom currencies + +If your app has its own currency e.g. ⭐️s or 💎s or even 🐝s, you might want to consider making a type for it. + +Lets imagine we’re making *Hive.app* - where you compete with your friends to see who can get the biggest hive (measured in number of 🐝s). + +To create a custom currency, just conform to `CurrencyType`. + +```swift +protocol HiveCurrencyType: CurrencyType { } + +extension Currency { + final class Bee: HiveCurrencyType { + + static let code: String = "BEES" + static let symbol: String = "🐝" + static let scale: Int = 0 + static let formatter: NSNumberFormatter = { + let fmtr = NSNumberFormatter() + fmtr.numberStyle = .CurrencyStyle + fmtr.maximumFractionDigits = Currency.Bee.scale + fmtr.currencySymbol = Currency.Bee.symbol + return fmtr + }() + } +} + +typealias Bees = _Money +``` + +Just make sure that your currency code doesn’t clash with a real one - make it more than three characters to be sure. + +Now it’s possible to work with your own app’s currency as a proper money type. + +```swift +let bees: Bees = 10_000 +print(“I have \(bees)”) +``` +> I have 🐝10,000 + +And of course if you have an IAP for purchasing in-app currency, then I’m sure a custom FX provider would be handy. + +Take a look at the example project, Custom Money, for a an example of a custom local FX provider to exchange your 🐝s. + +## Installation +Money builds as a cross platform (iOS, OS X, watchOS) extension compatible framework. It is also available via CocoaPods + +```ruby +pod ‘Money’ +``` + +## Architectural style +Swift is designed to have a focus on safety, enabled primarily through strong typing. This framework fully embraces this ethos and uses generics heavily to achieve this goal. + +At the highest level *currency* is modeled as a protocol, `CurrencyType`. The protocol defines a few static properties like its symbol, and currency code. Therefore *money* is represented as a decimal number with a generic currency. Additionally, we make `CurrencyType` refine the protocol which defines how the decimal number behaves. + +Finally, we auto-generate the code which defines all the currencies and money typealiases. + +## Implementation Details + +Cocoa has two type which can perform decimal arithmetic, these are `NSDecimalNumber` and `NSDecimal`. `NSDecimal` is faster, but is trickier to work with, and doesn’t have support for limiting the scale of the numbers (which is pretty important when working with currencies). + +`DecimalNumberType` is a protocol which refines refines `SignedNumberType` and defines some functions (`add`, `subtract` etc to support the arithmetic). It is also generic over two types, the underlying storage, and the behaviors. + +`DecimalNumberType.DecimalStorageType` exists so that conforming types can utilize either `NSDecimalNumber` or `NSDecimal` as their underling storage type. + +`DecimalNumberBehavior` is a protocol which exposes a [`NSDecimalNumberBehaviors`](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSDecimalNumberBehaviors_Protocol/) which should be used in calculations. This includes rounding style, scale, and when to throw exceptions. + +### `_Decimal` + +Which leads us to `_Decimal` which is a value type implementing `DecimalNumberType` with an `NSDecimalNumber` storage type. + +There are two public typealiases for convenience. + +```swift +/// `Decimal` with plain decimal number behavior +public typealias Decimal = _Decimal + +/// `BankersDecimal` with banking decimal number behavior +public typealias BankersDecimal = _Decimal +``` + +This means, that `Decimal` is more than likely the type to use for most things. + +### `_Money` +The `_Money` type composes a `_Decimal`. Its behavior is provided via its generic `CurrencyType` which refines `DecimalNumberBehavior`. `_Money` also conforms to `DecimalNumberType` which means that it can also be used with the operators. + +### Why not use `NSDecimal`? +`NSDecimal` would be a better storage type for `_Decimal`, however it doesn’t have the full `NSDecimalNumberBehaviors` support that `NSDecimalNumber` enjoys. In particular, specifying the scale is problematic. If anyone has any smart ideas, please get in touch. I’ve added an equivalent extension on `NSDecimal` as for `NSDecimalNumber`. + +### `ValueCoding` +Both `_Decimal` and `_Money` conform to [`ValueCoding`](https://github.com/danthorpe/ValueCoding) which means they can be encoded and stored inside archives. + + +## Author +Daniel Thorpe [@danthorpe](https://twitter.com/danthorpe). + +Feel free to get in contact if you have questions, queries, or need help. + +## License + +Money is available under the MIT license. See the LICENSE file for more info. + +## Disclaimer + +Usage of this framework prevents the author, Daniel Thorpe, from being held liable for any losses incurred by the user through their use of the framework. \ No newline at end of file diff --git a/Supporting Files/Generate.swift b/Supporting Files/Generate.swift new file mode 100755 index 0000000..efdf41d --- /dev/null +++ b/Supporting Files/Generate.swift @@ -0,0 +1,88 @@ +#!/usr/bin/env xcrun -sdk macosx swift + +// +// Generate.swift +// Money +// +// Created by Daniel Thorpe on 01/11/2015. +// +// + +import Foundation + +typealias Writer = (String) -> Void +typealias Generator = (Writer) -> Void + +func createMoneyTypeForCurrency(code: String) -> String { + return "_Money" +} + +func createExtensionFor(typename: String, writer: Writer, content: Generator) { + writer("extension \(typename) {") + content(writer) + writer("}") +} + +func createFrontMatter(line: Writer) { + line("// ") + line("// Money, https://github.com/danthorpe/Money") + line("// Created by Dan Thorpe, @danthorpe") + line("// ") + line("// Autogenerated from build scripts, do not manually edit this file.") + line("") +} + +func createCurrencyTypes(line: Writer) { + for code in NSLocale.ISOCurrencyCodes() { + line("") + line(" /// Currency \(code)") + line(" public final class \(code): Currency.Base, _CurrencyType {") + line(" /// Lazy static storage for currency.") + line(" public static var sharedInstance = \(code)(code: \"\(code)\")") + line(" }") + } +} + +func createMoneyTypes(line: Writer) { + line("") + + for code in NSLocale.ISOCurrencyCodes() { + line("/// \(code) Money") + let name = createMoneyTypeForCurrency(code) + line("public typealias \(code) = \(name)") + } +} + +func generate(outputPath: String) { + + guard let outputStream = NSOutputStream(toFileAtPath: outputPath, append: false) else { + fatalError("Unable to create output stream at path: \(outputPath)") + } + + let write: Writer = { str in + guard let data = str.dataUsingEncoding(NSUTF8StringEncoding) else { + fatalError("Unable to encode str: \(str)") + } + outputStream.write(UnsafePointer(data.bytes), maxLength: data.length) + } + + let writeLine: Writer = { write("\($0)\n") } + + outputStream.open() + createFrontMatter(writeLine) + createExtensionFor("Currency", writer: writeLine, content: createCurrencyTypes) + write("\n") + createMoneyTypes(writeLine) + outputStream.close() +} + +// MARK: - Main() + +if Process.arguments.count == 1 { + print("Invalid usage. Requires an output path.") + exit(1) +} + +let outputPath = Process.arguments[1] +print("Will output to path: \(outputPath)") +generate(outputPath) \ No newline at end of file diff --git a/Supporting Files/Info.plist b/Supporting Files/Info.plist new file mode 100644 index 0000000..46f9b24 --- /dev/null +++ b/Supporting Files/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + $(MONEY_VERSION) + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/Supporting Files/Money.h b/Supporting Files/Money.h new file mode 100644 index 0000000..eeb4678 --- /dev/null +++ b/Supporting Files/Money.h @@ -0,0 +1,17 @@ +// +// Money.h +// Money +// +// Created by Daniel Thorpe on 28/10/2015. +// +// + +#import + +//! Project version number for Money. +FOUNDATION_EXPORT double MoneyVersionNumber; + +//! Project version string for Money. +FOUNDATION_EXPORT const unsigned char MoneyVersionString[]; + + diff --git a/Supporting Files/Money.xcconfig b/Supporting Files/Money.xcconfig new file mode 100644 index 0000000..20eff10 --- /dev/null +++ b/Supporting Files/Money.xcconfig @@ -0,0 +1,14 @@ +// +// Money.xcconfig +// Money +// +// Created by Daniel Thorpe on 28/10/2015. +// +// + +MONEY_VERSION = 1.0.0 + +APPLICATION_EXTENSION_API_ONLY = YES +INFOPLIST_FILE = $(SRCROOT)/Supporting Files/Info.plist +PRODUCT_BUNDLE_IDENTIFIER = me.danthorpe.Money +PRODUCT_NAME = Money diff --git a/Tests/DVR Cassettes/OpenExchangeRates.org USDEUR.json b/Tests/DVR Cassettes/OpenExchangeRates.org USDEUR.json new file mode 100644 index 0000000..1462f6f --- /dev/null +++ b/Tests/DVR Cassettes/OpenExchangeRates.org USDEUR.json @@ -0,0 +1,206 @@ +{ + "interactions" : [ + { + "recorded_at" : 1446674543.534192, + "response" : { + "body" : { + "disclaimer" : "Exchange rates are provided for informational purposes only, and do not constitute financial advice of any kind. Although every attempt is made to ensure quality, NO guarantees are given whatsoever of accuracy, validity, availability, or fitness for any purpose - please use at your own risk. All usage is subject to your acceptance of the Terms and Conditions of Service, available at: https:\/\/openexchangerates.org\/terms\/", + "license" : "Data sourced from various providers with public-facing APIs; copyright may apply; resale is prohibited; no warranties given of any kind. Bitcoin data provided by http:\/\/coindesk.com. All usage is subject to your acceptance of the License Agreement available at: https:\/\/openexchangerates.org\/license\/", + "timestamp" : 1446670811, + "rates" : { + "HRK" : 6.955088, + "HUF" : 288.542199, + "CDF" : 928.03575, + "ILS" : 3.882166, + "NGN" : 199.0678, + "GYD" : 206.382169, + "BYR" : 17438.025, + "BHD" : 0.377283, + "SZL" : 13.94123, + "INR" : 65.55212, + "SDG" : 6.08656, + "PEN" : 3.289123, + "EUR" : 0.920924, + "QAR" : 3.639692, + "PGK" : 2.937225, + "LRD" : 86.08000199999999, + "ISK" : 129.402999, + "SYP" : 188.821003, + "TRY" : 2.857284, + "UAH" : 23.03988, + "SGD" : 1.402269, + "MMK" : 1276.425025, + "NIO" : 27.47016, + "BIF" : 1565.305, + "AFN" : 64.980002, + "LKR" : 141.369399, + "GTQ" : 7.656958, + "CHF" : 0.992761, + "XPT" : 0.001048, + "THB" : 35.54216, + "AMD" : 474.750003, + "AOA" : 135.254335, + "SEK" : 8.616823999999999, + "SAR" : 3.75026, + "KWD" : 0.303096, + "IRR" : 29961.5, + "WST" : 2.620993, + "BGN" : 1.797365, + "BMD" : 1, + "PHP" : 46.81726, + "XAF" : 602.598085, + "ZMW" : 12.600125, + "BDT" : 78.40590899999999, + "NOK" : 8.621670999999999, + "BOB" : 6.901134, + "TZS" : 2160.843317, + "BND" : 1.401763, + "VEF" : 6.321734, + "ANG" : 1.78875, + "EEK" : 14.324475, + "SCR" : 12.69805, + "VUV" : 112.092499, + "XAG" : 0.066279, + "KYD" : 0.824592, + "DJF" : 177.668751, + "XCD" : 2.70102, + "CLF" : 0.024602, + "LSL" : 13.929038, + "MOP" : 7.988528, + "ALL" : 127.199899, + "UZS" : 2692.314942, + "PLN" : 3.896384, + "UYU" : 29.36398, + "LTL" : 3.104616, + "LYD" : 1.354645, + "JPY" : 121.4192, + "MNT" : 1992.833333, + "FJD" : 2.145517, + "ZWL" : 322.387247, + "KPW" : 900.09, + "PKR" : 105.463701, + "MRO" : 322.4525, + "GBP" : 0.649952, + "MTL" : 0.683602, + "OMR" : 0.385079, + "LVL" : 0.635748, + "SHP" : 0.649952, + "GEL" : 2.396075, + "TND" : 2.012077, + "DKK" : 6.853054, + "KRW" : 1133.813338, + "NPR" : 105.1052, + "BSD" : 1, + "CRC" : 533.607406, + "EGP" : 8.029902, + "AUD" : 1.398273, + "BTC" : 0.002153611, + "MAD" : 9.89598, + "SLL" : 4500, + "MWK" : 573.4781, + "RSD" : 110.54824, + "NZD" : 1.518215, + "SRD" : 3.2875, + "CLP" : 691.710994, + "RUB" : 63.21985, + "HKD" : 7.750945, + "NAD" : 13.93873, + "GMD" : 39.06982, + "VND" : 22314.566667, + "LAK" : 8147.764903, + "CUC" : 1, + "RON" : 4.083066, + "MUR" : 35.896501, + "XAU" : 0.0009015, + "GGP" : 0.649952, + "BRL" : 3.806566, + "MXN" : 16.50496, + "STD" : 22368.55, + "AWG" : 1.793333, + "MVR" : 15.321917, + "PAB" : 1, + "TJS" : 6.6207, + "GNF" : 7948.197598, + "MGA" : 3260.923301, + "XDR" : 0.718687, + "ETB" : 21.04244, + "COP" : 2849.045036, + "ZAR" : 13.92742, + "IDR" : 13577.1, + "SVC" : 8.753053, + "CVE" : 101.54568486, + "TTD" : 6.367038, + "GIP" : 0.649952, + "PYG" : 5600.131693, + "MZN" : 43.6925, + "FKP" : 0.649952, + "KZT" : 285.87379, + "UGX" : 3490.123333, + "USD" : 1, + "ARS" : 9.55316, + "GHS" : 3.814842, + "RWF" : 744.5393749999999, + "DOP" : 45.39963, + "JEP" : 0.649952, + "LBP" : 1508.578325, + "BTN" : 65.51653399999999, + "BZD" : 1.994645, + "MYR" : 4.295923, + "YER" : 215.146399, + "JMD" : 119.5316, + "TOP" : 2.21008, + "SOS" : 625.730003, + "TMT" : 3.501467, + "MDL" : 19.94576, + "XPD" : 0.001605, + "XOF" : 603.343825, + "TWD" : 32.42717, + "BBD" : 2, + "CAD" : 1.314503, + "CNY" : 6.33528, + "JOD" : 0.7089760000000001, + "XPF" : 109.593574, + "IQD" : 1137.007451, + "HNL" : 21.97698, + "AED" : 3.672977, + "ERN" : 15.14, + "KES" : 101.9965, + "KMF" : 450.566, + "DZD" : 106.9734, + "MKD" : 56.45779, + "CUP" : 0.999838, + "BWP" : 10.575013, + "AZN" : 1.048288, + "SBD" : 7.907656, + "KGS" : 69.732249, + "KHR" : 4057.034976, + "ZMK" : 5253.075255, + "HTG" : 54.158, + "CZK" : 24.86731, + "BAM" : 1.796159, + "IMP" : 0.649952 + }, + "base" : "USD" + }, + "status" : 200, + "url" : "https:\/\/openexchangerates.org\/api\/latest.json?app_id=this_is_not_the_app_id_youre_looking_for", + "headers" : { + "Access-Control-Allow-Origin" : "*", + "Server" : "Apache", + "Connection" : "close", + "Last-Modified" : "Wed, 04 Nov 2015 21:00:11 GMT", + "Content-Type" : "application\/json; charset=utf-8", + "Date" : "Wed, 04 Nov 2015 22:02:22 GMT", + "Content-Length" : "4457", + "Cache-Control" : "public", + "Etag" : "\"3d94fce1847d054ecceea85dafdbe862\"" + } + }, + "request" : { + "method" : "GET", + "url" : "https:\/\/openexchangerates.org\/api\/latest.json?app_id=this_is_not_the_app_id_youre_looking_for" + } + } + ], + "name" : "OpenExchangeRates.org USDEUR" +} diff --git a/Tests/DVR Cassettes/Yahoo GBPUSD.json b/Tests/DVR Cassettes/Yahoo GBPUSD.json new file mode 100644 index 0000000..d05e838 --- /dev/null +++ b/Tests/DVR Cassettes/Yahoo GBPUSD.json @@ -0,0 +1,27 @@ +{ + "interactions" : [ + { + "recorded_at" : 1446743589.787131, + "response" : { + "body" : "IkdCUC9VU0QiLDEuNTIzNwo=", + "status" : 200, + "url" : "https:\/\/download.finance.yahoo.com\/d\/quotes.csv?s=GBPUSD=X&f=nl1", + "headers" : { + "Server" : "ATS", + "Content-Type" : "application\/octet-stream", + "Via" : "http\/1.1 r11.ycpi.loa.yahoo.net (ApacheTrafficServer [cMsSf ])", + "Age" : "0", + "p3p" : "policyref=\"https:\/\/policies.yahoo.com\/w3c\/p3p.xml\", CP=\"CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV\"", + "Date" : "Thu, 05 Nov 2015 17:13:09 GMT", + "Content-Length" : "17", + "Cache-Control" : "private, no-cache, no-store" + } + }, + "request" : { + "method" : "GET", + "url" : "https:\/\/download.finance.yahoo.com\/d\/quotes.csv?s=GBPUSD=X&f=nl1" + } + } + ], + "name" : "Yahoo GBPUSD" +} diff --git a/Tests/DecimalTests.swift b/Tests/DecimalTests.swift new file mode 100644 index 0000000..04a5607 --- /dev/null +++ b/Tests/DecimalTests.swift @@ -0,0 +1,91 @@ +// +// DecimalTests.swift +// Money +// +// Created by Daniel Thorpe on 03/11/2015. +// +// + +import XCTest +import ValueCoding +@testable import Money + +class DecimalTests: XCTestCase { + var decimal: Decimal! + + override func tearDown() { + decimal = nil + super.tearDown() + } +} + +class DecimalDescriptionTests: DecimalTests { + + func test__decimal_decription1() { + decimal = 10.00 + XCTAssertEqual(decimal.description, "10") + } + + func test__decimal_decription2() { + decimal = 10.01 + XCTAssertEqual(decimal.description, "10.01") + } +} + +class DecimalReciprocalTests: DecimalTests { + + func test__reciprocal() { + decimal = 10 + XCTAssertEqual(decimal.reciprocal, 0.1) + } + + func test__reciprocal_unity() { + decimal = 1 + XCTAssertEqual(decimal.reciprocal, 1) + } +} + +class DecimalNumberConversionTests: DecimalTests { + var money: GBP! + + override func setUp() { + super.setUp() + decimal = 10 + money = 20 + } + + override func tearDown() { + money = nil + super.tearDown() + } + + func test__multiply() { + let result = decimal * money + XCTAssertEqual(result.description, "£ 200.00") + XCTAssertEqual(money * decimal, 200) + } + + func test__divide() { + let result = decimal / money + XCTAssertEqual(result.description, "£ 0.50") + XCTAssertEqual(money / decimal, 2) + } +} + +class DecimalValueCodingTests: DecimalTests { + + func archiveEncodedDecimal() -> NSData { + return NSKeyedArchiver.archivedDataWithRootObject(decimal.encoded) + } + + func unarchive(archive: NSData) -> Decimal? { + return Decimal.decode(NSKeyedUnarchiver.unarchiveObjectWithData(archive)) + } + + func test__decimal_encodes() { + decimal = 10 + XCTAssertEqual(unarchive(archiveEncodedDecimal()), decimal) + } +} + + diff --git a/Tests/FXOpenExchangeRatesTests.swift b/Tests/FXOpenExchangeRatesTests.swift new file mode 100644 index 0000000..7ba7be0 --- /dev/null +++ b/Tests/FXOpenExchangeRatesTests.swift @@ -0,0 +1,140 @@ +// +// FXOpenExchangeRatesTests.swift +// Money +// +// Created by Daniel Thorpe on 04/11/2015. +// +// + +import XCTest +import Result +import DVR +import SwiftyJSON +@testable import Money + +struct MyOpenExchangeRatesAppID: OpenExchangeRatesAppID { + static let app_id = "this_is_not_the_app_id_youre_looking_for" +} + +class OpenExchangeRates: _OpenExchangeRates { } + +class FreeOpenExchangeRates: _ForeverFreeOpenExchangeRates { } + +class FXPaidOpenExchangeRatesTests: FXProviderTests { + typealias Provider = OpenExchangeRates + + func test__name() { + XCTAssertEqual(Provider.name(), "OpenExchangeRates.org GBPJPY") + } + + func test__base_currency() { + XCTAssertEqual(Provider.BaseMoney.Currency.code, Currency.GBP.code) + } + + func test__request__url_does_contain_base() { + guard let url = Provider.request().URL else { + XCTFail("Request did not return a URL") + return + } + + XCTAssertTrue(url.absoluteString.containsString("&base=GBP")) + } +} + +class FXFreeOpenExchangeRatesTests: FXProviderTests { + + typealias Provider = FreeOpenExchangeRates + typealias TestableProvider = TestableFXRemoteProvider + typealias FaultyProvider = FaultyFXRemoteProvider + + let usd: USD = 100 + + func test__name() { + XCTAssertEqual(Provider.name(), "OpenExchangeRates.org USDEUR") + } + + func test__session() { + XCTAssertEqual(Provider.session(), NSURLSession.sharedSession()) + } + + func test__base_currency() { + XCTAssertEqual(Provider.BaseMoney.Currency.code, Currency.USD.code) + } + + func test__request__url_does_not_contain_base() { + guard let url = Provider.request().URL else { + XCTFail("Request did not return a URL") + return + } + + XCTAssertFalse(url.absoluteString.containsString("&base=")) + } + + func test__quote_adaptor__with_network_error() { + let error = NSError(domain: NSURLErrorDomain, code: NSURLError.BadServerResponse.rawValue, userInfo: nil) + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(error: error) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.NetworkError(error)) + } + + func test__quote_adaptor__with_no_data() { + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (.None, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.NoData) + } + + func test__quote_adaptor__with_garbage_data() { + let data = createGarbageData() + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (data, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.InvalidData(data)) + } + + func test__quote_adaptor__with_missing_rate() { + var json = dvrJSONFromCassette(Provider.name())! + var rates: Dictionary = json["rates"].dictionary! + rates.removeValueForKey("EUR") + json["rates"] = JSON(rates) + let data = try! json.rawData() + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (data, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.RateNotFound(Provider.name())) + } + + func test__faulty_provider() { + let expectation = expectationWithDescription("Test: \(__FUNCTION__)") + + FaultyProvider.fx(usd) { result in + guard let error = result.error else { + XCTFail("Should have received a network error.") + return + } + switch error { + case .NetworkError(_): + break // This is the success path. + default: + XCTFail("Returned \(error), should be a .NetworkError") + } + expectation.fulfill() + } + + waitForExpectationsWithTimeout(1, handler: nil) + } + + func test__exhange_usd_to_eur() { + + let expectation = expectationWithDescription("Test: \(__FUNCTION__)") + + TestableProvider.fx(usd) { result in + if let usd = result.value { + XCTAssertEqual(usd, 92.09) + } + else { + XCTFail("Received error: \(result.error!).") + } + expectation.fulfill() + } + + waitForExpectationsWithTimeout(1, handler: nil) + } +} diff --git a/Tests/FXTests.swift b/Tests/FXTests.swift new file mode 100644 index 0000000..9244222 --- /dev/null +++ b/Tests/FXTests.swift @@ -0,0 +1,136 @@ +// +// FXTests.swift +// Money +// +// Created by Daniel Thorpe on 02/11/2015. +// +// + +import XCTest +import Result +import SwiftyJSON +import DVR +@testable import Money + +class Sessions { + + static func sessionWithCassetteName(name: String) -> Session { + return sharedInstance.sessionWithCassetteName(name) + } + + static let sharedInstance = Sessions() + + var sessions = Dictionary() + + func sessionWithCassetteName(name: String) -> Session { + guard let session = sessions[name] else { + let _session = Session(cassetteName: name) + sessions.updateValue(_session, forKey: name) + return _session + } + return session + } +} + +class TestableFXRemoteProvider: FXRemoteProviderType { + + typealias CounterMoney = Provider.CounterMoney + typealias BaseMoney = Provider.BaseMoney + + static func name() -> String { + return Provider.name() + } + + static func session() -> NSURLSession { + return Sessions.sessionWithCassetteName(name()) + } + + static func request() -> NSURLRequest { + return Provider.request() + } + + static func quoteFromNetworkResult(result: Result<(NSData?, NSURLResponse?), NSError>) -> Result { + return Provider.quoteFromNetworkResult(result) + } +} + +class FaultyFXRemoteProvider: FXRemoteProviderType { + + typealias CounterMoney = Provider.CounterMoney + typealias BaseMoney = Provider.BaseMoney + + static func name() -> String { + return Provider.name() + } + + static func session() -> NSURLSession { + return Provider.session() + } + + static func request() -> NSURLRequest { + let request = Provider.request() + if let url = request.URL, + host = url.host, + modified = NSURL(string: url.absoluteString.stringByReplacingOccurrencesOfString(host, withString: "broken-host.xyz")) { + return NSURLRequest(URL: modified) + } + return request + } + + static func quoteFromNetworkResult(result: Result<(NSData?, NSURLResponse?), NSError>) -> Result { + return Provider.quoteFromNetworkResult(result) + } +} + + +class FakeLocalFX: FXLocalProviderType { + + typealias BaseMoney = B + typealias CounterMoney = C + + static func name() -> String { + return "LocalFX" + } + + static func quote() -> FXQuote { + return FXQuote(rate: 1.1) + } +} + + +class FXErrorTests: XCTestCase { + + func test__fx_error__equality() { + XCTAssertNotEqual(FXError.NoData, FXError.RateNotFound("whatever")) + } +} + +class FXProviderTests: XCTestCase { + + func createGarbageData() -> NSData { + let path = NSBundle(forClass: self.dynamicType).pathForResource("Troll", ofType: "png") + let data = NSData(contentsOfFile: path!) + return data! + } + + func dvrJSONFromCassette(name: String) -> JSON? { + guard let path = NSBundle(forClass: self.dynamicType).pathForResource(name, ofType: "json"), + data = NSData(contentsOfFile: path) else { + return .None + } + let json = JSON(data: data) + let body = json[["interactions",0,"response","body"]] + return body + } +} + +class FXLocalProviderTests: XCTestCase { + + func test_fx() { + let money: Money = 10 + let usd: USD = FakeLocalFX.fx(money) + XCTAssertEqual(usd, 11) + } +} diff --git a/Tests/FXYahooTests.swift b/Tests/FXYahooTests.swift new file mode 100644 index 0000000..c505e0d --- /dev/null +++ b/Tests/FXYahooTests.swift @@ -0,0 +1,100 @@ +// +// FXYahooTests.swift +// Money +// +// Created by Daniel Thorpe on 04/11/2015. +// +// + +import XCTest +import Result +import DVR +@testable import Money + +class FXYahooTests: FXProviderTests { + + typealias Provider = Yahoo + typealias TestableProvider = TestableFXRemoteProvider + typealias FaultyProvider = FaultyFXRemoteProvider + + func test__name() { + XCTAssertEqual(Provider.name(), "Yahoo GBPUSD") + } + + func test__session() { + XCTAssertEqual(Provider.session(), NSURLSession.sharedSession()) + } + + func test__quote_adaptor__with_network_error() { + let error = NSError(domain: NSURLErrorDomain, code: NSURLError.BadServerResponse.rawValue, userInfo: nil) + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(error: error) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.NetworkError(error)) + } + + func test__quote_adaptor__with_no_data() { + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (.None, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.NoData) + } + + func test__quote_adaptor__with_garbage_data() { + let data = createGarbageData() + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (data, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.InvalidData(data)) + } + + func test__quote_adaptor__with_incorrect_text_response() { + let text = "This isn't a correct response" + let data = text.dataUsingEncoding(NSUTF8StringEncoding) + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (data, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.InvalidData(data!)) + } + + func test__quote_adaptor__with_missing_rate() { + let text = "This,could be,a correct,response" + let data = text.dataUsingEncoding(NSUTF8StringEncoding) + let network: Result<(NSData?, NSURLResponse?), NSError> = Result(value: (data, .None)) + let quote = Provider.quoteFromNetworkResult(network) + XCTAssertEqual(quote.error!, FXError.RateNotFound(text)) + } + + func test__faulty_provider() { + let gbp: GBP = 100 + let expectation = expectationWithDescription("Test: \(__FUNCTION__)") + + FaultyProvider.fx(gbp) { result in + guard let error = result.error else { + XCTFail("Should have received a network error.") + return + } + switch error { + case .NetworkError(_): + break // This is the success path. + default: + XCTFail("Returned \(error), should be a .NetworkError") + } + expectation.fulfill() + } + + waitForExpectationsWithTimeout(1, handler: nil) + } + + func test__exhange_gbp_to_eur() { + let expectation = expectationWithDescription("Test: \(__FUNCTION__)") + + TestableProvider.fx(100) { result in + if let usd = result.value { + XCTAssertEqual(usd, 152.37) + } + else { + XCTFail("Received error: \(result.error!).") + } + expectation.fulfill() + } + + waitForExpectationsWithTimeout(1, handler: nil) + } +} \ No newline at end of file diff --git a/Tests/Info.plist b/Tests/Info.plist new file mode 100644 index 0000000..ba72822 --- /dev/null +++ b/Tests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Tests/MoneyTests.swift b/Tests/MoneyTests.swift new file mode 100644 index 0000000..18ab6db --- /dev/null +++ b/Tests/MoneyTests.swift @@ -0,0 +1,285 @@ +// +// Money_iOSTests.swift +// Money-iOSTests +// +// Created by Daniel Thorpe on 28/10/2015. +// +// + +import XCTest +@testable import Money + +class MoneyInitializerTests: XCTestCase { + + var money: Money! + + func test__money_initialize_with__nothing() { + money = Money() + XCTAssertEqual(money, 0) + } + + func test__money_initialize_with__one_int() { + money = Money(integerLiteral: 1) + XCTAssertEqual(money, 1) + } + + func test__money_is_negative() { + money = -10 + XCTAssertTrue(money.isNegative) + } + + func test__money_can_be_negated() { + money = 10 + XCTAssertEqual(money.negative, -10) + } +} + +class MoneyEqualityTests: XCTestCase { + var aMoney: USD! + var bMoney: USD! + + func test__money_equals_money() { + aMoney = 6.66 + bMoney = 6.66 + XCTAssertEqual(aMoney, bMoney) + } + + func test__money_does_not_equal_money() { + aMoney = 6.66 + bMoney = 5.66 + XCTAssertNotEqual(aMoney, bMoney) + } +} + +class MoneyComparableTests: XCTestCase { + + func test__money_sorts() { + let monies: [Money] = [ 0, 12, 4.50, 9.99, 99, 9.99, 2.49, 16.69] + let sorted = monies.sort() + XCTAssertEqual(sorted, [0, 2.49, 4.50, 9.99, 9.99, 12, 16.69, 99]) + } +} + +class MoneySignedNumberTests: XCTestCase { + + func test__money_negates() { + let money: Money = 16.49 + let modified = -money + XCTAssertEqual(modified, Money(floatLiteral: -16.49)) + } + + func test__money_subtracts() { + let a: Money = 16.49 + let b: Money = 6.49 + let result = a - b + XCTAssertEqual(result, Money(integerLiteral: 10)) + } +} + +class MoneySubtractionTests: XCTestCase { + + let money: JPY = 12_345.67 + + func test__subtraction_int_1() { + XCTAssertEqual(money - 10_000, 2_345.67) + } + + func test__subtraction_int_2() { + XCTAssertEqual(10_000 - money, -2_345.67) + } + + func test__subtraction_float_1() { + XCTAssertEqual(money - 2_345.67, 10_000) + } + + func test__subtraction_float_2() { + XCTAssertEqual(2_345.67 - money, -10_000) + } +} + +class MoneyAddingTests: XCTestCase { + + let money: INR = 335_577.99 + + func test_addition() { + let cash: INR = 446_688.00 + XCTAssertEqual(money + cash, 782_265.99) + XCTAssertEqual(cash + money, 782_265.99) + } + + func test__addition_int_interal() { + XCTAssertEqual(money + 10_000, 345_577.99) + XCTAssertEqual(10_000 + money, 345_577.99) + } + + func test__addition_float_interal() { + XCTAssertEqual(money + 2_345.67, 337_923.66) + XCTAssertEqual(2_345.67 + money, 337_923.66) + } +} + +class MoneyRemainderTests: XCTestCase { + var dividend: EUR! + var divisor: EUR! + + func test__remainer_all_positive() { + dividend = 37.50 + divisor = 5 + XCTAssertEqual(dividend % divisor, 2.50) + } + + func test__remainer_all_negative() { + dividend = -37.50 + divisor = -5 + XCTAssertEqual(dividend % divisor, -2.50) + } + + func test__remainer_negative_divisor() { + dividend = 37.50 + divisor = -5 + XCTAssertEqual(dividend % divisor, 2.50) + } + + func test__remainer_negative_dividend() { + dividend = -37.50 + divisor = 5 + XCTAssertEqual(dividend % divisor, -2.50) + } +} + +class MoneyMultiplicationTests: XCTestCase { + let money: CNY = 9.99 + + func test__multiplication_int_0() { + XCTAssertEqual(0 * money, 0) + } + + func test__multiplication_int_1() { + XCTAssertEqual(money * 1, money) + } + + func test__multiplication_int_2() { + XCTAssertEqual(money * 417, 4_165.83) + } + + func test__multiplication_float_0() { + XCTAssertEqual(0.0 * money, 0) + } + + func test__multiplication_float_1() { + XCTAssertEqual(money * 1.0, money) + } + + func test__multiplication_float_2() { + XCTAssertEqual(money * M_PI, 31.37) + } +} + +class MoneyDivisionTests: XCTestCase { + let money: EUR = 9.99 + +/* + func test__division_int_0() { + result = money / 0 + // This does throw an exception - but how can I + // write a test to verify that it does? + } +*/ + + func test__division_int_1() { + XCTAssertEqual(money / 1, money) + } + + func test__multiplication_int_2() { + XCTAssertEqual(money / 4, 2.50) + } + + func test__division_float_1() { + XCTAssertEqual(money / 1.0, money) + } + + func test__division_float_2() { + XCTAssertEqual(money / 4.0, 2.50) + } + + func test__division_float_3() { + XCTAssertEqual(money / 0.5, 19.98) + } + + func test__division_float_4() { + XCTAssertEqual(money / M_PI, 3.18) + } +} + +class MoneyDescriptionTests: XCTestCase { + + let gbp: GBP = 100 + let usd: USD = 99 + let cad: CAD = 102.01 + let aud: AUD = 99.999 + let eur: EUR = 249.499 + let jpy: JPY = 319.500002 + + func test__gbp_description() { + XCTAssertEqual(Currency.GBP.code, "GBP") + XCTAssertEqual(Currency.GBP.symbol, "£") + XCTAssertEqual(gbp.description, "£ 100.00") + XCTAssertEqual(Currency.GBP.formatter.numberStyle, NSNumberFormatterStyle.CurrencyStyle) + } + + func test__usd_description() { + XCTAssertEqual(Currency.USD.code, "USD") + XCTAssertEqual(Currency.USD.symbol, "US$") + XCTAssertEqual(usd.description, "US$ 99.00") + XCTAssertEqual(Currency.USD.formatter.numberStyle, NSNumberFormatterStyle.CurrencyStyle) + } + + func test__cad_description() { + XCTAssertEqual(Currency.CAD.code, "CAD") + XCTAssertEqual(Currency.CAD.symbol, "CA$") + XCTAssertEqual(cad.description, "CA$ 102.01") + XCTAssertEqual(Currency.CAD.formatter.numberStyle, NSNumberFormatterStyle.CurrencyStyle) + } + + func test__aud_description() { + XCTAssertEqual(Currency.AUD.code, "AUD") + XCTAssertEqual(Currency.AUD.symbol, "A$") + XCTAssertEqual(aud.description, "A$ 100.00") + XCTAssertEqual(Currency.AUD.formatter.numberStyle, NSNumberFormatterStyle.CurrencyStyle) + } + + func test__eur_description() { + XCTAssertEqual(Currency.EUR.code, "EUR") + XCTAssertEqual(Currency.EUR.symbol, "€") + XCTAssertEqual(eur.description, "€ 249.50") + XCTAssertEqual(Currency.EUR.formatter.numberStyle, NSNumberFormatterStyle.CurrencyStyle) + } + + func test__jpy_description() { + XCTAssertEqual(Currency.JPY.code, "JPY") + XCTAssertEqual(Currency.JPY.symbol, "JP¥") + XCTAssertEqual(Currency.JPY.scale, 0) + XCTAssertEqual(jpy.description, "JP¥ 320") + XCTAssertEqual(Currency.JPY.formatter.numberStyle, NSNumberFormatterStyle.CurrencyStyle) + } +} + +class MoneyValueCodingTests: XCTestCase { + + var money: Money! + + func archiveEncodedMoney() -> NSData { + return NSKeyedArchiver.archivedDataWithRootObject(money.encoded) + } + + func unarchive(archive: NSData) -> Money? { + return Money.decode(NSKeyedUnarchiver.unarchiveObjectWithData(archive)) + } + + func test__money_encodes() { + money = 10 + XCTAssertEqual(unarchive(archiveEncodedMoney()), money) + } +} + + diff --git a/Tests/NSDecimalNumberTests.swift b/Tests/NSDecimalNumberTests.swift new file mode 100644 index 0000000..2218927 --- /dev/null +++ b/Tests/NSDecimalNumberTests.swift @@ -0,0 +1,93 @@ +// +// NSDecimalNumberTests.swift +// Money +// +// Created by Daniel Thorpe on 05/11/2015. +// +// + +import XCTest +@testable import Money + +class NSDecimalNumberTests: XCTestCase { + + var a: NSDecimalNumber! + var b: NSDecimalNumber! + var behaviors: NSDecimalNumberBehaviors! + + override func setUp() { + super.setUp() + a = 10 + b = 20 + behaviors = DecimalNumberBehavior.Plain.decimalNumberBehaviors + } + + override func tearDown() { + a = nil + b = nil + behaviors = nil + super.tearDown() + } + + func test__zero_is_not_equal_to_one() { + XCTAssertNotEqual(NSDecimalNumber.zero(), NSDecimalNumber.one()) + } + + func test__zero_is_less_than_one() { + XCTAssertTrue(NSDecimalNumber.zero() < NSDecimalNumber.one()) + } + + func test__zero_is_greater_than_negative_one() { + XCTAssertTrue(NSDecimalNumber.zero() > NSDecimalNumber.one().negateWithBehaviors(behaviors)) + } + + func test__negative_one_is_negative() { + XCTAssertTrue(NSDecimalNumber.one().negateWithBehaviors(behaviors).isNegative) + } + + func test__zero_is_not_negative() { + XCTAssertFalse(NSDecimalNumber.zero().isNegative) + XCTAssertFalse(NSDecimalNumber.one().isNegative) + } + + func test__addition() { + let result = a.add(b, withBehaviors: behaviors) + XCTAssertEqual(result, 30) + } + + func test__subtraction() { + let result = a.subtract(b, withBehaviors: behaviors) + XCTAssertEqual(result, -10) + } + + func test__multiplication() { + let result = a.multiplyBy(b, withBehaviors: behaviors) + XCTAssertEqual(result, 200) + } + + func test__division() { + let result = a.divideBy(b, withBehaviors: behaviors) + XCTAssertEqual(result, 0.5) + } + + func test__remainder() { + let result = a.remainder(b, withBehaviors: behaviors) + XCTAssertEqual(result, 10) + } + + func test__remainder_swift_documentation_examples() { + // https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/BasicOperators.html#//apple_ref/doc/uid/TP40014097-CH6-ID63 + + a = 9; b = 4 + XCTAssertEqual(a.remainder(b, withBehaviors: behaviors), 1) + + a = -9; b = 4 + XCTAssertEqual(a.remainder(b, withBehaviors: behaviors), -1) + + a = 9; b = -4 + XCTAssertEqual(a.remainder(b, withBehaviors: behaviors), 1) + + a = 8; b = 2.5 + XCTAssertEqual(a.remainder(b, withBehaviors: behaviors), 0.5) + } +} diff --git a/Tests/NSDecimalTests.swift b/Tests/NSDecimalTests.swift new file mode 100644 index 0000000..da210fa --- /dev/null +++ b/Tests/NSDecimalTests.swift @@ -0,0 +1,98 @@ +// +// NSDecimalTests.swift +// Money +// +// Created by Daniel Thorpe on 05/11/2015. +// +// + +import XCTest +@testable import Money + +class NSDecimalTests: XCTestCase { + + var decimalNumberA: NSDecimalNumber! + var decimalNumberB: NSDecimalNumber! + var behaviors: NSDecimalNumberBehaviors! + var a: NSDecimal! + var b: NSDecimal! + + override func setUp() { + super.setUp() + decimalNumberA = 10 + decimalNumberB = 20 + behaviors = DecimalNumberBehavior.Plain.decimalNumberBehaviors + a = decimalNumberA.decimalValue + b = decimalNumberB.decimalValue + } + + override func tearDown() { + decimalNumberA = nil + decimalNumberB = nil + behaviors = nil + a = nil + b = nil + super.tearDown() + } + + func test__zero() { + XCTAssertEqual(NSDecimal.zero(), NSDecimalNumber.zero().decimalValue) + } + + func test__zero_is_not_equal_to_one() { + XCTAssertNotEqual(NSDecimal.zero(), NSDecimal.one()) + } + + func test__zero_is_less_than_one() { + XCTAssertTrue(NSDecimal.zero() < NSDecimal.one()) + } + + func test__zero_is_greater_than_negative_one() { + XCTAssertTrue(NSDecimal.zero() > NSDecimal.one().negateWithRoundingMode(behaviors.roundingMode())) + } + + func test__negative_one_is_negative() { + XCTAssertTrue(NSDecimal.one().negateWithRoundingMode(behaviors.roundingMode()).isNegative) + } + + func test__zero_is_not_negative() { + XCTAssertFalse(NSDecimal.zero().isNegative) + XCTAssertFalse(NSDecimal.one().isNegative) + } + + func test__addition() { + let result = a.add(b, withRoundingMode: behaviors.roundingMode()) + let _result = decimalNumberA.add(decimalNumberB, withBehaviors: behaviors) + XCTAssertEqual(result, _result.decimalValue) + XCTAssertEqual(_result, 30) + } + + func test__subtraction() { + let result = a.subtract(b, withRoundingMode: behaviors.roundingMode()) + let _result = decimalNumberA.subtract(decimalNumberB, withBehaviors: behaviors) + XCTAssertEqual(result, _result.decimalValue) + XCTAssertEqual(_result, -10) + } + + func test__multiplication() { + let result = a.multiplyBy(b, withRoundingMode: behaviors.roundingMode()) + let _result = decimalNumberA.multiplyBy(decimalNumberB, withBehaviors: behaviors) + XCTAssertEqual(result, _result.decimalValue) + XCTAssertEqual(_result, 200) + } + + func test__division() { + let result = a.divideBy(b, withRoundingMode: behaviors.roundingMode()) + let _result = decimalNumberA.divideBy(decimalNumberB, withBehaviors: behaviors) + XCTAssertEqual(result, _result.decimalValue) + XCTAssertEqual(_result, 0.5) + } + + func test__remainder() { + let result = a.remainder(b, withRoundingMode: behaviors.roundingMode()) + let _result = decimalNumberA.remainder(decimalNumberB, withBehaviors: behaviors) + XCTAssertEqual(result, _result.decimalValue) + XCTAssertEqual(_result, 10) + } + +} diff --git a/Tests/Troll.png b/Tests/Troll.png new file mode 100644 index 0000000..0bbe2f9 Binary files /dev/null and b/Tests/Troll.png differ diff --git a/header.png b/header.png new file mode 100644 index 0000000..cf3a5ea Binary files /dev/null and b/header.png differ