Added a project.

This commit is contained in:
Alex Liu
2019-06-27 02:59:51 -04:00
parent 761d44339a
commit 4b241f9e71
22 changed files with 1614 additions and 1 deletions

View File

@@ -0,0 +1,611 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
5FFA056822C48D0F009057CC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA056722C48D0F009057CC /* AppDelegate.swift */; };
5FFA056A22C48D0F009057CC /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA056922C48D0F009057CC /* SceneDelegate.swift */; };
5FFA056E22C48D11009057CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5FFA056D22C48D11009057CC /* Assets.xcassets */; };
5FFA057122C48D11009057CC /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5FFA057022C48D11009057CC /* Preview Assets.xcassets */; };
5FFA057422C48D11009057CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5FFA057222C48D11009057CC /* LaunchScreen.storyboard */; };
5FFA057F22C48D11009057CC /* Currency_SwiftUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA057E22C48D11009057CC /* Currency_SwiftUITests.swift */; };
5FFA058A22C48D11009057CC /* Currency_SwiftUIUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA058922C48D11009057CC /* Currency_SwiftUIUITests.swift */; };
5FFA059E22C48D7A009057CC /* ConverterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA059722C48D7A009057CC /* ConverterView.swift */; };
5FFA059F22C48D7A009057CC /* AddCurrencyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA059822C48D7A009057CC /* AddCurrencyView.swift */; };
5FFA05A122C48D7A009057CC /* CurrencyList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA059A22C48D7A009057CC /* CurrencyList.swift */; };
5FFA05A222C48D7A009057CC /* CurrencyItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA059B22C48D7A009057CC /* CurrencyItemView.swift */; };
5FFA05A322C48D7A009057CC /* CurrencyData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA059C22C48D7A009057CC /* CurrencyData.swift */; };
5FFA05A422C48D7A009057CC /* UserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFA059D22C48D7A009057CC /* UserData.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
5FFA057B22C48D11009057CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5FFA055C22C48D0F009057CC /* Project object */;
proxyType = 1;
remoteGlobalIDString = 5FFA056322C48D0F009057CC;
remoteInfo = "Currency-SwiftUI";
};
5FFA058622C48D11009057CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5FFA055C22C48D0F009057CC /* Project object */;
proxyType = 1;
remoteGlobalIDString = 5FFA056322C48D0F009057CC;
remoteInfo = "Currency-SwiftUI";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
5FFA056422C48D0F009057CC /* Currency-SwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Currency-SwiftUI.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5FFA056722C48D0F009057CC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5FFA056922C48D0F009057CC /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
5FFA056D22C48D11009057CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5FFA057022C48D11009057CC /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
5FFA057322C48D11009057CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5FFA057522C48D11009057CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5FFA057A22C48D11009057CC /* Currency-SwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Currency-SwiftUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
5FFA057E22C48D11009057CC /* Currency_SwiftUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Currency_SwiftUITests.swift; sourceTree = "<group>"; };
5FFA058022C48D11009057CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5FFA058522C48D11009057CC /* Currency-SwiftUIUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Currency-SwiftUIUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
5FFA058922C48D11009057CC /* Currency_SwiftUIUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Currency_SwiftUIUITests.swift; sourceTree = "<group>"; };
5FFA058B22C48D11009057CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5FFA059722C48D7A009057CC /* ConverterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConverterView.swift; sourceTree = "<group>"; };
5FFA059822C48D7A009057CC /* AddCurrencyView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddCurrencyView.swift; sourceTree = "<group>"; };
5FFA059A22C48D7A009057CC /* CurrencyList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrencyList.swift; sourceTree = "<group>"; };
5FFA059B22C48D7A009057CC /* CurrencyItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrencyItemView.swift; sourceTree = "<group>"; };
5FFA059C22C48D7A009057CC /* CurrencyData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrencyData.swift; sourceTree = "<group>"; };
5FFA059D22C48D7A009057CC /* UserData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserData.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5FFA056122C48D0F009057CC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
5FFA057722C48D11009057CC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
5FFA058222C48D11009057CC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5FFA055B22C48D0F009057CC = {
isa = PBXGroup;
children = (
5FFA056622C48D0F009057CC /* Currency-SwiftUI */,
5FFA057D22C48D11009057CC /* Currency-SwiftUITests */,
5FFA058822C48D11009057CC /* Currency-SwiftUIUITests */,
5FFA056522C48D0F009057CC /* Products */,
);
sourceTree = "<group>";
};
5FFA056522C48D0F009057CC /* Products */ = {
isa = PBXGroup;
children = (
5FFA056422C48D0F009057CC /* Currency-SwiftUI.app */,
5FFA057A22C48D11009057CC /* Currency-SwiftUITests.xctest */,
5FFA058522C48D11009057CC /* Currency-SwiftUIUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
5FFA056622C48D0F009057CC /* Currency-SwiftUI */ = {
isa = PBXGroup;
children = (
5FFA059822C48D7A009057CC /* AddCurrencyView.swift */,
5FFA059722C48D7A009057CC /* ConverterView.swift */,
5FFA059C22C48D7A009057CC /* CurrencyData.swift */,
5FFA059B22C48D7A009057CC /* CurrencyItemView.swift */,
5FFA059A22C48D7A009057CC /* CurrencyList.swift */,
5FFA059D22C48D7A009057CC /* UserData.swift */,
5FFA056722C48D0F009057CC /* AppDelegate.swift */,
5FFA056922C48D0F009057CC /* SceneDelegate.swift */,
5FFA056D22C48D11009057CC /* Assets.xcassets */,
5FFA057222C48D11009057CC /* LaunchScreen.storyboard */,
5FFA057522C48D11009057CC /* Info.plist */,
5FFA056F22C48D11009057CC /* Preview Content */,
);
path = "Currency-SwiftUI";
sourceTree = "<group>";
};
5FFA056F22C48D11009057CC /* Preview Content */ = {
isa = PBXGroup;
children = (
5FFA057022C48D11009057CC /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
5FFA057D22C48D11009057CC /* Currency-SwiftUITests */ = {
isa = PBXGroup;
children = (
5FFA057E22C48D11009057CC /* Currency_SwiftUITests.swift */,
5FFA058022C48D11009057CC /* Info.plist */,
);
path = "Currency-SwiftUITests";
sourceTree = "<group>";
};
5FFA058822C48D11009057CC /* Currency-SwiftUIUITests */ = {
isa = PBXGroup;
children = (
5FFA058922C48D11009057CC /* Currency_SwiftUIUITests.swift */,
5FFA058B22C48D11009057CC /* Info.plist */,
);
path = "Currency-SwiftUIUITests";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5FFA056322C48D0F009057CC /* Currency-SwiftUI */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5FFA058E22C48D11009057CC /* Build configuration list for PBXNativeTarget "Currency-SwiftUI" */;
buildPhases = (
5FFA056022C48D0F009057CC /* Sources */,
5FFA056122C48D0F009057CC /* Frameworks */,
5FFA056222C48D0F009057CC /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Currency-SwiftUI";
productName = "Currency-SwiftUI";
productReference = 5FFA056422C48D0F009057CC /* Currency-SwiftUI.app */;
productType = "com.apple.product-type.application";
};
5FFA057922C48D11009057CC /* Currency-SwiftUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5FFA059122C48D11009057CC /* Build configuration list for PBXNativeTarget "Currency-SwiftUITests" */;
buildPhases = (
5FFA057622C48D11009057CC /* Sources */,
5FFA057722C48D11009057CC /* Frameworks */,
5FFA057822C48D11009057CC /* Resources */,
);
buildRules = (
);
dependencies = (
5FFA057C22C48D11009057CC /* PBXTargetDependency */,
);
name = "Currency-SwiftUITests";
productName = "Currency-SwiftUITests";
productReference = 5FFA057A22C48D11009057CC /* Currency-SwiftUITests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
5FFA058422C48D11009057CC /* Currency-SwiftUIUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5FFA059422C48D11009057CC /* Build configuration list for PBXNativeTarget "Currency-SwiftUIUITests" */;
buildPhases = (
5FFA058122C48D11009057CC /* Sources */,
5FFA058222C48D11009057CC /* Frameworks */,
5FFA058322C48D11009057CC /* Resources */,
);
buildRules = (
);
dependencies = (
5FFA058722C48D11009057CC /* PBXTargetDependency */,
);
name = "Currency-SwiftUIUITests";
productName = "Currency-SwiftUIUITests";
productReference = 5FFA058522C48D11009057CC /* Currency-SwiftUIUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5FFA055C22C48D0F009057CC /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = "Alex Liu";
TargetAttributes = {
5FFA056322C48D0F009057CC = {
CreatedOnToolsVersion = 11.0;
};
5FFA057922C48D11009057CC = {
CreatedOnToolsVersion = 11.0;
TestTargetID = 5FFA056322C48D0F009057CC;
};
5FFA058422C48D11009057CC = {
CreatedOnToolsVersion = 11.0;
TestTargetID = 5FFA056322C48D0F009057CC;
};
};
};
buildConfigurationList = 5FFA055F22C48D0F009057CC /* Build configuration list for PBXProject "Currency-SwiftUI" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 5FFA055B22C48D0F009057CC;
productRefGroup = 5FFA056522C48D0F009057CC /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5FFA056322C48D0F009057CC /* Currency-SwiftUI */,
5FFA057922C48D11009057CC /* Currency-SwiftUITests */,
5FFA058422C48D11009057CC /* Currency-SwiftUIUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5FFA056222C48D0F009057CC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5FFA057422C48D11009057CC /* LaunchScreen.storyboard in Resources */,
5FFA057122C48D11009057CC /* Preview Assets.xcassets in Resources */,
5FFA056E22C48D11009057CC /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5FFA057822C48D11009057CC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
5FFA058322C48D11009057CC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5FFA056022C48D0F009057CC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5FFA05A322C48D7A009057CC /* CurrencyData.swift in Sources */,
5FFA059F22C48D7A009057CC /* AddCurrencyView.swift in Sources */,
5FFA056822C48D0F009057CC /* AppDelegate.swift in Sources */,
5FFA05A122C48D7A009057CC /* CurrencyList.swift in Sources */,
5FFA059E22C48D7A009057CC /* ConverterView.swift in Sources */,
5FFA056A22C48D0F009057CC /* SceneDelegate.swift in Sources */,
5FFA05A222C48D7A009057CC /* CurrencyItemView.swift in Sources */,
5FFA05A422C48D7A009057CC /* UserData.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5FFA057622C48D11009057CC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5FFA057F22C48D11009057CC /* Currency_SwiftUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5FFA058122C48D11009057CC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5FFA058A22C48D11009057CC /* Currency_SwiftUIUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
5FFA057C22C48D11009057CC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 5FFA056322C48D0F009057CC /* Currency-SwiftUI */;
targetProxy = 5FFA057B22C48D11009057CC /* PBXContainerItemProxy */;
};
5FFA058722C48D11009057CC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 5FFA056322C48D0F009057CC /* Currency-SwiftUI */;
targetProxy = 5FFA058622C48D11009057CC /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
5FFA057222C48D11009057CC /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
5FFA057322C48D11009057CC /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5FFA058C22C48D11009057CC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
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 = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
5FFA058D22C48D11009057CC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
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 = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
5FFA058F22C48D11009057CC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "Currency-SwiftUI/Preview\\ Content";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "Currency-SwiftUI/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "alex.liu.Currency-SwiftUI";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
5FFA059022C48D11009057CC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "Currency-SwiftUI/Preview\\ Content";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "Currency-SwiftUI/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "alex.liu.Currency-SwiftUI";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
5FFA059222C48D11009057CC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Currency-SwiftUITests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "alex.liu.Currency-SwiftUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Currency-SwiftUI.app/Currency-SwiftUI";
};
name = Debug;
};
5FFA059322C48D11009057CC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Currency-SwiftUITests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "alex.liu.Currency-SwiftUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Currency-SwiftUI.app/Currency-SwiftUI";
};
name = Release;
};
5FFA059522C48D11009057CC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Currency-SwiftUIUITests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "alex.liu.Currency-SwiftUIUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = "Currency-SwiftUI";
};
name = Debug;
};
5FFA059622C48D11009057CC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Currency-SwiftUIUITests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "alex.liu.Currency-SwiftUIUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = "Currency-SwiftUI";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5FFA055F22C48D0F009057CC /* Build configuration list for PBXProject "Currency-SwiftUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5FFA058C22C48D11009057CC /* Debug */,
5FFA058D22C48D11009057CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5FFA058E22C48D11009057CC /* Build configuration list for PBXNativeTarget "Currency-SwiftUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5FFA058F22C48D11009057CC /* Debug */,
5FFA059022C48D11009057CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5FFA059122C48D11009057CC /* Build configuration list for PBXNativeTarget "Currency-SwiftUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5FFA059222C48D11009057CC /* Debug */,
5FFA059322C48D11009057CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5FFA059422C48D11009057CC /* Build configuration list for PBXNativeTarget "Currency-SwiftUIUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5FFA059522C48D11009057CC /* Debug */,
5FFA059622C48D11009057CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5FFA055C22C48D0F009057CC /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Currency-SwiftUI.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,62 @@
//
// AddCurrencyView.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-20.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 SwiftUI
struct AddCurrencyView : View {
@EnvironmentObject var userData: UserData
var body: some View {
List {
ForEach(userData.allCurrencies) { currency in
return HStack {
Button(action: { self.select(currency) }) {
Text("\(currency.code) - \(currency.name)")
}
Spacer()
if self.isSelected(currency) {
Image(systemName: "checkmark").foregroundColor(.blue)
}
}
}
}.navigationBarItem(title: Text("Add Currency"))
}
private func select(_ currency: Currency) {
if userData.userCurrency.map({ $0.code }).contains(currency.code) {
userData.userCurrency.removeAll{$0.code == currency.code}
}
else {
userData.userCurrency.append(currency)
}
}
private func isSelected(_ currency: Currency) -> Bool {
return userData.userCurrency.map({ $0.code }).contains(currency.code)
}
}

View File

@@ -0,0 +1,58 @@
//
// AppDelegate.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-27.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

View File

@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"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" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"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"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,158 @@
//
// ContentView.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-20.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 SwiftUI
struct ConverterView : View {
@EnvironmentObject var userData: UserData
@State var baseAmount: String = "1.0"
@State var isEditing: Bool = false
@State var lastUpdated: String = ""
var body: some View {
let inset = EdgeInsets(top: -8, leading: -20, bottom: -7, trailing: 5)
let doubleValue: Double = Double(self.$baseAmount.value) ?? 1.0
return ZStack(alignment: .bottomTrailing) {
VStack(alignment: .leading){
Text("From:").bold().color(.gray)
HStack{
// Flag
Text("\(userData.baseCurrency.flag)").padding(5)
// Code and name
VStack(alignment: .leading){
Text(userData.baseCurrency.code).color(.white)
Text(userData.baseCurrency.name).color(.white)
}
Spacer()
// Amount and conversion
TextField($baseAmount, placeholder: Text("1.0"), onCommit: {
// TODO: update all currencies on the following list
}).foregroundColor(.white)
.background(
RoundedRectangle(cornerRadius: 5)
.fill(Color.clear)
.border(Color(red: 0.7, green: 0.7, blue: 0.7), width: 1 / UIScreen.main.scale, cornerRadius: 5)
.padding(inset)
)
}.background(Color.blue).cornerRadius(5)
Text("To:").bold().color(.gray)
List {
// TODO: should filter out BaseCurrency from list
ForEach(userData.userCurrency) { currency in
CurrencyItemView(currency: currency, baseAmount: doubleValue, isEditing: self.$isEditing).tapAction {
// Swap this and base
self.userData.baseCurrency = currency
}
}
}.onAppear(perform: loadCurrencies)
.navigationBarItem(title: Text("Currenceis 💱"))
.navigationBarItems(trailing: Button(action: { self.isEditing.toggle() }) {
if !self.isEditing {
Text("Edit")
} else {
Text("Done").bold()
}
})
Text("Last updated: \(self.lastUpdated)").color(.gray).bold()
}
NavigationButton(destination: AddCurrencyView().environmentObject(self.userData)) {
Text("💰")
}.frame(width: 46, height: 46, alignment: .center)
.background(
RoundedRectangle(cornerRadius: 23)
.fill(Color.blue)
.border(Color(red: 0.7, green: 0.7, blue: 0.7), width: 1 / UIScreen.main.scale, cornerRadius: 23))
.foregroundColor(.white).font(.largeTitle)
}.padding()
}
private func loadCurrencies() {
// Check if last updated is the same date
// if not the same pull from remote with base currency
let url = URL(string: "https://api.exchangeratesapi.io/latest?base=USD")!
let task = URLSession.shared.dataTask(with: url, completionHandler: { data, _, _ in
if let data = data {
if let decoded: CurrencyList = self.decodeData(CurrencyList.self, data){
//
self.lastUpdated = decoded.date
// generate currency data
var newCurrencies = [Currency]()
for key in decoded.rates.keys {
let newCurrency = Currency(name: supportedCurrencies[key]?[0] ?? "Unknown", rate: 1.0 / (decoded.rates[key] ?? 1.0), symbol: supportedCurrencies[key]?[1] ?? "", code: key)
newCurrencies.append(newCurrency)
}
DispatchQueue.main.async {
self.userData.allCurrencies = newCurrencies
if let base = self.userData.allCurrencies.filter({ $0.symbol == self.userData.baseCurrency.symbol }).first {
self.userData.baseCurrency = base
}
var tempNewUserCurrency = [Currency]()
let userCurrencies = self.userData.userCurrency.map{ $0.code }
for c in self.userData.allCurrencies {
if userCurrencies.contains(c.code){
tempNewUserCurrency.append(c)
}
}
self.userData.userCurrency = tempNewUserCurrency
}
}
}
})
task.resume()
}
}
extension ConverterView
{
private func decodeData<T>(_ decodeObject: T.Type, _ data: Data) -> T? where T: Codable
{
let decoder = JSONDecoder()
do
{
return try decoder.decode(decodeObject.self, from: data)
}
catch let jsonErr
{
print("Error decoding Json ", jsonErr)
return nil
}
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ConverterView().environmentObject(UserData())
}
}
#endif

View File

@@ -0,0 +1,59 @@
//
// CurrencyData.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-20.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 SwiftUI
struct Currency: Equatable, Hashable, Codable, Identifiable{
let id: UUID
let name: String
// This is a rate to USD
let rate: Double
let symbol: String
let code: String
init(name: String, rate: Double, symbol: String = "", code: String) {
self.id = UUID()
self.name = name
self.rate = rate
self.symbol = symbol
self.code = code
}
// Get unicode flag by currency symbol
var flag: String {
// Hard-code EU for now
if self.symbol == "EU" { return "🇪🇺" }
let base : UInt32 = 127397
var s = ""
for v in self.symbol.uppercased().unicodeScalars {
s.unicodeScalars.append(UnicodeScalar(base + v.value)!)
}
return s
}
}

View File

@@ -0,0 +1,82 @@
//
// CurrencyItem.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-20.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 SwiftUI
struct CurrencyItemView: View {
@EnvironmentObject var userData: UserData
let currency: Currency
let baseAmount: Double
@Binding var isEditing: Bool
var body: some View {
let currency = self.currency
let converstionRate = String(format: "%.4f", currency.rate / userData.baseCurrency.rate)
let totalAmount = String(format: "%.3f", baseAmount * ( userData.baseCurrency.rate / currency.rate))
return HStack {
if self.isEditing {
// This is for delete mode
HStack(alignment: .center){
Image(systemName: "minus.circle")
.foregroundColor(.red)
.tapAction(count: 1) {
self.delete()
}
Text(currency.flag).font(.title)
VStack(alignment: .leading){
Text(currency.code)
Text(currency.name).color(.gray)
}
}
}
else {
// This is normal mode
HStack{
// Flag
Text(currency.flag).font(.largeTitle)
// Code and name
VStack(alignment: .leading){
Text(currency.code).font(.headline)
Text(currency.name).font(.footnote).color(.gray)
}
Spacer()
// Amount and conversion
VStack(alignment: .trailing){
Text("\(totalAmount)")
// Would be 1 this currency = xxx base currency
Text("1 \(currency.code) = \(converstionRate) \(userData.baseCurrency.code)").color(.gray)
}
}
}
}
}
// TODO: need to implement
private func delete() {
}
}

View File

@@ -0,0 +1,69 @@
//
// CurrencyList.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-21.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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
struct CurrencyList: Codable{
let base: String
let date: String
let rates: [String: Double]
}
/// All supported currencies
let supportedCurrencies: [String: [String]] = [
"THB": ["Thai baht", "TH"],
"PHP": ["Philippine peso", "PH"],
"CZK": ["Czech koruna", "CZ"],
"BRL": ["Brazilian real", "BR"],
"CHF": ["Swiss franc", "CH"],
"INR": ["Indian rupee", "IN"],
"ISK": ["Icelandic króna", "IS"],
"HRK": ["Croatian kuna", "HR"],
"PLN": ["Polish złoty", "PL"],
"NOK": ["Norwegian krone", "NO"],
"USD": ["US Dollar", "US"],
"CNY": ["Chinese Renminbi", "CN"],
"RUB": ["Russian ruble", "RU"],
"SEK": ["Swedish krona", "SE"],
"MYR": ["Malaysian ringgit", "MY"],
"SGD": ["Singapore dollar", "SG"],
"ILS": ["Israeli new shekel", "IL"],
"TRY": ["Turkish lira", "TR"],
"BGN": ["Bulgarian lev", "BG"],
"NZD": ["New Zealand dollar", "NZ"],
"HKD": ["Hong Kong dollar", "HK"],
"RON": ["Romanian leu", "RO"],
"EUR": ["Euro", "EU"],
"MXN": ["Mexican peso", "MX"],
"CAD": ["Canadian Dollar", "CA"],
"AUD": ["Australian dollar", "AU"],
"GBP": ["Pound sterling", "GB"],
"KRW": ["South Korean won", "KR"],
"IDR": ["Indonesian rupiah", "ID"],
"JPY": ["Japanese yen", "JP"],
"DKK": ["Danish krone", "DK"],
"ZAR": ["South African rand", "ZA"],
"HUF": ["Hungarian forint", "HU"]
]

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,78 @@
//
// SceneDelegate.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-27.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Use a UIHostingController as window root view controller
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: NavigationView {
ConverterView().environmentObject(UserData())
})
self.window = window
window.makeKeyAndVisible()
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}

View File

@@ -0,0 +1,78 @@
//
// UserData.swift
// Currency-SwiftUI
//
// Created by Alex Liu on 2019-06-20.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 Combine
import SwiftUI
import Foundation
private let defaultCurrencies: [Currency] = [
Currency(name: "US dollar", rate: 1.0, symbol: "US", code: "USD"),
Currency(name: "Canadian dollar", rate: 1.0, symbol: "CA", code: "CAD")
]
@propertyDelegate
struct UserDefaultValue<Value: Codable> {
let key: String
let defaultValue: Value
var value: Value {
get {
let data = UserDefaults.standard.data(forKey: key)
let value = data.flatMap { try? JSONDecoder().decode(Value.self, from: $0) }
return value ?? defaultValue
}
set {
let data = try? JSONEncoder().encode(newValue)
UserDefaults.standard.set(data, forKey: key)
}
}
}
final class UserData: BindableObject {
let didChange = PassthroughSubject<UserData, Never>()
@UserDefaultValue(key: "allCurrencies", defaultValue: defaultCurrencies)
var allCurrencies: [Currency] {
didSet {
didChange.send(self)
}
}
@UserDefaultValue(key: "baseCurrency", defaultValue: defaultCurrencies[0])
var baseCurrency: Currency {
didSet {
didChange.send(self)
}
}
@UserDefaultValue(key: "userCurrency", defaultValue: defaultCurrencies)
var userCurrency: [Currency] {
didSet {
didChange.send(self)
}
}
}

View File

@@ -0,0 +1,51 @@
//
// Currency_SwiftUITests.swift
// Currency-SwiftUITests
//
// Created by Alex Liu on 2019-06-27.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 XCTest
@testable import Currency_SwiftUI
class Currency_SwiftUITests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,51 @@
//
// Currency_SwiftUIUITests.swift
// Currency-SwiftUIUITests
//
// Created by Alex Liu on 2019-06-27.
// Copyright © 2018 Alex Liu <alexliubo@gmail.com> All rights reserved.
//
// 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 XCTest
class Currency_SwiftUIUITests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -225,7 +225,7 @@ Size of area attach to state of property `show`:
<img src="Resources/SwiftUISideMenu.gif" width="300"> <img src="Resources/SwiftUISideMenu.gif" width="300">
### SwiftUI Currency ### SwiftUI Currency
[Source](https://github.com/alexliubj/SwiftUI-Currency-Converter)
<img src="Resources/SwiftUICurrency.png" width="300"> <img src="Resources/SwiftUICurrency.png" width="300">
### Authors ### Authors

View File

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 161 KiB