Mercurial > public > simoleon
changeset 16:aec2e86e5dbd
Change design and icon
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Thu, 15 Jul 2021 19:03:24 +0100 |
parents | a02f463aa906 |
children | 4a81e39186f1 |
files | Simoleon.xcodeproj/project.pbxproj Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Simoleon/Assets.xcassets/AccentColor.colorset/Contents.json Simoleon/Assets.xcassets/AppIcon.appiconset/Contents.json Simoleon/Assets.xcassets/AppIcon.appiconset/Icon.png Simoleon/Assets.xcassets/AppIcon.appiconset/appstore1024.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_20pt.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_29pt.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_40pt.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_76pt.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png Simoleon/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipad152.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipad76.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadNotification20.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadNotification40.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadPro167.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadSettings29.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadSettings58.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadSpotlight40.png Simoleon/Assets.xcassets/AppIcon.appiconset/ipadSpotlight80.png Simoleon/Assets.xcassets/AppIcon.appiconset/iphone120.png Simoleon/Assets.xcassets/AppIcon.appiconset/iphone180.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac1024.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac128.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac16.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac256.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac32.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac512.png Simoleon/Assets.xcassets/AppIcon.appiconset/mac64.png Simoleon/Assets.xcassets/AppIcon.appiconset/notification40.png Simoleon/Assets.xcassets/AppIcon.appiconset/notification60.png Simoleon/Assets.xcassets/AppIcon.appiconset/settings58.png Simoleon/Assets.xcassets/AppIcon.appiconset/settings87.png Simoleon/Assets.xcassets/AppIcon.appiconset/spotlight120.png Simoleon/Assets.xcassets/AppIcon.appiconset/spotlight80.png Simoleon/Assets.xcassets/Colours/Bone.colorset/Contents.json Simoleon/Assets.xcassets/Colours/Border.colorset/Contents.json Simoleon/Assets.xcassets/Colours/Contents.json Simoleon/Assets.xcassets/Colours/FlagBorder.colorset/Contents.json Simoleon/Assets.xcassets/Colours/LaunchBackground.colorset/Contents.json Simoleon/Assets.xcassets/Colours/Opal.colorset/Contents.json Simoleon/Assets.xcassets/Colours/Shadow.colorset/Contents.json Simoleon/Assets.xcassets/Colours/SilverPink.colorset/Contents.json Simoleon/Assets.xcassets/Colours/WildBlueYoder.colorset/Contents.json Simoleon/Assets.xcassets/LaunchLogo.imageset/Contents.json Simoleon/Assets.xcassets/LaunchLogo.imageset/LaunchLogo.png Simoleon/Assets.xcassets/LaunchLogo.imageset/icon.png Simoleon/ContentView.swift Simoleon/Helpers/CurrencyConversion.swift Simoleon/Helpers/CurrencyRow.swift Simoleon/Helpers/FlagPair.swift Simoleon/Helpers/SearchBar.swift Simoleon/Helpers/SearchedCurrencyList.swift Simoleon/Helpers/Sidebar.swift Simoleon/Helpers/SingleFlag.swift Simoleon/LaunchScreen.storyboard Simoleon/Models/CurrencyMetadataModel.swift Simoleon/Models/CurrencyQuoteModel.swift Simoleon/Pad/PrimaryView.swift Simoleon/Pad/SecondaryView.swift Simoleon/Pad/SidebarNavigation.swift Simoleon/Pad/SupplementaryView.swift Simoleon/SimoleonApp.swift |
diffstat | 75 files changed, 317 insertions(+), 1024 deletions(-) [+] |
line wrap: on
line diff
--- a/Simoleon.xcodeproj/project.pbxproj Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon.xcodeproj/project.pbxproj Thu Jul 15 19:03:24 2021 +0100 @@ -7,17 +7,18 @@ objects = { /* Begin PBXBuildFile section */ - 954DB2EB269F43C80069F317 /* Sidebar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954DB2EA269F43C80069F317 /* Sidebar.swift */; }; - 95559333269B0965000FD726 /* CurrencyQuoteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95559332269B0965000FD726 /* CurrencyQuoteModel.swift */; }; 95559337269B0A7B000FD726 /* CurrencyQuoteData.json in Resources */ = {isa = PBXBuildFile; fileRef = 95559336269B0A7B000FD726 /* CurrencyQuoteData.json */; }; 9555933A269B0AB8000FD726 /* ParseJson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95559339269B0AB8000FD726 /* ParseJson.swift */; }; 9555933D269B0E0A000FD726 /* CurrencyMetadata.json in Resources */ = {isa = PBXBuildFile; fileRef = 9555933C269B0E0A000FD726 /* CurrencyMetadata.json */; }; - 9555933F269B0E47000FD726 /* CurrencyMetadataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9555933E269B0E47000FD726 /* CurrencyMetadataModel.swift */; }; - 956C28CA269B5893005A4595 /* CurrencyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956C28C9269B5893005A4595 /* CurrencyRow.swift */; }; - 956C28CC269B58A0005A4595 /* FlagPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956C28CB269B58A0005A4595 /* FlagPair.swift */; }; + 95AEBC9526A03ECB00613729 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9426A03ECB00613729 /* ContentView.swift */; }; + 95AEBC9726A043C100613729 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9626A043C100613729 /* SearchBar.swift */; }; + 95AEBC9B26A04A4200613729 /* CurrencyMetadataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9A26A04A4200613729 /* CurrencyMetadataModel.swift */; }; + 95AEBC9D26A04D4600613729 /* CurrencyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9C26A04D4600613729 /* CurrencyRow.swift */; }; + 95AEBC9F26A08A1C00613729 /* CurrencyConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9E26A08A1C00613729 /* CurrencyConversion.swift */; }; + 95AEBCA326A0900E00613729 /* CurrencyQuoteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBCA226A0900E00613729 /* CurrencyQuoteModel.swift */; }; + 95AEBCA826A0AE2400613729 /* Sidebar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBCA726A0AE2400613729 /* Sidebar.swift */; }; 95C02C8B269B61680061DD6D /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 95C02C8A269B61680061DD6D /* Alamofire */; }; 95C5B2282697752600941585 /* SimoleonApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5B2272697752600941585 /* SimoleonApp.swift */; }; - 95C5B22A2697752600941585 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5B2292697752600941585 /* ContentView.swift */; }; 95C5B22C2697752700941585 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95C5B22B2697752700941585 /* Assets.xcassets */; }; 95C5B22F2697752700941585 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95C5B22E2697752700941585 /* Preview Assets.xcassets */; }; 95C5B2312697752700941585 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5B2302697752700941585 /* Persistence.swift */; }; @@ -25,17 +26,9 @@ 95C5B23F2697752700941585 /* SimoleonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5B23E2697752700941585 /* SimoleonTests.swift */; }; 95C5B24A2697752700941585 /* SimoleonUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5B2492697752700941585 /* SimoleonUITests.swift */; }; 95DD4ABB269B33810027CA1F /* CurrencyPairs.json in Resources */ = {isa = PBXBuildFile; fileRef = 95DD4ABA269B33810027CA1F /* CurrencyPairs.json */; }; - 95E137CF269C9D8B00D2C5DC /* CurrencyConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E137CE269C9D8B00D2C5DC /* CurrencyConversion.swift */; }; - 95E137D1269C9F0D00D2C5DC /* SingleFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E137D0269C9F0D00D2C5DC /* SingleFlag.swift */; }; 95E76432269DF531008E9F31 /* PopularCurrencyPairs.json in Resources */ = {isa = PBXBuildFile; fileRef = 95E76431269DF531008E9F31 /* PopularCurrencyPairs.json */; }; - 95E76434269DF63D008E9F31 /* SearchedCurrencyList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E76433269DF63D008E9F31 /* SearchedCurrencyList.swift */; }; 95E76436269DFC1A008E9F31 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 95E76435269DFC1A008E9F31 /* LaunchScreen.storyboard */; }; 95E7643A269E0037008E9F31 /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95E76439269E0037008E9F31 /* CloudKit.framework */; }; - 95EA4F4226A0346800AF89F6 /* SidebarNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95EA4F4126A0346800AF89F6 /* SidebarNavigation.swift */; }; - 95EA4F4426A034CC00AF89F6 /* PrimaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95EA4F4326A034CC00AF89F6 /* PrimaryView.swift */; }; - 95EA4F4626A034D800AF89F6 /* SupplementaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95EA4F4526A034D800AF89F6 /* SupplementaryView.swift */; }; - 95EA4F4826A034E000AF89F6 /* SecondaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95EA4F4726A034E000AF89F6 /* SecondaryView.swift */; }; - 95FE659C269AFB54008745DE /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95FE659B269AFB54008745DE /* SearchBar.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -56,17 +49,18 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 954DB2EA269F43C80069F317 /* Sidebar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar.swift; sourceTree = "<group>"; }; - 95559332269B0965000FD726 /* CurrencyQuoteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyQuoteModel.swift; sourceTree = "<group>"; }; 95559336269B0A7B000FD726 /* CurrencyQuoteData.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = CurrencyQuoteData.json; sourceTree = "<group>"; }; 95559339269B0AB8000FD726 /* ParseJson.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseJson.swift; sourceTree = "<group>"; }; 9555933C269B0E0A000FD726 /* CurrencyMetadata.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = CurrencyMetadata.json; sourceTree = "<group>"; }; - 9555933E269B0E47000FD726 /* CurrencyMetadataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyMetadataModel.swift; sourceTree = "<group>"; }; - 956C28C9269B5893005A4595 /* CurrencyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyRow.swift; sourceTree = "<group>"; }; - 956C28CB269B58A0005A4595 /* FlagPair.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagPair.swift; sourceTree = "<group>"; }; + 95AEBC9426A03ECB00613729 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; + 95AEBC9626A043C100613729 /* SearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; }; + 95AEBC9A26A04A4200613729 /* CurrencyMetadataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyMetadataModel.swift; sourceTree = "<group>"; }; + 95AEBC9C26A04D4600613729 /* CurrencyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyRow.swift; sourceTree = "<group>"; }; + 95AEBC9E26A08A1C00613729 /* CurrencyConversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyConversion.swift; sourceTree = "<group>"; }; + 95AEBCA226A0900E00613729 /* CurrencyQuoteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyQuoteModel.swift; sourceTree = "<group>"; }; + 95AEBCA726A0AE2400613729 /* Sidebar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar.swift; sourceTree = "<group>"; }; 95C5B2242697752600941585 /* Simoleon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Simoleon.app; sourceTree = BUILT_PRODUCTS_DIR; }; 95C5B2272697752600941585 /* SimoleonApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimoleonApp.swift; sourceTree = "<group>"; }; - 95C5B2292697752600941585 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; 95C5B22B2697752700941585 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 95C5B22E2697752700941585 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; 95C5B2302697752700941585 /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; }; @@ -79,18 +73,10 @@ 95C5B2492697752700941585 /* SimoleonUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimoleonUITests.swift; sourceTree = "<group>"; }; 95C5B24B2697752700941585 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 95DD4ABA269B33810027CA1F /* CurrencyPairs.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = CurrencyPairs.json; sourceTree = "<group>"; }; - 95E137CE269C9D8B00D2C5DC /* CurrencyConversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyConversion.swift; sourceTree = "<group>"; }; - 95E137D0269C9F0D00D2C5DC /* SingleFlag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleFlag.swift; sourceTree = "<group>"; }; 95E76431269DF531008E9F31 /* PopularCurrencyPairs.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = PopularCurrencyPairs.json; sourceTree = "<group>"; }; - 95E76433269DF63D008E9F31 /* SearchedCurrencyList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchedCurrencyList.swift; sourceTree = "<group>"; }; 95E76435269DFC1A008E9F31 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; }; 95E76437269E0033008E9F31 /* Simoleon.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Simoleon.entitlements; sourceTree = "<group>"; }; 95E76439269E0037008E9F31 /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; }; - 95EA4F4126A0346800AF89F6 /* SidebarNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarNavigation.swift; sourceTree = "<group>"; }; - 95EA4F4326A034CC00AF89F6 /* PrimaryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryView.swift; sourceTree = "<group>"; }; - 95EA4F4526A034D800AF89F6 /* SupplementaryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupplementaryView.swift; sourceTree = "<group>"; }; - 95EA4F4726A034E000AF89F6 /* SecondaryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondaryView.swift; sourceTree = "<group>"; }; - 95FE659B269AFB54008745DE /* SearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -123,8 +109,8 @@ 95559331269B094A000FD726 /* Models */ = { isa = PBXGroup; children = ( - 95559332269B0965000FD726 /* CurrencyQuoteModel.swift */, - 9555933E269B0E47000FD726 /* CurrencyMetadataModel.swift */, + 95AEBC9A26A04A4200613729 /* CurrencyMetadataModel.swift */, + 95AEBCA226A0900E00613729 /* CurrencyQuoteModel.swift */, ); path = Models; sourceTree = "<group>"; @@ -173,7 +159,7 @@ children = ( 95E76437269E0033008E9F31 /* Simoleon.entitlements */, 95C5B2272697752600941585 /* SimoleonApp.swift */, - 95C5B2292697752600941585 /* ContentView.swift */, + 95AEBC9426A03ECB00613729 /* ContentView.swift */, 95C5B22B2697752700941585 /* Assets.xcassets */, 95C5B2302697752700941585 /* Persistence.swift */, 95C5B2352697752700941585 /* Info.plist */, @@ -183,7 +169,6 @@ 95559331269B094A000FD726 /* Models */, 95559338269B0AAA000FD726 /* Functions */, 9555933B269B0DF9000FD726 /* Resources */, - 95EA4F4026A0343B00AF89F6 /* Pad */, 95C5B22D2697752700941585 /* Preview Content */, ); path = Simoleon; @@ -224,27 +209,13 @@ name = Frameworks; sourceTree = "<group>"; }; - 95EA4F4026A0343B00AF89F6 /* Pad */ = { - isa = PBXGroup; - children = ( - 95EA4F4126A0346800AF89F6 /* SidebarNavigation.swift */, - 95EA4F4326A034CC00AF89F6 /* PrimaryView.swift */, - 95EA4F4526A034D800AF89F6 /* SupplementaryView.swift */, - 95EA4F4726A034E000AF89F6 /* SecondaryView.swift */, - ); - path = Pad; - sourceTree = "<group>"; - }; 95FE659A269AFB44008745DE /* Helpers */ = { isa = PBXGroup; children = ( - 95E137CE269C9D8B00D2C5DC /* CurrencyConversion.swift */, - 95E76433269DF63D008E9F31 /* SearchedCurrencyList.swift */, - 95FE659B269AFB54008745DE /* SearchBar.swift */, - 956C28CB269B58A0005A4595 /* FlagPair.swift */, - 95E137D0269C9F0D00D2C5DC /* SingleFlag.swift */, - 956C28C9269B5893005A4595 /* CurrencyRow.swift */, - 954DB2EA269F43C80069F317 /* Sidebar.swift */, + 95AEBC9626A043C100613729 /* SearchBar.swift */, + 95AEBC9C26A04D4600613729 /* CurrencyRow.swift */, + 95AEBC9E26A08A1C00613729 /* CurrencyConversion.swift */, + 95AEBCA726A0AE2400613729 /* Sidebar.swift */, ); path = Helpers; sourceTree = "<group>"; @@ -389,24 +360,17 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 95EA4F4626A034D800AF89F6 /* SupplementaryView.swift in Sources */, - 956C28CA269B5893005A4595 /* CurrencyRow.swift in Sources */, - 956C28CC269B58A0005A4595 /* FlagPair.swift in Sources */, - 9555933F269B0E47000FD726 /* CurrencyMetadataModel.swift in Sources */, 95C5B2312697752700941585 /* Persistence.swift in Sources */, + 95AEBC9F26A08A1C00613729 /* CurrencyConversion.swift in Sources */, + 95AEBC9526A03ECB00613729 /* ContentView.swift in Sources */, + 95AEBC9B26A04A4200613729 /* CurrencyMetadataModel.swift in Sources */, 9555933A269B0AB8000FD726 /* ParseJson.swift in Sources */, - 95E137CF269C9D8B00D2C5DC /* CurrencyConversion.swift in Sources */, - 95C5B22A2697752600941585 /* ContentView.swift in Sources */, - 95FE659C269AFB54008745DE /* SearchBar.swift in Sources */, - 95E137D1269C9F0D00D2C5DC /* SingleFlag.swift in Sources */, - 95559333269B0965000FD726 /* CurrencyQuoteModel.swift in Sources */, - 95EA4F4826A034E000AF89F6 /* SecondaryView.swift in Sources */, 95C5B2282697752600941585 /* SimoleonApp.swift in Sources */, - 95EA4F4426A034CC00AF89F6 /* PrimaryView.swift in Sources */, - 95EA4F4226A0346800AF89F6 /* SidebarNavigation.swift in Sources */, + 95AEBC9D26A04D4600613729 /* CurrencyRow.swift in Sources */, + 95AEBCA326A0900E00613729 /* CurrencyQuoteModel.swift in Sources */, + 95AEBCA826A0AE2400613729 /* Sidebar.swift in Sources */, 95C5B2342697752700941585 /* Simoleon.xcdatamodeld in Sources */, - 954DB2EB269F43C80069F317 /* Sidebar.swift in Sources */, - 95E76434269DF63D008E9F31 /* SearchedCurrencyList.swift in Sources */, + 95AEBC9726A043C100613729 /* SearchBar.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };
Binary file Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/Simoleon/Assets.xcassets/AccentColor.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Assets.xcassets/AccentColor.colorset/Contents.json Thu Jul 15 19:03:24 2021 +0100 @@ -1,15 +1,6 @@ { "colors" : [ { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.471", - "green" : "0.482", - "red" : "0.816" - } - }, "idiom" : "universal" }, { @@ -19,15 +10,6 @@ "value" : "dark" } ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.545", - "green" : "0.553", - "red" : "0.839" - } - }, "idiom" : "universal" } ],
--- a/Simoleon/Assets.xcassets/AppIcon.appiconset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Assets.xcassets/AppIcon.appiconset/Contents.json Thu Jul 15 19:03:24 2021 +0100 @@ -1,112 +1,172 @@ { "images" : [ { - "filename" : "icon_20pt@2x-1.png", + "filename" : "notification40.png", "idiom" : "iphone", "scale" : "2x", "size" : "20x20" }, { - "filename" : "icon_20pt@3x.png", + "filename" : "notification60.png", "idiom" : "iphone", "scale" : "3x", "size" : "20x20" }, { - "filename" : "icon_29pt@2x-1.png", + "filename" : "settings58.png", "idiom" : "iphone", "scale" : "2x", "size" : "29x29" }, { - "filename" : "icon_29pt@3x.png", + "filename" : "settings87.png", "idiom" : "iphone", "scale" : "3x", "size" : "29x29" }, { - "filename" : "icon_40pt@2x-1.png", + "filename" : "spotlight80.png", "idiom" : "iphone", "scale" : "2x", "size" : "40x40" }, { - "filename" : "icon_40pt@3x.png", + "filename" : "spotlight120.png", "idiom" : "iphone", "scale" : "3x", "size" : "40x40" }, { - "filename" : "icon_60pt@2x.png", + "filename" : "iphone120.png", "idiom" : "iphone", "scale" : "2x", "size" : "60x60" }, { - "filename" : "icon_60pt@3x.png", + "filename" : "iphone180.png", "idiom" : "iphone", "scale" : "3x", "size" : "60x60" }, { - "filename" : "icon_20pt.png", + "filename" : "ipadNotification20.png", "idiom" : "ipad", "scale" : "1x", "size" : "20x20" }, { - "filename" : "icon_20pt@2x.png", + "filename" : "ipadNotification40.png", "idiom" : "ipad", "scale" : "2x", "size" : "20x20" }, { - "filename" : "icon_29pt.png", + "filename" : "ipadSettings29.png", "idiom" : "ipad", "scale" : "1x", "size" : "29x29" }, { - "filename" : "icon_29pt@2x.png", + "filename" : "ipadSettings58.png", "idiom" : "ipad", "scale" : "2x", "size" : "29x29" }, { - "filename" : "icon_40pt.png", + "filename" : "ipadSpotlight40.png", "idiom" : "ipad", "scale" : "1x", "size" : "40x40" }, { - "filename" : "icon_40pt@2x.png", + "filename" : "ipadSpotlight80.png", "idiom" : "ipad", "scale" : "2x", "size" : "40x40" }, { - "filename" : "icon_76pt.png", + "filename" : "ipad76.png", "idiom" : "ipad", "scale" : "1x", "size" : "76x76" }, { - "filename" : "icon_76pt@2x.png", + "filename" : "ipad152.png", "idiom" : "ipad", "scale" : "2x", "size" : "76x76" }, { - "filename" : "icon_83.5@2x.png", + "filename" : "ipadPro167.png", "idiom" : "ipad", "scale" : "2x", "size" : "83.5x83.5" }, { - "filename" : "Icon.png", + "filename" : "appstore1024.png", "idiom" : "ios-marketing", "scale" : "1x", "size" : "1024x1024" + }, + { + "filename" : "mac16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "mac32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "mac32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "mac64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "mac128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "mac256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "mac256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "mac512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "mac512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "mac1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" } ], "info" : {
--- a/Simoleon/Assets.xcassets/Colours/Bone.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.694", - "green" : "0.808", - "red" : "0.804" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.757", - "green" : "0.847", - "red" : "0.847" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/Border.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.224", - "green" : "0.224", - "red" : "0.224" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.757", - "green" : "0.847", - "red" : "0.847" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/FlagBorder.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.224", - "green" : "0.224", - "red" : "0.224" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.098", - "green" : "0.098", - "red" : "0.098" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/LaunchBackground.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "1.000", - "green" : "1.000", - "red" : "1.000" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.000", - "green" : "0.000", - "red" : "0.000" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/Opal.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.808", - "green" : "0.804", - "red" : "0.694" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.847", - "green" : "0.847", - "red" : "0.757" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/Shadow.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.694", - "green" : "0.808", - "red" : "0.804" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "platform" : "ios", - "reference" : "secondarySystemBackgroundColor" - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/SilverPink.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.694", - "green" : "0.698", - "red" : "0.808" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.757", - "green" : "0.761", - "red" : "0.847" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/Colours/WildBlueYoder.colorset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.808", - "green" : "0.694", - "red" : "0.698" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0.847", - "green" : "0.757", - "red" : "0.761" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/Simoleon/Assets.xcassets/LaunchLogo.imageset/Contents.json Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Assets.xcassets/LaunchLogo.imageset/Contents.json Thu Jul 15 19:03:24 2021 +0100 @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "LaunchLogo.png", + "filename" : "icon.png", "idiom" : "universal" } ],
--- a/Simoleon/ContentView.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/ContentView.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,95 +2,63 @@ // ContentView.swift // Simoleon // -// Created by Dennis Concepción Martín on 08/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI -import Alamofire struct ContentView: View { - @State private var showingView = false - @State private var text = "" - @State private var isEditing = false - @State private var popularCurrencyPairsQuote = [CurrencyQuoteModel()] - @State private var popularSelectedCurrencyPairQuote: CurrencyQuoteModel? = nil - - let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") + @State var searchText = "" + @State var searching = false + @State private var refreshView = 0 + let currencyPairs: [String] = parseJson("CurrencyPairs.json") var body: some View { - NavigationView { - if showingView { - ScrollView(showsIndicators: false) { - VStack(spacing: 20) { - SearchBar(text: $text, isEditing: $isEditing) - .padding(.top) - - if text.isEmpty { - ForEach(popularCurrencyPairsQuote, id: \.self) { currencyQuote in - CurrencyRow(currencyQuote: currencyQuote) - .onTapGesture { self.popularSelectedCurrencyPairQuote = currencyQuote } - } - } else { - SearchedCurrencyList(text: $text) - } - } - .padding(.vertical) - .sheet(item: self.$popularSelectedCurrencyPairQuote) { currencyQuote in - CurrencyConversion(currencyQuote: currencyQuote) - } + VStack { + SearchBar(searchText: $searchText, searching: $searching) + List(filterCurrencies(), id: \.self) { currency in + NavigationLink(destination: CurrencyConversion(currency: currency)) { + CurrencyRow(currency: currency) + .padding(.vertical, 7) } - .navigationTitle("Currencies") - .toolbar { - ToolbarItem(placement: .cancellationAction) { - if isEditing { - Button("Cancel", action: { - text = "" - isEditing = false - UIApplication.shared.dismissKeyboard() - }) - } - } - } - } else { - ProgressView() - .onAppear(perform: requestCurrencyPairsQuote) } + .id(UUID()) + .listStyle(InsetListStyle()) + .gesture(DragGesture() + .onChanged({ _ in + UIApplication.shared.dismissKeyboard() + }) + ) + } + .navigationTitle(searching ? "Search" : "Popular currencies") + .toolbar { + if searching { + Button("Cancel") { searchText = "" + withAnimation { + searching = false + UIApplication.shared.dismissKeyboard() + } + } + } } } - /* - Request API - */ - private func requestCurrencyPairsQuote() { - let popularCurrencyPairsArray: [String] = parseJson("PopularCurrencyPairs.json") - let popularCurrencyPairsString = popularCurrencyPairsArray.joined(separator: ",") - let quotes = popularCurrencyPairsString.replacingOccurrences(of: "/", with: "-") - let url = "https://api.simoleon.app/quotes=\(quotes)" - - // Request popular currencies - AF.request(url).responseDecodable(of: [CurrencyQuoteModel].self) { response in - if let currencyPairsQuote = response.value { - self.popularCurrencyPairsQuote = currencyPairsQuote - self.showingView = true - } else { - // Handle error - } + private func filterCurrencies() -> [String] { + if searchText.isEmpty { + return currencyPairs + } else { + return currencyPairs.filter { $0.contains(searchText.uppercased()) } } } } -/* - Dismiss keyboard on cancel textfield - */ extension UIApplication { - func dismissKeyboard() { - sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) + func dismissKeyboard() { + sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) + } } -} - struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() - .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } }
--- a/Simoleon/Helpers/CurrencyConversion.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Helpers/CurrencyConversion.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,88 +2,120 @@ // CurrencyConversion.swift // Simoleon // -// Created by Dennis Concepción Martín on 12/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI +import Alamofire struct CurrencyConversion: View { - var currencyQuote: CurrencyQuoteModel - let currenciesMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") - @State private var inputAmount: String = "100" - @Environment(\.presentationMode) private var currencyConversionPresentation + var currency: String + @State private var price: Float = 1 + @State private var amountToConvert = "100" + @State private var isEditing = false + let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") var body: some View { - NavigationView { - ScrollView(showsIndicators: false) { - VStack(spacing: 20) { - let symbols = currencyQuote.symbol!.split(separator: "/") + let currencies = currency.components(separatedBy: "/") + let mainCurrency = String(currencies[0]) + let secondaryCurrency = String(currencies[1]) + + ScrollView(showsIndicators: false) { + VStack(spacing: 20) { + ZStack { + Rectangle() + .foregroundColor(Color(.secondarySystemBackground)) - // MARK: - First currency row - RoundedRectangle(cornerRadius: 10) - .rectangleModifier(Color(.systemBackground), 65) - .overlay( - HStack { - SingleFlag(flag: currenciesMetadata[String(symbols[0])]!.flag) - Text(String(symbols[0])) - .fontWeight(.semibold) - .padding(.leading) - - TextField("Amount", text: $inputAmount) - .keyboardType(.decimalPad) - .padding(.leading) + HStack { + Image(currencyMetadata[mainCurrency]!.flag) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 30, height: 30) + .clipShape(Circle()) + .overlay(Circle().stroke(Color(.systemGray), lineWidth: 1)) + + TextField("Amount", text: $amountToConvert) { startedEditing in + if startedEditing { + withAnimation { + isEditing = true + } } - .padding(.horizontal) - ) + } + onCommit: { + withAnimation { + isEditing = false + } + } + .padding(.horizontal) + + Text("\(mainCurrency)") + .fontWeight(.semibold) + } + .padding(.horizontal) + } + .frame(height: 50) + .cornerRadius(13) - // MARK: - Second currency row - RoundedRectangle(cornerRadius: 10) - .rectangleModifier(Color(.systemBackground), 65) - .overlay( - HStack { - SingleFlag(flag: currenciesMetadata[String(symbols[1])]!.flag) - Text(String(symbols[1])) - .fontWeight(.semibold) - .padding(.leading) - - Text("\(makeConversion(inputAmount), specifier: "%.2f")") - .padding(.leading) - Spacer() - } + ZStack { + Rectangle() + .foregroundColor(Color(.secondarySystemBackground)) + + HStack { + Image(currencyMetadata[secondaryCurrency]!.flag) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 30, height: 30) + .clipShape(Circle()) + .overlay(Circle().stroke(Color(.systemGray), lineWidth: 1)) + + Text("\(makeConversion(), specifier: "%.2f")") .padding(.horizontal) - ) - + + Spacer() + Text("\(secondaryCurrency)") + .fontWeight(.semibold) + } + .padding(.horizontal) } - .padding() + .frame(height: 50) + .cornerRadius(13) + + Text("From \(currencyMetadata[secondaryCurrency]!.name) to \(currencyMetadata[mainCurrency]!.name) at \(price, specifier: "%.2f") exchange rate.") + .multilineTextAlignment(.center) + } - .padding(.top) - .navigationTitle("Conversion") - .toolbar { - ToolbarItem(placement: .cancellationAction) { - Button("Cancel", action: { currencyConversionPresentation.wrappedValue.dismiss() }) - } - } + .padding() + } + .onAppear { requestApi(mainCurrency, secondaryCurrency) } + .navigationTitle("Conversion") + } + + private func makeConversion() -> Float { + if amountToConvert.isEmpty { /// Avoid nil error when string is empty + return 0 + } else { + let conversion = Float(amountToConvert)! * price + + return conversion } } - /* - Make currency conversion - */ - private func makeConversion(_ inputAmount: String) -> Float { - if inputAmount.isEmpty { /// Avoid nil error when string is empty - return 0 - } else { - let conversion = Float(inputAmount)! * currencyQuote.price! - - return conversion + private func requestApi(_ mainCurrency: String, _ secondaryCurrency: String) { + let url = "https://api.simoleon.app/quotes=\(mainCurrency)-\(secondaryCurrency)" + AF.request(url).responseDecodable(of: [CurrencyQuoteModel].self) { response in + if let price = response.value![0].price { + self.price = price + } else { +// Handle error + } } } } struct CurrencyConversion_Previews: PreviewProvider { static var previews: some View { - let currencyQuote: CurrencyQuoteModel = parseJson("CurrencyQuoteData.json") - - CurrencyConversion(currencyQuote: currencyQuote) + NavigationView { + CurrencyConversion(currency: "USD/GBP") + } } }
--- a/Simoleon/Helpers/CurrencyRow.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Helpers/CurrencyRow.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,100 +2,53 @@ // CurrencyRow.swift // Simoleon // -// Created by Dennis Concepción Martín on 11/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI struct CurrencyRow: View { - var currencyQuote: CurrencyQuoteModel - let currenciesMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") + let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") + var currency: String var body: some View { - RoundedRectangle(cornerRadius: 10) - .rectangleModifier(Color(.systemBackground), 80) - .overlay( - HStack { - let symbols = currencyQuote.symbol!.split(separator: "/") - let mainCurrencyFlag = currenciesMetadata[String(symbols[0])]!.flag - let secondaryCurrencyFlag = currenciesMetadata[String(symbols[1])]!.flag - - FlagPair(mainCurrencyFlag: mainCurrencyFlag, secondaryCurrencyFlag: secondaryCurrencyFlag) - - VStack(alignment: .leading) { - Text("\(String(symbols[0]))") - .fontWeight(.semibold) - - Text("\(String(symbols[1]))") - .fontWeight(.semibold) - } - .padding(.horizontal) - - VStack(alignment: .leading) { - Text("Bid") - let bid = currencyQuote.bid! - Text("\(bid, specifier: createSpecifier(bid))") - .fontWeight(.semibold) - .lineLimit(1) - - } - .padding(.trailing) - - VStack(alignment: .leading) { - Text("Ask") - let ask = currencyQuote.ask! - Text("\(ask, specifier: createSpecifier(ask))") - .fontWeight(.semibold) - .lineLimit(1) - - } - - Spacer() - - } - .padding(.horizontal) - ) + let currencies = currency.components(separatedBy: "/") + let mainCurrency = String(currencies[0]) + let secondaryCurrency = String(currencies[1]) + HStack { + Image(currencyMetadata[mainCurrency]!.flag) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 30, height: 30) + .clipShape(Circle()) + .overlay(Circle().stroke(Color(.systemGray), lineWidth: 1)) + + Image(currencyMetadata[secondaryCurrency]!.flag) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 30, height: 30) + .clipShape(Circle()) + .overlay(Circle().stroke(Color(.systemGray), lineWidth: 1)) + .offset(x: -20) + .padding(.trailing, -20) + + VStack(alignment: .leading) { + Text("\(currency)") + .fontWeight(.semibold) + + Text("\(currencyMetadata[mainCurrency]!.name)/\(currencyMetadata[secondaryCurrency]!.name)") + .font(.footnote) + .fontWeight(.semibold) + .opacity(0.5) + .lineLimit(1) + } .padding(.horizontal) - } - - /* - Choose how many decimals depending on whether the price is hundreds, thousands, etc - */ - - private func createSpecifier(_ amount: Float) -> String { - if amount >= 10 { - return "%.2f" - } else { - return "%.4f" } } - - /* - Convert unix time into human readable - */ - private func convertUnixTime(_ timestamp: Int) -> String { - let now = Date() - let convertedDate = Date(timeIntervalSince1970: TimeInterval(timestamp)) - let formatter = DateComponentsFormatter() - formatter.unitsStyle = .abbreviated - - return formatter.string(from: convertedDate, to: now)! - } -} -extension RoundedRectangle { - func rectangleModifier(_ colour: Color, _ height: CGFloat) -> some View { - self - .strokeBorder(Color("Border"), lineWidth: 2) - .background(RoundedRectangle(cornerRadius: 10).foregroundColor(colour)) - .frame(height: height) - - } } struct CurrencyRow_Previews: PreviewProvider { static var previews: some View { - let currencyQuote: CurrencyQuoteModel = parseJson("CurrencyQuoteData.json") - - CurrencyRow(currencyQuote: currencyQuote) + CurrencyRow(currency: "USD/GBP") } }
--- a/Simoleon/Helpers/FlagPair.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -// -// FlagPair.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 11/07/2021. -// - -import SwiftUI - -struct FlagPair: View { - var mainCurrencyFlag: String - var secondaryCurrencyFlag: String - - var body: some View { - VStack { - Image(secondaryCurrencyFlag) - .flagModifier(40) - - Image(mainCurrencyFlag) - .flagModifier(40) - .offset(x: 20, y: -40) - .padding(.bottom, -40) - - - } - .padding(.trailing, 20) - } -} -extension Image { - func flagModifier(_ size: CGFloat) -> some View { - self - .resizable() - .aspectRatio(contentMode: .fill) - .clipShape(Circle()) - .overlay(Circle().stroke(Color("FlagBorder"), lineWidth: 2)) - .frame(width: size, height: size) - } -} - -struct SmallFlagsPair_Previews: PreviewProvider { - static var previews: some View { - FlagPair(mainCurrencyFlag: "GB", secondaryCurrencyFlag: "US") - } -}
--- a/Simoleon/Helpers/SearchBar.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Helpers/SearchBar.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,56 +2,46 @@ // SearchBar.swift // Simoleon // -// Created by Dennis Concepción Martín on 11/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI struct SearchBar: View { - @Binding var text: String - @Binding var isEditing: Bool + @Binding var searchText: String + @Binding var searching: Bool var body: some View { - VStack { - Capsule() - .capsuleModifier(Color("Shadow")) - - Capsule() - .capsuleModifier(Color(.systemBackground)) - .overlay( - ZStack(alignment: .leading) { - TextField("Search", text: $text) - .padding(.leading, 55) - .padding(.trailing) - .padding(.vertical, 25) /// Expand tapable area - .onTapGesture { isEditing = true } - .contentShape(Capsule()) - - Image(systemName: "magnifyingglass.circle") - .imageScale(.large) - .opacity(0.3) - .padding(.leading) + ZStack { + Rectangle() + .foregroundColor(Color(.secondarySystemBackground)) + + HStack { + Image(systemName: "magnifyingglass") + TextField("Search ..", text: $searchText) { startedEditing in + if startedEditing { + withAnimation { + searching = true + } } - ) - .offset(x: -4, y: -65) - .padding(.bottom, -65) - } - .padding(.leading, 4) - .padding(.horizontal) - - } -} -extension Capsule { - func capsuleModifier(_ colour: Color) -> some View { - self - .strokeBorder(Color("Border"), lineWidth: 2) - .background(Capsule().foregroundColor(colour)) - .frame(height: 50) + } + onCommit: { + withAnimation { + searching = false + } + } + } + .padding(.leading, 13) + + } + .frame(height: 40) + .cornerRadius(13) + .padding() } } struct SearchBar_Previews: PreviewProvider { static var previews: some View { - SearchBar(text: .constant(""), isEditing: .constant(false)) + SearchBar(searchText: .constant(""), searching: .constant(false)) } }
--- a/Simoleon/Helpers/SearchedCurrencyList.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -// -// SearchedCurrencyList.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 13/07/2021. -// - -import SwiftUI -import Alamofire - -struct SearchedCurrencyList: View { - @Binding var text: String - @State private var showingView = false - @State private var searchedCurrencyPairsQuote = [CurrencyQuoteModel()] - @State private var searchedSelectedCurrencyPairQuote: CurrencyQuoteModel? = nil - - let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") - - var body: some View { - LazyVStack(spacing: 20) { - if showingView { - ForEach(searchedCurrencyPairsQuote, id: \.self) { currencyQuote in - CurrencyRow(currencyQuote: currencyQuote) - .onTapGesture { self.searchedSelectedCurrencyPairQuote = currencyQuote } - } - } - } - .onAppear(perform: requestCurrencyPairsQuote) - .onChange(of: text, perform: { _ in - requestCurrencyPairsQuote() - }) - .sheet(item: self.$searchedSelectedCurrencyPairQuote) { currencyQuote in - CurrencyConversion(currencyQuote: currencyQuote) - } - } - - /* - Request API - */ - private func requestCurrencyPairsQuote() { - if !text.isEmpty { - let searchedCurrencyPairsArray: [String] = parseJson("CurrencyPairs.json") - let filteredSearchedCurrencyPairsArray = searchedCurrencyPairsArray.filter { $0.contains(text.uppercased()) } - - if filteredSearchedCurrencyPairsArray.count <= 327 { - let searchedCurrencyPairsString = filteredSearchedCurrencyPairsArray.joined(separator: ",") - let quotes = searchedCurrencyPairsString.replacingOccurrences(of: "/", with: "-") - let url = "https://api.simoleon.app/quotes=\(quotes)" - - // Request popular currencies - AF.request(url).responseDecodable(of: [CurrencyQuoteModel].self) { response in - if let searchedCurrencyPairsQuote = response.value { - self.searchedCurrencyPairsQuote = searchedCurrencyPairsQuote - self.showingView = true - } else { - // Handle error - } - } - } - } - } -} - -struct SearchedCurrencyList_Previews: PreviewProvider { - static var previews: some View { - SearchedCurrencyList(text: .constant("USD/")) - } -}
--- a/Simoleon/Helpers/Sidebar.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Helpers/Sidebar.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,26 +2,25 @@ // Sidebar.swift // Simoleon // -// Created by Dennis Concepción Martín on 14/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI struct Sidebar: View { - @Binding var selectedView: String? - var body: some View { List { - NavigationLink(destination: ContentView(), tag: "Currencies", selection: $selectedView) { - Text("Currencies") + NavigationLink(destination: ContentView()) { + Text("Popular currencies") } } .listStyle(SidebarListStyle()) + .navigationBarTitle("Categories") } } struct Sidebar_Previews: PreviewProvider { static var previews: some View { - Sidebar(selectedView: .constant("")) + Sidebar() } }
--- a/Simoleon/Helpers/SingleFlag.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// -// SingleFlag.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 12/07/2021. -// - -import SwiftUI - -struct SingleFlag: View { - var flag: String - - var body: some View { - Image(flag) - .flagModifier(40) - } -} - -struct SingleFlag_Previews: PreviewProvider { - static var previews: some View { - SingleFlag(flag: "EU") - } -}
--- a/Simoleon/LaunchScreen.storyboard Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/LaunchScreen.storyboard Thu Jul 15 19:03:24 2021 +0100 @@ -17,7 +17,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="LaunchLogo" translatesAutoresizingMaskIntoConstraints="NO" id="Gb6-EW-6id"> - <rect key="frame" x="76" y="378" width="263" height="140"/> + <rect key="frame" x="102" y="392" width="210" height="112"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> </imageView> </subviews> @@ -31,7 +31,7 @@ </scene> </scenes> <resources> - <image name="LaunchLogo" width="500" height="500"/> + <image name="LaunchLogo" width="1024" height="1024"/> <namedColor name="LaunchBackground"> <color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </namedColor>
--- a/Simoleon/Models/CurrencyMetadataModel.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Models/CurrencyMetadataModel.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,7 +2,7 @@ // CurrencyMetadataModel.swift // Simoleon // -// Created by Dennis Concepción Martín on 11/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI
--- a/Simoleon/Models/CurrencyQuoteModel.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/Models/CurrencyQuoteModel.swift Thu Jul 15 19:03:24 2021 +0100 @@ -2,13 +2,12 @@ // CurrencyQuoteModel.swift // Simoleon // -// Created by Dennis Concepción Martín on 11/07/2021. +// Created by Dennis Concepción Martín on 15/07/2021. // import SwiftUI struct CurrencyQuoteModel: Codable, Hashable { - var id: UUID? var symbol: String? var price: Float? var bid: Float? @@ -23,4 +22,3 @@ case timeStamp = "t" } } -extension CurrencyQuoteModel: Identifiable {}
--- a/Simoleon/Pad/PrimaryView.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -// -// PrimaryView.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 15/07/2021. -// - -import SwiftUI - -struct PrimaryView: View { - @State var popularCurrencyPairsQuote: [CurrencyQuoteModel] - - var body: some View { - List { - NavigationLink(destination: SupplementaryView(popularCurrencyPairsQuote: $popularCurrencyPairsQuote)) { - Text("Currencies") - } - } - .listStyle(SidebarListStyle()) - .navigationBarTitle("Categories") - } -} - -struct PrimaryView_Previews: PreviewProvider { - static var previews: some View { - PrimaryView(popularCurrencyPairsQuote: [CurrencyQuoteModel()]) - } -}
--- a/Simoleon/Pad/SecondaryView.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// -// SecondaryView.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 15/07/2021. -// - -import SwiftUI - -struct SecondaryView: View { - var currencyQuote: CurrencyQuoteModel - let currenciesMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") - @State private var inputAmount: String = "100" - - var body: some View { - if let symbol = currencyQuote.symbol { - ScrollView(showsIndicators: false) { - VStack(spacing: 20) { - let symbols = symbol.split(separator: "/") - - // MARK: - First currency row - RoundedRectangle(cornerRadius: 10) - .rectangleModifier(Color(.systemBackground), 65) - .overlay( - HStack { - SingleFlag(flag: currenciesMetadata[String(symbols[0])]!.flag) - Text(String(symbols[0])) - .fontWeight(.semibold) - .padding(.leading) - - TextField("Amount", text: $inputAmount) - .keyboardType(.decimalPad) - .padding(.leading) - } - .padding(.horizontal) - ) - - // MARK: - Second currency row - RoundedRectangle(cornerRadius: 10) - .rectangleModifier(Color(.systemBackground), 65) - .overlay( - HStack { - SingleFlag(flag: currenciesMetadata[String(symbols[1])]!.flag) - Text(String(symbols[1])) - .fontWeight(.semibold) - .padding(.leading) - - Text("\(makeConversion(inputAmount), specifier: "%.2f")") - .padding(.leading) - Spacer() - } - .padding(.horizontal) - ) - - } - .padding() - } - .padding(.top) - .navigationTitle("Conversion") - } - } - - /* - Make currency conversion - */ - private func makeConversion(_ inputAmount: String) -> Float { - if inputAmount.isEmpty { /// Avoid nil error when string is empty - return 0 - } else { - let conversion = Float(inputAmount)! * currencyQuote.price! - - return conversion - } - } -} - -struct SecondaryView_Previews: PreviewProvider { - static var previews: some View { - SecondaryView(currencyQuote: CurrencyQuoteModel()) - } -}
--- a/Simoleon/Pad/SidebarNavigation.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// -// SidebarNavigation.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 15/07/2021. -// - -import SwiftUI - -struct SidebarNavigation: View { - @State var popularCurrencyPairsQuote = [CurrencyQuoteModel()] - - var body: some View { - NavigationView { - PrimaryView(popularCurrencyPairsQuote: popularCurrencyPairsQuote) - SupplementaryView(popularCurrencyPairsQuote: $popularCurrencyPairsQuote) - SecondaryView(currencyQuote: popularCurrencyPairsQuote[0]) - } - } -} - -struct SidebarNavigation_Previews: PreviewProvider { - static var previews: some View { - SidebarNavigation() - } -}
--- a/Simoleon/Pad/SupplementaryView.swift Thu Jul 15 10:58:29 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -// -// SupplementaryView.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 15/07/2021. -// - -import SwiftUI -import Alamofire - -struct SupplementaryView: View { - @Binding var popularCurrencyPairsQuote: [CurrencyQuoteModel] - - @State private var showingView = false - @State private var text = "" - @State private var isEditing = false - - let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") - - var body: some View { - if showingView { - ScrollView(showsIndicators: false) { - VStack(spacing: 20) { - SearchBar(text: $text, isEditing: $isEditing) - .padding(.top) - - if text.isEmpty { - ForEach(popularCurrencyPairsQuote, id: \.self) { currencyQuote in - NavigationLink(destination: SecondaryView(currencyQuote: currencyQuote)) { - CurrencyRow(currencyQuote: currencyQuote) - } - .buttonStyle(PlainButtonStyle()) - } - } else { - SearchedCurrencyList(text: $text) - } - } - .padding(.vertical) - } - .navigationTitle("Currencies") - .toolbar { - ToolbarItem(placement: .cancellationAction) { - if isEditing { - Button("Cancel", action: { - text = "" - isEditing = false - UIApplication.shared.dismissKeyboard() - }) - } - } - } - } else { - ProgressView() - .onAppear(perform: requestCurrencyPairsQuote) - } - } - - /* - Request API - */ - private func requestCurrencyPairsQuote() { - let popularCurrencyPairsArray: [String] = parseJson("PopularCurrencyPairs.json") - let popularCurrencyPairsString = popularCurrencyPairsArray.joined(separator: ",") - let quotes = popularCurrencyPairsString.replacingOccurrences(of: "/", with: "-") - let url = "https://api.simoleon.app/quotes=\(quotes)" - - // Request popular currencies - AF.request(url).responseDecodable(of: [CurrencyQuoteModel].self) { response in - if let currencyPairsQuote = response.value { - self.popularCurrencyPairsQuote = currencyPairsQuote - self.showingView = true - } else { - // Handle error - } - } - } -} - - -struct SupplementaryView_Previews: PreviewProvider { - static var previews: some View { - SupplementaryView(popularCurrencyPairsQuote: .constant([CurrencyQuoteModel()])) - } -}
--- a/Simoleon/SimoleonApp.swift Thu Jul 15 10:58:29 2021 +0100 +++ b/Simoleon/SimoleonApp.swift Thu Jul 15 19:03:24 2021 +0100 @@ -14,10 +14,16 @@ var body: some Scene { WindowGroup { if UIDevice.current.userInterfaceIdiom == .pad { - SidebarNavigation() + NavigationView { + Sidebar() + ContentView() + CurrencyConversion(currency: "EUR/USD") + } } else { - ContentView() - .environment(\.managedObjectContext, persistenceController.container.viewContext) + NavigationView { + ContentView() + .environment(\.managedObjectContext, persistenceController.container.viewContext) + } } } }