Mercurial > public > lazybear
changeset 70:d1b383fe1bc5
Start new branch with the new design
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 22 Jan 2021 13:55:59 +0100 |
parents | 6580039212af |
children | 460e29c9fe6f |
files | LazyBear.xcodeproj/project.pbxproj LazyBear.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate README.md lazybear/About.swift lazybear/Assets.xcassets/CompaniesLogos/Contents.json lazybear/Assets.xcassets/CompaniesLogos/aapl.imageset/AppleLogo.png lazybear/Assets.xcassets/CompaniesLogos/aapl.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/adbe.imageset/Adobe.png lazybear/Assets.xcassets/CompaniesLogos/adbe.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/amj.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/amj.imageset/JP.png lazybear/Assets.xcassets/CompaniesLogos/amzn.imageset/AmazonLogo.png lazybear/Assets.xcassets/CompaniesLogos/amzn.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/bac.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/bac.imageset/bac.png lazybear/Assets.xcassets/CompaniesLogos/brk.b.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/brk.b.imageset/brk.b.png lazybear/Assets.xcassets/CompaniesLogos/crm.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/crm.imageset/Salesforce.png lazybear/Assets.xcassets/CompaniesLogos/dis.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/dis.imageset/dis.png lazybear/Assets.xcassets/CompaniesLogos/fb.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/fb.imageset/facebook.png lazybear/Assets.xcassets/CompaniesLogos/googl.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/googl.imageset/GoogleLogo.png lazybear/Assets.xcassets/CompaniesLogos/intc.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/intc.imageset/intc.png lazybear/Assets.xcassets/CompaniesLogos/nflx.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/nflx.imageset/Netflix.png lazybear/Assets.xcassets/CompaniesLogos/pfe.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/pfe.imageset/pfe.png lazybear/Assets.xcassets/CompaniesLogos/pypl.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/pypl.imageset/Paypal.png lazybear/Assets.xcassets/CompaniesLogos/tsla.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/tsla.imageset/tesla.png lazybear/Assets.xcassets/CompaniesLogos/v.imageset/Contents.json lazybear/Assets.xcassets/CompaniesLogos/v.imageset/v.png lazybear/Assets.xcassets/Custom Colors/AccentColor.colorset/Contents.json lazybear/Assets.xcassets/launchLogo.imageset/Contents.json lazybear/Assets.xcassets/launchLogo.imageset/launchLogo.png lazybear/Assets.xcassets/launchLogo.imageset/white.png lazybear/Company.swift lazybear/ContentView.swift lazybear/Functions/LazyColumns.swift lazybear/Functions/RandomColor.swift lazybear/Info.plist lazybear/Insiders.swift lazybear/LazyBearApp.swift lazybear/Main.swift lazybear/Models/ShowingCompany.swift lazybear/Stock.swift lazybear/Supply views/AboutButton.swift lazybear/Supply views/AddWatchlist.swift lazybear/Supply views/AppInfo.swift lazybear/Supply views/Companies.swift lazybear/Supply views/Company.swift lazybear/Supply views/CompanyHeader.swift lazybear/Supply views/CompanyList.swift lazybear/Supply views/CompanyRow.swift lazybear/Supply views/DateSelection.swift lazybear/Supply views/FavCompanies.swift lazybear/Supply views/FavCompanyList.swift lazybear/Supply views/FavCompanyRow.swift lazybear/Supply views/HeaderWatchList.swift lazybear/Supply views/InsiderCharts.swift lazybear/Supply views/InsiderDetail.swift lazybear/Supply views/Insiders.swift lazybear/Supply views/PieChart.swift lazybear/Supply views/Price.swift lazybear/Supply views/PriceOverview.swift lazybear/Supply views/SearchBar.swift lazybear/Supply views/Selection.swift lazybear/Supply views/StockCharts.swift lazybear/Supply views/StockStats.swift lazybear/Supply views/TransactionList.swift lazybear/Supply views/TransactionRow.swift lazybear/Supply views/WhatsNew.swift lazybear/User.swift |
diffstat | 79 files changed, 444 insertions(+), 1969 deletions(-) [+] |
line wrap: on
line diff
--- a/LazyBear.xcodeproj/project.pbxproj Wed Jan 20 18:41:15 2021 +0100 +++ b/LazyBear.xcodeproj/project.pbxproj Fri Jan 22 13:55:59 2021 +0100 @@ -9,49 +9,37 @@ /* Begin PBXBuildFile section */ 95002580256D17D9008FFD28 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9500257F256D17D9008FFD28 /* StoreKit.framework */; }; 950B79F625B1CB7A00E5DB5B /* CompanyList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950B79F525B1CB7A00E5DB5B /* CompanyList.swift */; }; - 950B79F925B1CEA100E5DB5B /* PriceOverview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950B79F825B1CEA100E5DB5B /* PriceOverview.swift */; }; - 950B79FC25B1CFD400E5DB5B /* StockCharts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950B79FB25B1CFD400E5DB5B /* StockCharts.swift */; }; - 950B79FF25B1E68D00E5DB5B /* InsiderCharts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950B79FE25B1E68D00E5DB5B /* InsiderCharts.swift */; }; - 950B7A0425B1E7E100E5DB5B /* TransactionList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950B7A0325B1E7E100E5DB5B /* TransactionList.swift */; }; - 9521A8BD259B93200000D417 /* Company.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9521A8BC259B93200000D417 /* Company.swift */; }; 954D992225A2105F001F7F60 /* companies.json in Resources */ = {isa = PBXBuildFile; fileRef = 954D992125A2105F001F7F60 /* companies.json */; }; 954D992525A2123B001F7F60 /* HistoricalPricesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D992425A2123B001F7F60 /* HistoricalPricesModel.swift */; }; 954D996D25A2461B001F7F60 /* SwiftUICharts in Frameworks */ = {isa = PBXBuildFile; productRef = 954D996C25A2461B001F7F60 /* SwiftUICharts */; }; 954D997125A253A9001F7F60 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D997025A253A9001F7F60 /* Config.swift */; }; 954D998325A27571001F7F60 /* HistoricalPrices.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D998225A27571001F7F60 /* HistoricalPrices.swift */; }; 9552A61F25B06580001CD0C8 /* SampleConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9552A61E25B0657F001CD0C8 /* SampleConfig.swift */; }; - 95612C472598D17F00F7698F /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95612C462598D17F00F7698F /* User.swift */; }; - 95612C4A2598D1F800F7698F /* About.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95612C492598D1F800F7698F /* About.swift */; }; - 95612C502598D48200F7698F /* Companies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95612C4E2598D48200F7698F /* Companies.swift */; }; 95612C512598D48200F7698F /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95612C4F2598D48200F7698F /* SearchBar.swift */; }; - 956AACC7259CA8EF00CB9F16 /* Selection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956AACC6259CA8EF00CB9F16 /* Selection.swift */; }; 956FAF7B25AF421E0002B2C1 /* FavCompany+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956FAF7925AF421E0002B2C1 /* FavCompany+CoreDataClass.swift */; }; 956FAF7C25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956FAF7A25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift */; }; - 958DF3D825A08F4E00D10D22 /* Stock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958DF3D725A08F4E00D10D22 /* Stock.swift */; }; - 958DF3DB25A08F8600D10D22 /* Insiders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958DF3DA25A08F8600D10D22 /* Insiders.swift */; }; - 958E472B25B1CA8B0048E770 /* FavCompanies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958E472A25B1CA8B0048E770 /* FavCompanies.swift */; }; - 959B940925B5F4BC00EEB802 /* LazyColumns.swift in Sources */ = {isa = PBXBuildFile; fileRef = 959B940825B5F4BC00EEB802 /* LazyColumns.swift */; }; - 959B940C25B6058E00EEB802 /* StockStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 959B940B25B6058E00EEB802 /* StockStats.swift */; }; - 95A06A0125B8432200866C00 /* PieChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A06A0025B8432200866C00 /* PieChart.swift */; }; - 95A06A0525B84CA900866C00 /* InsiderDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A06A0425B84CA900866C00 /* InsiderDetail.swift */; }; + 958E472B25B1CA8B0048E770 /* FavCompanyList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958E472A25B1CA8B0048E770 /* FavCompanyList.swift */; }; 95A1ECAF25A36127001D4A21 /* InsiderTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A1ECAE25A36127001D4A21 /* InsiderTransaction.swift */; }; 95A1ECB225A36230001D4A21 /* InsiderTransactionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A1ECB125A36230001D4A21 /* InsiderTransactionModel.swift */; }; - 95A1ECC525A37541001D4A21 /* TransactionRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A1ECC425A37541001D4A21 /* TransactionRow.swift */; }; - 95A8103825AF476F000FD1D6 /* FavCompanyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A8103725AF476F000FD1D6 /* FavCompanyRow.swift */; }; 95AB4A7A259DCBAE0064C9C1 /* ReadJson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AB4A79259DCBAE0064C9C1 /* ReadJson.swift */; }; 95AB4A7D259DCC0C0064C9C1 /* CompanyDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AB4A7C259DCC0C0064C9C1 /* CompanyDataModel.swift */; }; 95AB4A90259DD66D0064C9C1 /* CompanyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AB4A8F259DD66D0064C9C1 /* CompanyRow.swift */; }; 95B04EB325212369000AD27F /* LazyBearApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B04EB225212369000AD27F /* LazyBearApp.swift */; }; 95B04EB525212369000AD27F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B04EB425212369000AD27F /* ContentView.swift */; }; 95B04EB72521236A000AD27F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95B04EB62521236A000AD27F /* Assets.xcassets */; }; - 95D0013225B0CFAB007D45FD /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = 95D0013125B0CFAB007D45FD /* Charts */; }; 95D1BF4925ADCF7700E5D063 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95D1BF4825ADCF7700E5D063 /* Persistence.swift */; }; - 95D1BF4C25ADD08500E5D063 /* Main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95D1BF4B25ADD08500E5D063 /* Main.swift */; }; - 95DF5194259DDC45003790B2 /* AboutButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DF5193259DDC45003790B2 /* AboutButton.swift */; }; - 95DF5197259DDD68003790B2 /* AppInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DF5196259DDD68003790B2 /* AppInfo.swift */; }; - 95DF519A259DE0E2003790B2 /* WhatsNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DF5199259DE0E2003790B2 /* WhatsNew.swift */; }; 95E0287825B88F0B00020CF2 /* formDescription.json in Resources */ = {isa = PBXBuildFile; fileRef = 95E0287725B88F0B00020CF2 /* formDescription.json */; }; 95E0287B25B88F3C00020CF2 /* FormDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E0287A25B88F3C00020CF2 /* FormDescription.swift */; }; + 95F6C2DD25BAD394003CF389 /* FavCompanyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2DC25BAD394003CF389 /* FavCompanyRow.swift */; }; + 95F6C2E425BAD529003CF389 /* RandomColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2E325BAD529003CF389 /* RandomColor.swift */; }; + 95F6C2F025BAE2ED003CF389 /* Company.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2EF25BAE2ED003CF389 /* Company.swift */; }; + 95F6C2F325BAE3D1003CF389 /* Price.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2F225BAE3D1003CF389 /* Price.swift */; }; + 95F6C2FE25BAEBBD003CF389 /* HeaderWatchList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2FD25BAEBBD003CF389 /* HeaderWatchList.swift */; }; + 95F6C30125BAEC8B003CF389 /* ShowingCompany.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C30025BAEC8B003CF389 /* ShowingCompany.swift */; }; + 95F6C30525BAF599003CF389 /* CompanyHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C30425BAF599003CF389 /* CompanyHeader.swift */; }; + 95F6C30925BAF7C2003CF389 /* DateSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C30825BAF7C2003CF389 /* DateSelection.swift */; }; + 95F6C30C25BAFDF5003CF389 /* Insiders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C30B25BAFDF5003CF389 /* Insiders.swift */; }; + 95F6C31125BAFFB8003CF389 /* AddWatchlist.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C31025BAFFB8003CF389 /* AddWatchlist.swift */; }; 95F7CAF625ADC7B7009E0E7C /* LazyBear.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 95F7CAF425ADC7B7009E0E7C /* LazyBear.xcdatamodeld */; }; /* End PBXBuildFile section */ @@ -59,34 +47,17 @@ 95002578256D1564008FFD28 /* Configuration.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Configuration.storekit; sourceTree = "<group>"; }; 9500257F256D17D9008FFD28 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; 950B79F525B1CB7A00E5DB5B /* CompanyList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanyList.swift; sourceTree = "<group>"; }; - 950B79F825B1CEA100E5DB5B /* PriceOverview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriceOverview.swift; sourceTree = "<group>"; }; - 950B79FB25B1CFD400E5DB5B /* StockCharts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StockCharts.swift; sourceTree = "<group>"; }; - 950B79FE25B1E68D00E5DB5B /* InsiderCharts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderCharts.swift; sourceTree = "<group>"; }; - 950B7A0325B1E7E100E5DB5B /* TransactionList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionList.swift; sourceTree = "<group>"; }; - 9521A8BC259B93200000D417 /* Company.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Company.swift; path = lazybear/Company.swift; sourceTree = SOURCE_ROOT; }; 954D992125A2105F001F7F60 /* companies.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = companies.json; path = lazybear/Data/companies.json; sourceTree = SOURCE_ROOT; }; 954D992425A2123B001F7F60 /* HistoricalPricesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HistoricalPricesModel.swift; path = lazybear/Models/HistoricalPricesModel.swift; sourceTree = SOURCE_ROOT; }; 954D997025A253A9001F7F60 /* Config.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Config.swift; path = lazybear/Config.swift; sourceTree = SOURCE_ROOT; }; 954D998225A27571001F7F60 /* HistoricalPrices.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HistoricalPrices.swift; path = lazybear/Functions/HistoricalPrices.swift; sourceTree = SOURCE_ROOT; }; 9552A61E25B0657F001CD0C8 /* SampleConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SampleConfig.swift; path = lazybear/SampleConfig.swift; sourceTree = SOURCE_ROOT; }; - 95612C462598D17F00F7698F /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = User.swift; path = lazybear/User.swift; sourceTree = SOURCE_ROOT; }; - 95612C492598D1F800F7698F /* About.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = About.swift; path = lazybear/About.swift; sourceTree = SOURCE_ROOT; }; - 95612C4E2598D48200F7698F /* Companies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Companies.swift; sourceTree = "<group>"; }; 95612C4F2598D48200F7698F /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; }; - 956AACC6259CA8EF00CB9F16 /* Selection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Selection.swift; sourceTree = "<group>"; }; 956FAF7925AF421E0002B2C1 /* FavCompany+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FavCompany+CoreDataClass.swift"; sourceTree = "<group>"; }; 956FAF7A25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FavCompany+CoreDataProperties.swift"; sourceTree = "<group>"; }; - 958DF3D725A08F4E00D10D22 /* Stock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Stock.swift; path = lazybear/Stock.swift; sourceTree = SOURCE_ROOT; }; - 958DF3DA25A08F8600D10D22 /* Insiders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Insiders.swift; path = lazybear/Insiders.swift; sourceTree = SOURCE_ROOT; }; - 958E472A25B1CA8B0048E770 /* FavCompanies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FavCompanies.swift; path = "lazybear/Supply views/FavCompanies.swift"; sourceTree = SOURCE_ROOT; }; - 959B940825B5F4BC00EEB802 /* LazyColumns.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LazyColumns.swift; path = lazybear/Functions/LazyColumns.swift; sourceTree = SOURCE_ROOT; }; - 959B940B25B6058E00EEB802 /* StockStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StockStats.swift; sourceTree = "<group>"; }; - 95A06A0025B8432200866C00 /* PieChart.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PieChart.swift; sourceTree = "<group>"; }; - 95A06A0425B84CA900866C00 /* InsiderDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderDetail.swift; sourceTree = "<group>"; }; + 958E472A25B1CA8B0048E770 /* FavCompanyList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FavCompanyList.swift; path = "lazybear/Supply views/FavCompanyList.swift"; sourceTree = SOURCE_ROOT; }; 95A1ECAE25A36127001D4A21 /* InsiderTransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = InsiderTransaction.swift; path = lazybear/Functions/InsiderTransaction.swift; sourceTree = SOURCE_ROOT; }; 95A1ECB125A36230001D4A21 /* InsiderTransactionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = InsiderTransactionModel.swift; path = lazybear/Models/InsiderTransactionModel.swift; sourceTree = SOURCE_ROOT; }; - 95A1ECC425A37541001D4A21 /* TransactionRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionRow.swift; sourceTree = "<group>"; }; - 95A8103725AF476F000FD1D6 /* FavCompanyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavCompanyRow.swift; sourceTree = "<group>"; }; 95AB4A79259DCBAE0064C9C1 /* ReadJson.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ReadJson.swift; path = lazybear/Functions/ReadJson.swift; sourceTree = SOURCE_ROOT; }; 95AB4A7C259DCC0C0064C9C1 /* CompanyDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CompanyDataModel.swift; path = lazybear/Models/CompanyDataModel.swift; sourceTree = SOURCE_ROOT; }; 95AB4A8F259DD66D0064C9C1 /* CompanyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanyRow.swift; sourceTree = "<group>"; }; @@ -96,12 +67,18 @@ 95B04EB62521236A000AD27F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 95B04EBB2521236A000AD27F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 95D1BF4825ADCF7700E5D063 /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Persistence.swift; path = "LazyBear/Core Data/Persistence.swift"; sourceTree = SOURCE_ROOT; }; - 95D1BF4B25ADD08500E5D063 /* Main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Main.swift; path = lazybear/Main.swift; sourceTree = SOURCE_ROOT; }; - 95DF5193259DDC45003790B2 /* AboutButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutButton.swift; sourceTree = "<group>"; }; - 95DF5196259DDD68003790B2 /* AppInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppInfo.swift; sourceTree = "<group>"; }; - 95DF5199259DE0E2003790B2 /* WhatsNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNew.swift; sourceTree = "<group>"; }; 95E0287725B88F0B00020CF2 /* formDescription.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = formDescription.json; path = lazybear/Data/formDescription.json; sourceTree = SOURCE_ROOT; }; 95E0287A25B88F3C00020CF2 /* FormDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FormDescription.swift; path = lazybear/Models/FormDescription.swift; sourceTree = SOURCE_ROOT; }; + 95F6C2DC25BAD394003CF389 /* FavCompanyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavCompanyRow.swift; sourceTree = "<group>"; }; + 95F6C2E325BAD529003CF389 /* RandomColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RandomColor.swift; path = lazybear/Functions/RandomColor.swift; sourceTree = SOURCE_ROOT; }; + 95F6C2EF25BAE2ED003CF389 /* Company.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Company.swift; sourceTree = "<group>"; }; + 95F6C2F225BAE3D1003CF389 /* Price.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Price.swift; sourceTree = "<group>"; }; + 95F6C2FD25BAEBBD003CF389 /* HeaderWatchList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderWatchList.swift; sourceTree = "<group>"; }; + 95F6C30025BAEC8B003CF389 /* ShowingCompany.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ShowingCompany.swift; path = lazybear/Models/ShowingCompany.swift; sourceTree = SOURCE_ROOT; }; + 95F6C30425BAF599003CF389 /* CompanyHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanyHeader.swift; sourceTree = "<group>"; }; + 95F6C30825BAF7C2003CF389 /* DateSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateSelection.swift; sourceTree = "<group>"; }; + 95F6C30B25BAFDF5003CF389 /* Insiders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Insiders.swift; sourceTree = "<group>"; }; + 95F6C31025BAFFB8003CF389 /* AddWatchlist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWatchlist.swift; sourceTree = "<group>"; }; 95F7CAF525ADC7B7009E0E7C /* LazyBear.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = LazyBear.xcdatamodel; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -111,7 +88,6 @@ buildActionMask = 2147483647; files = ( 95002580256D17D9008FFD28 /* StoreKit.framework in Frameworks */, - 95D0013225B0CFAB007D45FD /* Charts in Frameworks */, 954D996D25A2461B001F7F60 /* SwiftUICharts in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -137,24 +113,18 @@ 95612C4D2598D48200F7698F /* Supply views */ = { isa = PBXGroup; children = ( - 958E472A25B1CA8B0048E770 /* FavCompanies.swift */, - 95612C4E2598D48200F7698F /* Companies.swift */, 95612C4F2598D48200F7698F /* SearchBar.swift */, - 956AACC6259CA8EF00CB9F16 /* Selection.swift */, + 958E472A25B1CA8B0048E770 /* FavCompanyList.swift */, + 95F6C2DC25BAD394003CF389 /* FavCompanyRow.swift */, + 95F6C2FD25BAEBBD003CF389 /* HeaderWatchList.swift */, + 950B79F525B1CB7A00E5DB5B /* CompanyList.swift */, 95AB4A8F259DD66D0064C9C1 /* CompanyRow.swift */, - 95DF5193259DDC45003790B2 /* AboutButton.swift */, - 95DF5196259DDD68003790B2 /* AppInfo.swift */, - 95DF5199259DE0E2003790B2 /* WhatsNew.swift */, - 95A1ECC425A37541001D4A21 /* TransactionRow.swift */, - 95A8103725AF476F000FD1D6 /* FavCompanyRow.swift */, - 950B79F525B1CB7A00E5DB5B /* CompanyList.swift */, - 950B79F825B1CEA100E5DB5B /* PriceOverview.swift */, - 950B79FB25B1CFD400E5DB5B /* StockCharts.swift */, - 950B79FE25B1E68D00E5DB5B /* InsiderCharts.swift */, - 950B7A0325B1E7E100E5DB5B /* TransactionList.swift */, - 959B940B25B6058E00EEB802 /* StockStats.swift */, - 95A06A0025B8432200866C00 /* PieChart.swift */, - 95A06A0425B84CA900866C00 /* InsiderDetail.swift */, + 95F6C2EF25BAE2ED003CF389 /* Company.swift */, + 95F6C30425BAF599003CF389 /* CompanyHeader.swift */, + 95F6C2F225BAE3D1003CF389 /* Price.swift */, + 95F6C30825BAF7C2003CF389 /* DateSelection.swift */, + 95F6C31025BAFFB8003CF389 /* AddWatchlist.swift */, + 95F6C30B25BAFDF5003CF389 /* Insiders.swift */, ); name = "Supply views"; path = "lazybear/Supply views"; @@ -166,7 +136,7 @@ 95AB4A79259DCBAE0064C9C1 /* ReadJson.swift */, 954D998225A27571001F7F60 /* HistoricalPrices.swift */, 95A1ECAE25A36127001D4A21 /* InsiderTransaction.swift */, - 959B940825B5F4BC00EEB802 /* LazyColumns.swift */, + 95F6C2E325BAD529003CF389 /* RandomColor.swift */, ); path = Functions; sourceTree = "<group>"; @@ -178,6 +148,7 @@ 954D992425A2123B001F7F60 /* HistoricalPricesModel.swift */, 95A1ECB125A36230001D4A21 /* InsiderTransactionModel.swift */, 95E0287A25B88F3C00020CF2 /* FormDescription.swift */, + 95F6C30025BAEC8B003CF389 /* ShowingCompany.swift */, ); path = Models; sourceTree = "<group>"; @@ -222,12 +193,6 @@ 9552A61E25B0657F001CD0C8 /* SampleConfig.swift */, 95B04EB225212369000AD27F /* LazyBearApp.swift */, 95B04EB425212369000AD27F /* ContentView.swift */, - 95D1BF4B25ADD08500E5D063 /* Main.swift */, - 95612C492598D1F800F7698F /* About.swift */, - 95612C462598D17F00F7698F /* User.swift */, - 9521A8BC259B93200000D417 /* Company.swift */, - 958DF3D725A08F4E00D10D22 /* Stock.swift */, - 958DF3DA25A08F8600D10D22 /* Insiders.swift */, 95612C4D2598D48200F7698F /* Supply views */, 95855384259CD9800081CF24 /* Functions */, 9592F496259D29F1005AB6F1 /* Models */, @@ -263,7 +228,6 @@ name = LazyBear; packageProductDependencies = ( 954D996C25A2461B001F7F60 /* SwiftUICharts */, - 95D0013125B0CFAB007D45FD /* Charts */, ); productName = LazyBear; productReference = 95B04EAF25212369000AD27F /* LazyBear.app */; @@ -294,7 +258,6 @@ mainGroup = 95B04EA625212369000AD27F; packageReferences = ( 954D996B25A2461B001F7F60 /* XCRemoteSwiftPackageReference "ChartView" */, - 95D0013025B0CFAB007D45FD /* XCRemoteSwiftPackageReference "swiftui-charts" */, ); productRefGroup = 95B04EB025212369000AD27F /* Products */; projectDirPath = ""; @@ -324,42 +287,31 @@ buildActionMask = 2147483647; files = ( 95AB4A7A259DCBAE0064C9C1 /* ReadJson.swift in Sources */, - 95DF5194259DDC45003790B2 /* AboutButton.swift in Sources */, 95E0287B25B88F3C00020CF2 /* FormDescription.swift in Sources */, - 959B940C25B6058E00EEB802 /* StockStats.swift in Sources */, - 950B79F925B1CEA100E5DB5B /* PriceOverview.swift in Sources */, - 959B940925B5F4BC00EEB802 /* LazyColumns.swift in Sources */, + 95F6C30525BAF599003CF389 /* CompanyHeader.swift in Sources */, + 95F6C2FE25BAEBBD003CF389 /* HeaderWatchList.swift in Sources */, 95612C512598D48200F7698F /* SearchBar.swift in Sources */, - 95A1ECC525A37541001D4A21 /* TransactionRow.swift in Sources */, 950B79F625B1CB7A00E5DB5B /* CompanyList.swift in Sources */, 956FAF7C25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift in Sources */, - 95A06A0125B8432200866C00 /* PieChart.swift in Sources */, 95B04EB525212369000AD27F /* ContentView.swift in Sources */, 95AB4A90259DD66D0064C9C1 /* CompanyRow.swift in Sources */, + 95F6C30125BAEC8B003CF389 /* ShowingCompany.swift in Sources */, + 95F6C30925BAF7C2003CF389 /* DateSelection.swift in Sources */, + 95F6C2F025BAE2ED003CF389 /* Company.swift in Sources */, 95D1BF4925ADCF7700E5D063 /* Persistence.swift in Sources */, - 95612C472598D17F00F7698F /* User.swift in Sources */, - 950B7A0425B1E7E100E5DB5B /* TransactionList.swift in Sources */, - 950B79FC25B1CFD400E5DB5B /* StockCharts.swift in Sources */, - 958E472B25B1CA8B0048E770 /* FavCompanies.swift in Sources */, - 950B79FF25B1E68D00E5DB5B /* InsiderCharts.swift in Sources */, + 958E472B25B1CA8B0048E770 /* FavCompanyList.swift in Sources */, + 95F6C30C25BAFDF5003CF389 /* Insiders.swift in Sources */, 956FAF7B25AF421E0002B2C1 /* FavCompany+CoreDataClass.swift in Sources */, - 95D1BF4C25ADD08500E5D063 /* Main.swift in Sources */, - 95612C4A2598D1F800F7698F /* About.swift in Sources */, + 95F6C31125BAFFB8003CF389 /* AddWatchlist.swift in Sources */, 95B04EB325212369000AD27F /* LazyBearApp.swift in Sources */, - 95A8103825AF476F000FD1D6 /* FavCompanyRow.swift in Sources */, - 958DF3D825A08F4E00D10D22 /* Stock.swift in Sources */, - 956AACC7259CA8EF00CB9F16 /* Selection.swift in Sources */, + 95F6C2F325BAE3D1003CF389 /* Price.swift in Sources */, 954D998325A27571001F7F60 /* HistoricalPrices.swift in Sources */, 95AB4A7D259DCC0C0064C9C1 /* CompanyDataModel.swift in Sources */, 95A1ECB225A36230001D4A21 /* InsiderTransactionModel.swift in Sources */, - 95DF519A259DE0E2003790B2 /* WhatsNew.swift in Sources */, - 958DF3DB25A08F8600D10D22 /* Insiders.swift in Sources */, - 95612C502598D48200F7698F /* Companies.swift in Sources */, - 95DF5197259DDD68003790B2 /* AppInfo.swift in Sources */, + 95F6C2DD25BAD394003CF389 /* FavCompanyRow.swift in Sources */, + 95F6C2E425BAD529003CF389 /* RandomColor.swift in Sources */, 954D997125A253A9001F7F60 /* Config.swift in Sources */, 95A1ECAF25A36127001D4A21 /* InsiderTransaction.swift in Sources */, - 95A06A0525B84CA900866C00 /* InsiderDetail.swift in Sources */, - 9521A8BD259B93200000D417 /* Company.swift in Sources */, 9552A61F25B06580001CD0C8 /* SampleConfig.swift in Sources */, 954D992525A2123B001F7F60 /* HistoricalPricesModel.swift in Sources */, 95F7CAF625ADC7B7009E0E7C /* LazyBear.xcdatamodeld in Sources */, @@ -489,10 +441,10 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = ""; CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = LazyBear/Assets.xcassets; DEVELOPMENT_TEAM = MTX83R5H8X; ENABLE_PREVIEWS = YES; @@ -516,10 +468,10 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = ""; CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = LazyBear/Assets.xcassets; DEVELOPMENT_TEAM = MTX83R5H8X; ENABLE_PREVIEWS = YES; @@ -571,14 +523,6 @@ minimumVersion = 1.5.4; }; }; - 95D0013025B0CFAB007D45FD /* XCRemoteSwiftPackageReference "swiftui-charts" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/spacenation/swiftui-charts.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.0.0; - }; - }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -587,11 +531,6 @@ package = 954D996B25A2461B001F7F60 /* XCRemoteSwiftPackageReference "ChartView" */; productName = SwiftUICharts; }; - 95D0013125B0CFAB007D45FD /* Charts */ = { - isa = XCSwiftPackageProductDependency; - package = 95D0013025B0CFAB007D45FD /* XCRemoteSwiftPackageReference "swiftui-charts" */; - productName = Charts; - }; /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */
--- a/LazyBear.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Wed Jan 20 18:41:15 2021 +0100 +++ b/LazyBear.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Fri Jan 22 13:55:59 2021 +0100 @@ -9,24 +9,6 @@ "revision": "4699847a9ac0c694666cea3acef133498952566e", "version": "1.5.4" } - }, - { - "package": "Charts", - "repositoryURL": "https://github.com/spacenation/swiftui-charts.git", - "state": { - "branch": null, - "revision": "0b66e5c2326e954efdcc94a9eeb699e2f2ae80a2", - "version": "1.0.0" - } - }, - { - "package": "Shapes", - "repositoryURL": "https://github.com/swift-extensions/swiftui-shapes.git", - "state": { - "branch": null, - "revision": "c58b15c37eae9bd20525c6daa93a06a689ca75cb", - "version": "1.1.0" - } } ] },
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/README.md Wed Jan 20 18:41:15 2021 +0100 +++ b/README.md Fri Jan 22 13:55:59 2021 +0100 @@ -21,8 +21,7 @@ ## Contact us Send me a DM [Twitter](https://twitter.com/dennisconcep) -## Open source frameworks used -- [ChartView](https://github.com/AppPear/ChartView) +## Open source frameworks used - [swiftui-charts](https://github.com/spacenation/swiftui-charts) ## License
--- a/lazybear/About.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -// -// Settings.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 27/12/20. -// - -import SwiftUI - -struct About: View { - @Environment(\.presentationMode) var aboutPresentation - - var body: some View { - NavigationView { - VStack(alignment:.leading) { - AppInfo() - - List { - NavigationLink(destination: WhatsNew() - .navigationBarTitle("What's new") - ) { - AboutButton(image: "sparkles", name: "What's new") - } - Button(action: openUrl(url: "https://apps.apple.com/es/app/lazybear-insider-trading/id1534612943?l=en")) { - AboutButton(image: "plus.circle.fill", name: "Rate Lazybear") - } - /* - - NavigationLink(destination: TipJar()) { - AboutButton(image: "gift.fill", name: "Tip jar") - } - */ - Button(action: openUrl(url: "https://twitter.com/LazybearApp")) { - AboutButton(image: "at.circle.fill", name: "@Lazybear") - } - Button(action: openUrl(url: "https://twitter.com/dennisconcep")) { - AboutButton(image: "at.circle.fill", name: "@DennisConcep") - } - Button(action: openUrl(url: "https://github.com/denniscm190/lazybear-iOS")) { - AboutButton(image: "star.fill", name: "Github") - } - Button(action: openUrl(url: "https://lazybear.app")) { - AboutButton(image: "link.circle.fill", name: "Website") - } - /* - Button(action: { }) { - AboutButton(image: "filemenu.and.selection", name: "Terms & Privacy policy") - } - Button(action: { }) { - AboutButton(image: "envelope.circle.fill", name: "Contact") - } - */ - } - } - .padding() - .navigationTitle("About") - .navigationBarItems(leading: - Button(action: {self.aboutPresentation.wrappedValue.dismiss()}) { - Image(systemName: "multiply") - .resizable() - .frame(width: 25, height: 25) - } - ) - - } - .navigationViewStyle(StackNavigationViewStyle()) - } - - func openUrl(url: String) -> () -> () { - return { - if let url = URL(string: url) { - UIApplication.shared.open(url) - } - } - } -} - -struct About_Previews: PreviewProvider { - static var previews: some View { - NavigationView { - About() - } - .navigationViewStyle(StackNavigationViewStyle()) - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/aapl.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "AppleLogo.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/adbe.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "Adobe.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/amj.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "JP.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/amzn.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "AmazonLogo.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/bac.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "bac.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/brk.b.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "brk.b.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/crm.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "Salesforce.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/dis.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "dis.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/fb.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "facebook.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/googl.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "GoogleLogo.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/intc.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "intc.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/nflx.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "Netflix.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/pfe.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "pfe.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/pypl.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "Paypal.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/tsla.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "tesla.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/CompaniesLogos/v.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "v.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/Custom Colors/AccentColor.colorset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "platform" : "ios", - "reference" : "linkColor" - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "1.000", - "green" : "1.000", - "red" : "1.000" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/lazybear/Assets.xcassets/launchLogo.imageset/Contents.json Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "light" - } - ], - "filename" : "launchLogo.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "white.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "light" - } - ], - "idiom" : "universal", - "scale" : "2x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "light" - } - ], - "idiom" : "universal", - "scale" : "3x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "localizable" : true - } -}
--- a/lazybear/Company.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -// -// Company.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 29/12/20. -// - -import SwiftUI - -struct Company: View { - // Company arguments - var cik: Int - var symbol: String - var name: String - - @State public var showingInsiders: Bool = false - @State public var showingStocks: Bool = true - - var body: some View { - GeometryReader { geo in - VStack { - if showingStocks { - Stock(cik: cik, symbol: symbol, name: name) - } - else { - Insiders(cik: cik, symbol: symbol, name: name) - } - Spacer() - // Start bottom selection - Rectangle() - .foregroundColor(.white) - .edgesIgnoringSafeArea(.bottom) - .frame(height: geo.size.height * 0.1) - .overlay( - Selection(showingInsiders: $showingInsiders, showingStocks: $showingStocks) - ) - } - } - } -} - -struct Company_Previews: PreviewProvider { - static var previews: some View { - Company(cik: 320193, symbol: "aapl", name: "apple inc") - } -}
--- a/lazybear/ContentView.swift Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/ContentView.swift Fri Jan 22 13:55:59 2021 +0100 @@ -9,15 +9,37 @@ import CoreData struct ContentView: View { - + @State var searchedCompany: String = "" + @State public var showingSearch: Bool = false + let persistenceController = PersistenceController.shared + var body: some View { - Main() + VStack(alignment: .leading) { + Text("Home") + .font(.largeTitle) + .fontWeight(.bold) + .padding() + + SearchBar(searchedText: $searchedCompany, showingSearch: $showingSearch) + + if !showingSearch { + HeaderWatchlist() + FavCompanyList() + .environment(\.managedObjectContext, persistenceController.container.viewContext) + } + else { + if searchedCompany.count > 2 { + CompanyList(searchedCompany: $searchedCompany) + } + + Spacer() + } + } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() - .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } }
--- a/lazybear/Functions/LazyColumns.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -// -// LazyColumns.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 18/1/21. -// - -import SwiftUI - -// Change number of columns LazyGrid depending on the device -func lazyColumns(verticalSizeClass: UserInterfaceSizeClass, horizontalSizeClass: UserInterfaceSizeClass, iphoneColumns: Int, ipadColumns: Int) -> [GridItem] { - var columns = [GridItem]() - if horizontalSizeClass == .compact && verticalSizeClass == .regular { - print("Running on iPhone") - columns = Array(repeating: .init(.flexible()), count: iphoneColumns) - } - else if horizontalSizeClass == .regular && verticalSizeClass == .regular { - print("Running on iPad") - columns = Array(repeating: .init(.flexible()), count: ipadColumns) - } - - return columns - -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Functions/RandomColor.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,22 @@ +// +// RandomColor.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +func randomColor(index: Int) -> Color { + let systemColour: [Color] = [Color(.systemBlue), Color(.systemRed), Color(.systemPink), Color(.systemTeal), Color(.systemGreen), Color(.systemOrange), Color(.systemYellow), Color(.systemPurple), Color(.systemIndigo), Color(.systemGray)] + + var index = index + if index > 10 { index = index/10 } + if index > 100 { index = index/100 } + if index > 1000 { index = index/1000 } + if index > 10000 { index = index/10000 } + + let color = systemColour[index] + + return color +}
--- a/lazybear/Info.plist Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/Info.plist Fri Jan 22 13:55:59 2021 +0100 @@ -32,9 +32,9 @@ <key>UILaunchScreen</key> <dict> <key>UIColorName</key> - <string>launch</string> + <string></string> <key>UIImageName</key> - <string>launchLogo</string> + <string></string> <key>UIImageRespectsSafeAreaInsets</key> <false/> </dict>
--- a/lazybear/Insiders.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -// -// Insiders.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 2/1/21. -// - -import SwiftUI -import SwiftUICharts - -struct Insiders: View { - var cik: Int - var symbol: String - var name: String - - @ObservedObject var transaction = InsiderTransaction() - @State private var chartsAreShowing = true - - // Picker - var dateFormatter: DateFormatter { - let formatter = DateFormatter() - formatter.dateFormat = "yyyy-MM-dd" - return formatter - } - - @State private var selectedDate = Date().addingTimeInterval(-6*30*24*60*60) // month*days*hours*minutes*seconds - - var body: some View { - if transaction.showingView { - GeometryReader { geo in - VStack { - let width = geo.size.height*0.6 - if chartsAreShowing { - InsiderCharts(transaction: transaction, width: width) - } - - HStack { - Button(action: { self.chartsAreShowing.toggle() }) { - if chartsAreShowing { - Text("Hide chart") - } - else { - Text("Show chart") - } - } - Spacer() - } - .padding([.leading, .top, .trailing]) - - - DatePicker(selection: $selectedDate, in: ...Date(), displayedComponents: .date) { Text("Transactions since").font(.headline) } - .padding([.leading, .trailing]) - .onChange(of: self.selectedDate, perform: { date in - transaction.request(cik: String(cik), date: dateFormatter.string(from: selectedDate)) - }) - - TransactionList(transaction: transaction) - .offset(y: 10) - } - } - } - else { - VStack { - Spacer() - ProgressView() - Spacer() - } - .onAppear { - transaction.request(cik: String(cik), date: dateFormatter.string(from: selectedDate)) - } - .alert(isPresented: $transaction.showingAlert) { - Alert(title: Text("There is no data available"), - message: Text("We have no data about this company. Try another one."), - dismissButton: .default(Text("Got it!"))) - } - } - } -} - -struct Insiders_Previews: PreviewProvider { - static var previews: some View { - Insiders(cik: 320193, symbol: "aapl", name: "apple inc") - } -}
--- a/lazybear/LazyBearApp.swift Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/LazyBearApp.swift Fri Jan 22 13:55:59 2021 +0100 @@ -13,11 +13,8 @@ var body: some Scene { WindowGroup { - NavigationView { - ContentView() - .environment(\.managedObjectContext, persistenceController.container.viewContext) - } - .navigationViewStyle(StackNavigationViewStyle()) + ContentView() + .environment(\.managedObjectContext, persistenceController.container.viewContext) } } }
--- a/lazybear/Main.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -// -// Main.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 12/1/21. -// - -import SwiftUI - -struct Main: View { - @State var searchedCompany: String = "" // Search bar - @State public var showingSearch: Bool = false // Search bar - @State var showingSettings = false // View sheet - @State var showingUser = false // View sheet - @Environment(\.managedObjectContext) private var viewContext // Core data - - var body: some View { - VStack { - if showingSearch == false { - // Setting and user icons - HStack { - Button(action: { self.showingSettings.toggle() }) { - Image(systemName: "gear") - .imageIconModifier(maxWidth: 30) - - }.sheet(isPresented: $showingSettings) { - About() - - } - - Spacer() - Button(action: { self.showingUser.toggle() }) { - Image(systemName: "person") - .imageIconModifier(maxWidth: 30) - - } - .fullScreenCover(isPresented: $showingUser) { - User() - .environment(\.managedObjectContext, self.viewContext) - - } - } - .padding() - } - - SearchBar(searchedText: $searchedCompany, placeholder: "Search ...", showingSearch: $showingSearch, exitButton: "Cancel") - if showingSearch == false { - Companies() - .transition(.move(edge: .bottom)) - .animation(.default) - } - else { - if searchedCompany.count > 2 { - CompanyList(searchedCompany: $searchedCompany, isCoreData: false) - } - Spacer() - } - } - .navigationBarHidden(true) - } -} -extension Image { - func imageIconModifier(maxWidth: CGFloat) -> some View { - self - .resizable() - .aspectRatio(contentMode: .fit) - .frame(maxWidth: maxWidth) - } -} - - -struct Main_Previews: PreviewProvider { - static var previews: some View { - NavigationView { - Main() - .navigationViewStyle(StackNavigationViewStyle()) - } - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Models/ShowingCompany.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,16 @@ +// +// ShowingCompany.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +class ShowingCompany: ObservableObject { + @Published var isShowing: Bool = false { + didSet { + print("Company is showing -> " + String(isShowing)) + } + } +}
--- a/lazybear/Stock.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -// -// Stock.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 2/1/21. -// - -import SwiftUI - -struct Stock: View { - var cik: Int - var symbol: String - var name: String - @ObservedObject var historicalPrices = HistoricalPrices() - - var body: some View { - if historicalPrices.showingView { - GeometryReader { geo in - VStack { - PriceOverview(historicalPrices: historicalPrices) - let width = geo.size.width*0.9 - StockCharts(historicalPrices: historicalPrices, geoWidth: width) - } - .background( - Color(.systemGray6) - .edgesIgnoringSafeArea(.all) - ) - } - } - else { - VStack{ - Spacer() - ProgressView() - Spacer() - } - .onAppear { - print(symbol) - historicalPrices.request(symbol: symbol) - } - .alert(isPresented: $historicalPrices.showingAlert) { - Alert(title: Text("There is no data available"), - message: Text("We have no data about this company. Try another one."), - dismissButton: .default(Text("Got it!"))) - } - } - } -} -extension Image { - func favouriteIcon() -> some View { - self - .resizable() - .frame(width: 25, height: 25) - .foregroundColor(.yellow) - } -} - -struct Stock_Previews: PreviewProvider { - static var previews: some View { - Stock(cik: 320193, symbol: "aapl", name: "apple inc") - } -}
--- a/lazybear/Supply views/AboutButton.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -// -// AboutButton.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 31/12/20. -// - -import SwiftUI - -struct AboutButton: View { - @State var image: String - @State var name: String - - var body: some View { - HStack { - Image(systemName: image) - .renderingMode(.original) - .resizable() - .frame(width: 25, height: 25) - - Text(name) - } - } -} - -struct AboutButton_Previews: PreviewProvider { - static var previews: some View { - AboutButton(image: "sparkles", name: "What's new") - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/AddWatchlist.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,39 @@ +// +// AddWatchlist.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +struct AddWatchlist: View { + @Environment(\.managedObjectContext) private var viewContext + @FetchRequest(entity: FavCompany.entity(), sortDescriptors: []) + var favCompanies: FetchedResults<FavCompany> + + var body: some View { + Button(action: { }) { + Text("Add to watchlist") + } + } + + func addWatchlist(cik: Int, symbol: String, name: String) { + let favCompany = FavCompany(context: viewContext) + favCompany.cik = Int32(cik) + favCompany.symbol = symbol + favCompany.name = name + do { + try viewContext.save() + print("Company saved.") + } catch { + print(error.localizedDescription) + } + } +} + +struct AddWatchlist_Previews: PreviewProvider { + static var previews: some View { + AddWatchlist() + } +}
--- a/lazybear/Supply views/AppInfo.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -// -// AppInfo.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 31/12/20. -// - -import SwiftUI - -struct AppInfo: View { - var body: some View { - HStack { - Spacer() - Image("launchLogo") - .resizable() - .frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/) - - VStack { - Text("Lazybear " + getVersion()) - .fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/) - - Text("By Dennis Concepción") - } - Spacer() - } - .padding() - } - - // Get app version - func getVersion() -> String { - let dictionary = Bundle.main.infoDictionary! - let version = dictionary["CFBundleShortVersionString"] as! String - return version - } -} - -struct AppInfo_Previews: PreviewProvider { - static var previews: some View { - AppInfo() - } -}
--- a/lazybear/Supply views/Companies.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -// -// Companies.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 27/12/20. -// - -import SwiftUI - -struct Companies: View { - @Environment(\.verticalSizeClass) var verticalSizeClass: UserInterfaceSizeClass? - @Environment(\.horizontalSizeClass) var horizontalSizeClass: UserInterfaceSizeClass? - - var names = ["adobe", "amazon", "apple", "facebook", "google", "jp morgan", "netflix", "paypal", "salesforce", "tesla", "berkshire h.", "visa", "walt disney", "bofa", "pfizer", "intel"] - var ciks = [796343, 1018724, 320193, 1326801, 1652044, 19617, 1065280, 1633917, 1108524, 1318605, 1067983, 1403161, 1744489, 70858, 78003, 50863] - var symbols = ["adbe", "amzn", "aapl", "fb", "googl", "amj", "nflx", "pypl", "crm", "tsla", "brk.b", "v", "dis", "bac", "pfe", "intc"] - var colours = [Color(.systemBlue), Color(.systemGreen), Color(.systemIndigo), Color(.systemOrange), Color(.systemPink), Color(.systemPurple), Color(.systemRed), Color(.systemTeal), Color(.systemYellow), Color(.systemBlue), Color(.systemGreen), Color(.systemIndigo), Color(.systemOrange), Color(.systemPink), Color(.systemPurple), Color(.systemRed)] - - var body: some View { - ScrollView { - let columns = lazyColumns(verticalSizeClass: verticalSizeClass!, horizontalSizeClass: horizontalSizeClass!, - iphoneColumns: 2, ipadColumns: 4) - - LazyVGrid(columns: columns, spacing: 20) { - ForEach((0...15), id: \.self) { index in - NavigationLink(destination: Company(cik: ciks[index], symbol: symbols[index], name: names[index]) - .navigationBarTitle(names[index].capitalized) - ) { - VStack { - Image(symbols[index]) - .resizable() - .aspectRatio(contentMode: .fit) - - Text(names[index].capitalized) - .foregroundColor(.white) - .fontWeight(.bold) - } - .padding(40) - .background(colours[index].cornerRadius(20)) - } - } - } - .padding() - } - } -} - -struct Companies_Previews: PreviewProvider { - static var previews: some View { - Companies() - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/Company.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,27 @@ +// +// Company.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +struct Company: View { + + var body: some View { + CompanyHeader() + ScrollView { + VStack(alignment: .leading) { + Price() + Spacer() + } + } + } +} + +struct Company_Previews: PreviewProvider { + static var previews: some View { + Company() + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/CompanyHeader.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,37 @@ +// +// CompanyHeader.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +struct CompanyHeader: View { + @Environment(\.presentationMode) var presentationMode + + var body: some View { + VStack(alignment: .leading) { + HStack { + Text("AAPL") + .font(.title) + .fontWeight(.semibold) + + Spacer() + Button(action: { self.presentationMode.wrappedValue.dismiss() }) { + Image(systemName: "multiply.circle.fill") + } + + } + + Text("Apple Inc") + } + .padding([.leading, .trailing]) + } +} + +struct CompanyHeader_Previews: PreviewProvider { + static var previews: some View { + CompanyHeader() + } +}
--- a/lazybear/Supply views/CompanyList.swift Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/Supply views/CompanyList.swift Fri Jan 22 13:55:59 2021 +0100 @@ -9,17 +9,12 @@ struct CompanyList: View { @Binding var searchedCompany: String - @State var isCoreData: Bool var body: some View { List { - ForEach(companiesData.filter({ searchedCompany.isEmpty ? true : $0.name.localizedStandardContains(searchedCompany) }), id: \.cik) { company in - if isCoreData { - FavCompanyRow(company: company) - } - else { - CompanyRow(company: company) - } + ForEach(companiesData.filter({ searchedCompany.isEmpty ? true : $0.name.localizedStandardContains(searchedCompany) }) + , id: \.cik) { company in + CompanyRow(company: company) } } .edgesIgnoringSafeArea(.bottom) @@ -30,6 +25,6 @@ struct CompanyList_Previews: PreviewProvider { static var previews: some View { - CompanyList(searchedCompany: .constant("Apple"), isCoreData: false) + CompanyList(searchedCompany: .constant("Apple")) } }
--- a/lazybear/Supply views/CompanyRow.swift Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/Supply views/CompanyRow.swift Fri Jan 22 13:55:59 2021 +0100 @@ -8,16 +8,23 @@ import SwiftUI struct CompanyRow: View { + @ObservedObject var showingCompany = ShowingCompany() var company: CompanyDataModel var body: some View { - HStack { - NavigationLink(destination: Company(cik: company.cik, symbol: company.symbol, name: company.name) - .navigationBarTitle(company.name.capitalized) - ) { + Button(action: { showingCompany.isShowing.toggle() }) { + VStack(alignment: .leading) { + Text(company.symbol.uppercased()) + .fontWeight(.semibold) + Text(company.name.capitalized) + .font(.caption) + } } + .fullScreenCover(isPresented: $showingCompany.isShowing) { + Company() + } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/DateSelection.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,33 @@ +// +// DateSelection.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +struct DateSelection: View { + var period = ["1D", "1W", "1M", "3M", "6M", "1Y", "2Y", "5Y"] + @State private var selectedPeriod = 0 + + var body: some View { + VStack { + Picker(selection: $selectedPeriod, label: Text("Please choose a period")) { + ForEach(0 ..< period.count) { + Text(self.period[$0]) + } + } + .pickerStyle(SegmentedPickerStyle()) + + //Text("You selected: \(period[selectedPeriod])") + } + .padding([.leading, .trailing]) + } +} + +struct DateSelection_Previews: PreviewProvider { + static var previews: some View { + DateSelection() + } +}
--- a/lazybear/Supply views/FavCompanies.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -// -// FavCompanies.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 15/1/21. -// - -import SwiftUI - -struct FavCompanies: View { - @Environment(\.managedObjectContext) private var viewContext // Core data - @FetchRequest(entity: FavCompany.entity(), sortDescriptors: []) // Core data - var favCompanies: FetchedResults<FavCompany> // Fetch core data - - var body: some View { - List { - ForEach(favCompanies) { favCompany in - HStack { - NavigationLink(destination: Company(cik: Int(favCompany.cik), symbol: favCompany.symbol, name: favCompany.name) - .navigationBarTitle(favCompany.name.capitalized) - ) { - Text(favCompany.name.capitalized) - } - }.padding() - } - // Delete from persistent storage - .onDelete { indexSet in - for index in indexSet { - viewContext.delete(favCompanies[index]) - } - do { - try viewContext.save() - print("Company deleted") - } catch { - print(error.localizedDescription) - } - } - } - } - - } - -struct FavCompanies_Previews: PreviewProvider { - static var previews: some View { - FavCompanies() - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/FavCompanyList.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,43 @@ +// +// FavCompanies.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 15/1/21. +// + +import SwiftUI + +struct FavCompanyList: View { + @Environment(\.managedObjectContext) private var viewContext // Core data + @FetchRequest(entity: FavCompany.entity(), sortDescriptors: []) // Core data + var favCompanies: FetchedResults<FavCompany> // Fetch core data + + var body: some View { + List { + ForEach(favCompanies) { company in + let index = favCompanies.firstIndex(of: company) + FavCompanyRow(favCompany: company, index: index!) + } + // Delete from persistent storage + .onDelete { indexSet in delete(indexSet: indexSet) } + } + } + + func delete(indexSet: IndexSet) { + for index in indexSet { + viewContext.delete(favCompanies[index]) + } + do { + try viewContext.save() + print("Company deleted") + } catch { + print(error.localizedDescription) + } + } +} + +struct FavCompanies_Previews: PreviewProvider { + static var previews: some View { + FavCompanyList() + } +}
--- a/lazybear/Supply views/FavCompanyRow.swift Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/Supply views/FavCompanyRow.swift Fri Jan 22 13:55:59 2021 +0100 @@ -2,73 +2,47 @@ // FavCompanyRow.swift // LazyBear // -// Created by Dennis Concepción Martín on 13/1/21. +// Created by Dennis Concepción Martín on 22/1/21. // import SwiftUI struct FavCompanyRow: View { - var company: CompanyDataModel - @Environment(\.managedObjectContext) private var viewContext - @FetchRequest(entity: FavCompany.entity(), sortDescriptors: []) - var favCompanies: FetchedResults<FavCompany> + var favCompany: FavCompany + var index: Int + @ObservedObject var showingCompany = ShowingCompany() + let persistenceController = PersistenceController.shared var body: some View { - let names = favCompanies.map { $0.name } - HStack { - if names.contains(company.name) { - Button(action: { deleteFavourite(symbol: company.symbol) }) { - Image(systemName: "minus.circle.fill") - .iconModifier() - } - } - else { - Button(action: { addFavourite(cik: company.cik, symbol: company.symbol, name: company.name) }) { - Image(systemName: "plus.circle.fill") - .iconModifier() + Button(action: { showingCompany.isShowing.toggle() }) { + HStack { + Image(systemName: "building.2") + .foregroundColor(.white) + .padding(5) + .background( + randomColor(index: index) + .cornerRadius(5) + ) + + VStack(alignment: .leading) { + Text(favCompany.symbol.uppercased()) + .fontWeight(.semibold) + + Text(favCompany.name.capitalized) + .font(.caption) } } - Text(company.name.capitalized) - } - } - - func addFavourite(cik: Int, symbol: String, name: String) { - let favCompany = FavCompany(context: viewContext) - favCompany.cik = Int32(cik) - favCompany.symbol = symbol - favCompany.name = name - do { - try viewContext.save() - print("Company saved.") - } catch { - print(error.localizedDescription) } - } - - func deleteFavourite(symbol: String) { - let symbols = favCompanies.map { $0.symbol } // Get array of symbols - let index = symbols.firstIndex(of: symbol) // Find index of the symbol to delete - viewContext.delete(favCompanies[index!]) // Delete it - // Save the deletion - do { - try viewContext.save() - print("Company deleted") - } catch { - print(error.localizedDescription) + .fullScreenCover(isPresented: $showingCompany.isShowing) { + Company() + .environment(\.managedObjectContext, persistenceController.container.viewContext) + } } } -extension Image { - func iconModifier() -> some View { - self - .renderingMode(.original) - .resizable() - .frame(width: 25, height: 25) - } -} struct FavCompanyRow_Previews: PreviewProvider { static var previews: some View { - FavCompanyRow(company: companiesData[0]) + FavCompanyRow(favCompany: FavCompany.init(), index: 0) } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/HeaderWatchList.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,29 @@ +// +// HeaderWatchList.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +struct HeaderWatchlist: View { + var body: some View { + HStack(alignment: .bottom) { + Text("Watchlist") + .font(.title2) + .fontWeight(.semibold) + .padding([.top, .leading]) + + Spacer() + EditButton() + .padding(.trailing) + } + } +} + +struct HeaderWatchlist_Previews: PreviewProvider { + static var previews: some View { + HeaderWatchlist() + } +}
--- a/lazybear/Supply views/InsiderCharts.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -// -// TransactionCharts.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 15/1/21. -// - -import SwiftUI -import Charts - -struct InsiderCharts: View { - @State var transaction: InsiderTransaction - @State var width: CGFloat - - - var body: some View { - VStack { - PieChart(dataPoints: dataPoints()) - .shadow(radius: 10) - } - } - - func dataPoints() -> [DataPoint] { - var buys = [Int]() - var sells = [Int]() - for trans in transaction.result { - if trans.acquisition_disposition == "A" { - // It's a buy - buys.append(trans.number_securities_transacted) - } - else { - // It's a sell - sells.append(trans.number_securities_transacted) - } - } - - // Now add up all the securities transacted - let totalBuys = buys.reduce(0, +) - let totalSells = sells.reduce(0, +) - - // Finally return DataPoint for PieChart - var PieData: [DataPoint] { - [ - DataPoint(id: 1, value: Double(totalBuys), color: .red), - DataPoint(id: 1, value: Double(totalSells), color: .green), - ] - } - - return PieData - } -} - -struct TransactionCharts_Previews: PreviewProvider { - static var previews: some View { - InsiderCharts(transaction: InsiderTransaction.init(), width: 100) - } -}
--- a/lazybear/Supply views/InsiderDetail.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -// -// InsiderDetail.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 20/1/21. -// - -import SwiftUI - -struct InsiderDetail: View { - @State var transaction: InsiderTransactionModel - @Environment(\.presentationMode) var detailPresentationMode - - var body: some View { - NavigationView { - Form { - Section(header: Text("Owner")) { - SectionBody(image: "person.fill", data: transaction.reporting_owner.capitalized) - } - - Section(header: Text("Date YYYY/MM/DD")) { - SectionBody(image: "calendar", data: transaction.transaction_date) - } - - Section(header: Text("Securities transacted")) { - SectionBody(image: "number", data: String(transaction.number_securities_transacted)) - } - - Section(header: Text("Transaction type")) { - let data = transaction.transaction_type.components(separatedBy: "-")[1] - SectionBody(image: "dollarsign.circle", data: data) - SectionBody(image: "info.circle", data: "Type: " + transaction.transaction_type) - } - let transactionCode = transaction.transaction_type.components(separatedBy: "-")[0] - Section(header: Text("What is a (" + transactionCode + ") transaction type?")) { - HStack { - let transactionCodesArray = formDescription.map { $0.transactionCode } - let index = transactionCodesArray.firstIndex(of: transactionCode) - let description = formDescription[index!].description - Text(description) - } - } - } - .navigationBarTitle("Transaction details") - .navigationBarItems(leading: - Button(action: { self.detailPresentationMode.wrappedValue.dismiss() } - ) { - Image(systemName: "multiply") - .resizable() - .frame(width: 25, height: 25) - - } - ) - } - } -} - -struct SectionBody: View { - @State var image: String - @State var data: String - - var body: some View { - HStack { - Image(systemName: image) - Text(data) - } - } -} - -struct InsiderDetail_Previews: PreviewProvider { - static var previews: some View { - InsiderDetail(transaction: InsiderTransactionModel(acquisition_disposition: "A", transaction_date: "2020-01-01", reporting_owner: "steve jobs", transaction_type: "F-SomeStuff", number_securities_transacted: 12345)) - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/Insiders.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,20 @@ +// +// Insiders.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI + +struct Insiders: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct Insiders_Previews: PreviewProvider { + static var previews: some View { + Insiders() + } +}
--- a/lazybear/Supply views/PieChart.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// -// PieChart.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 20/1/21. -// - -import SwiftUI - -struct DataPoint: Identifiable { - let id: Int - let value: Double - let color: Color - - init(value: Double, color: Color) { - self.id = Int.random(in: 1..<Int.max) - self.value = value - self.color = color - } - - init(id: Int, value: Double, color: Color) { - self.id = Int.random(in: 1..<Int.max) - self.value = value - self.color = color - } -} - -struct PieSegment: Shape, Identifiable { - let data: DataPoint - var id: Int { data.id } - var startAngle: Double - var amount: Double - - var animatableData: AnimatablePair<Double, Double> { - get { AnimatablePair(startAngle, amount) } - set { - startAngle = newValue.first - amount = newValue.second - } - } - - func path(in rect: CGRect) -> Path { - let radius = min(rect.width, rect.height) / 2 - let center = CGPoint(x: rect.width / 2, y: rect.height / 2) - - var path = Path() - path.move(to: center) - path.addRelativeArc(center: center, radius: radius, startAngle: Angle(radians: startAngle), delta: Angle(radians: amount)) - - return path - } -} - -struct PieChart: View { - let pieSegments: [PieSegment] - - init(dataPoints: [DataPoint]) { - var segments = [PieSegment]() - let total = dataPoints.reduce(0) { $0 + $1.value } - var startAngle = -Double.pi / 2 - - for data in dataPoints { - let amount = .pi * 2 * (data.value / total) - let segment = PieSegment(data: data, startAngle: startAngle, amount: amount) - segments.append(segment) - startAngle += amount - - } - - pieSegments = segments - } - - var body: some View { - ZStack { - ForEach(pieSegments) { segment in - segment - .fill(segment.data.color) - } - } - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lazybear/Supply views/Price.swift Fri Jan 22 13:55:59 2021 +0100 @@ -0,0 +1,51 @@ +// +// Price.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/1/21. +// + +import SwiftUI +import SwiftUICharts + +struct Price: View { + var body: some View { + VStack { + Divider() + HStack { + Text("320.30") + .font(.headline) + .padding(.trailing) + + Text("+1.67%") + .foregroundColor(.green) + + Spacer() + AddWatchlist() + } + .padding([.leading, .trailing]) + Divider() + + DateSelection() + + let gradient = GradientColor(start: .green, end: .green) + let style = ChartStyle( + backgroundColor: .white, + accentColor: .green, + gradientColor: gradient, + textColor: .black, + legendTextColor: .black, + dropShadowColor: .white) + + LineView(data: [8,23,54,32,12,37,7,23,43], title: "", style: style) + .padding([.leading, .trailing]) + .offset(y: -40) + } + } +} + +struct Price_Previews: PreviewProvider { + static var previews: some View { + Price() + } +}
--- a/lazybear/Supply views/PriceOverview.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -// -// PriceOverview.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 15/1/21. -// - -import SwiftUI - -struct PriceOverview: View { - @State var historicalPrices: HistoricalPrices - - var body: some View { - VStack { - HStack { - Text("$ " + String(historicalPrices.result.last!.close)) - .font(.title) - .fontWeight(.bold) - - let pct = historicalPrices.result.last!.changePercent * 100 - Text(String(format: "%.2f", pct) + " %") - .font(.headline) - .foregroundColor(whichColor()) - - Spacer() - } - .padding([.leading, .top, .trailing]) - - HStack { - Text(String(historicalPrices.result.last!.date) + " last price") - .font(.caption) - .padding([.leading]) - .opacity(0.5) - - Spacer() - } - } - } - - func whichColor() -> Color { - if historicalPrices.result.last!.changePercent < 0 { - return Color(.red) - } - else { - return Color(.green) - } - } -} - -struct PriceOverview_Previews: PreviewProvider { - static var previews: some View { - PriceOverview(historicalPrices: HistoricalPrices.init()) - } -}
--- a/lazybear/Supply views/SearchBar.swift Wed Jan 20 18:41:15 2021 +0100 +++ b/lazybear/Supply views/SearchBar.swift Fri Jan 22 13:55:59 2021 +0100 @@ -8,22 +8,18 @@ import SwiftUI struct SearchBar: View { - - // Text field @Binding var searchedText: String @State var searchBarIsEditing = false - @State var placeholder: String - @Binding var showingSearch: Bool // Content View - @State var exitButton: String + @Binding var showingSearch: Bool // Show search view in ContentView var body: some View { HStack { - TextField(placeholder, text: $searchedText) + TextField("Search ...", text: $searchedText) .padding(10) .padding(.horizontal, 45) .overlay( HStack { - Image(systemName: "globe") + Image(systemName: "magnifyingglass") .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .padding(.leading) .foregroundColor(Color("placeholder")) @@ -43,9 +39,8 @@ .cornerRadius(10) .onTapGesture { self.searchBarIsEditing = true - withAnimation { self.showingSearch = true // Content View - } + } @@ -53,14 +48,13 @@ Button(action: { self.searchedText = "" self.searchBarIsEditing = false - withAnimation { self.showingSearch = false // Content View - } + // Force hide keyboard UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) }) { - Text(exitButton) + Text("Cancel") } } } @@ -70,6 +64,6 @@ struct SearchBar_Previews: PreviewProvider { static var previews: some View { - SearchBar(searchedText: .constant(""), placeholder: "Placeholder", showingSearch: .constant(true), exitButton: "Cancel") + SearchBar(searchedText: .constant(""), showingSearch: .constant(true)) } }
--- a/lazybear/Supply views/Selection.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -// -// Selection.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 30/12/20. -// - -import SwiftUI - -struct Selection: View { - @Binding var showingInsiders: Bool - @Binding var showingStocks: Bool - - var body: some View { - // Buttons - HStack { - Group { - // Insiders - Button(action: {toggle(type: "insider")}) { - if showingInsiders { - Image(systemName: "person.fill") - .resizable() - .frame(width: 35, height: 35) - } else { - Image(systemName: "person") - .resizable() - .frame(width: 35, height: 35) - } - } - - // Stock - Button(action: {toggle(type: "stock")}) { - if showingStocks { - Image(systemName: "dollarsign.square.fill") - .resizable() - .frame(width: 35, height: 35) - - } else { - Image(systemName: "dollarsign.square") - .resizable() - .frame(width: 35, height: 35) - } - } - } - .padding().padding().padding() - } - } - - func toggle(type: String) { - if type == "insider" { - self.showingStocks = false - self.showingInsiders = true - } - - if type == "stock" { - self.showingStocks = true - self.showingInsiders = false - } - - if type == "description" { - self.showingStocks = false - self.showingInsiders = false - } - } -} - -struct Selection_Previews: PreviewProvider { - static var previews: some View { - Selection(showingInsiders: .constant(false), showingStocks: .constant(true)) - } -} - -/* - - */
--- a/lazybear/Supply views/StockCharts.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -// -// ScrollCharts.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 15/1/21. -// - -import SwiftUI -import SwiftUICharts - -struct StockCharts: View { - @State var historicalPrices: HistoricalPrices - @State var geoWidth: CGFloat - @Environment(\.verticalSizeClass) var verticalSizeClass: UserInterfaceSizeClass? - @Environment(\.horizontalSizeClass) var horizontalSizeClass: UserInterfaceSizeClass? - - var body: some View { - ScrollView { - let columns = lazyColumns(verticalSizeClass: verticalSizeClass!, horizontalSizeClass: horizontalSizeClass!, - iphoneColumns: 1, ipadColumns: 2) - - LazyVGrid(columns: columns, spacing: 20) { - let normalSize = chartSize(chartType: "") - let specialSize = chartSize(chartType: "special") - - let prices = historicalPrices.result.map { $0.close } // Get an array of the variable "Close" in the struct - LineChartView(data: prices, title: "Stock price", legend: "Last month", form: CGSize(width: normalSize.0, height: normalSize.1), rateValue: nil) - .padding() - - let maxPrice = prices.max()! - let minPrice = prices.min()! - StockStats(dataMax: maxPrice, dataMin: minPrice, width: normalSize.0, height: normalSize.1, title: "price") - - let volume = historicalPrices.result.map { $0.volume } - BarChartView(data: ChartData(points: volume), title: "Volume", form: CGSize(width: specialSize.0, height: specialSize.1)) - .padding() - - let maxVolume = volume.max()! - let minVolume = volume.min()! - StockStats(dataMax: Double(maxVolume), dataMin: Double(minVolume), width: normalSize.0, height: normalSize.1, title: "volume") - - let change = historicalPrices.result.map { $0.changePercent*100 } - LineChartView(data: change, title: "Daily percentage change", legend: "Last month", form: CGSize(width: normalSize.0, height: normalSize.1), rateValue: nil) - .padding() - - let maxChange = change.max()! - let minChange = change.min()! - StockStats(dataMax: maxChange, dataMin: minChange, width: normalSize.0, height: normalSize.1, title: "daily change") - - } - } - } - - func chartSize(chartType: String) -> (CGFloat, CGFloat) { - var height = CGFloat() - var width = CGFloat() - - if horizontalSizeClass == .compact && verticalSizeClass == .regular { - //print("Running on iPhone") - - if chartType == "special" { - //size = CGSize(width: width, height: width/1.5) - width = geoWidth - height = geoWidth/1.5 - } - else { - //size = CGSize(width: width, height: width/2) - width = geoWidth - height = geoWidth/2 - } - } - else { - //print("Running on iPad") - //size = CGSize(width: 360, height: 240) - width = CGFloat(360) - height = CGFloat(240) - } - // Return tupple - return (width, height) - } -} - -struct ScrollCharts_Previews: PreviewProvider { - static var previews: some View { - StockCharts(historicalPrices: HistoricalPrices.init(), geoWidth: 100) - } -}
--- a/lazybear/Supply views/StockStats.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -// -// StockStats.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 18/1/21. -// - -import SwiftUI - -struct StockStats: View { - @State var dataMax: Double - @State var dataMin: Double - @State var width: CGFloat - @State var height: CGFloat - @State var title: String - - var body: some View { - VStack(alignment: .leading) { - Text("Highest " + title) - .titleModifier() - - DataObject(data: dataMax, colour: .green, type: title) - Text("Lowest " + title) - .titleModifier() - - DataObject(data: dataMin, colour: .red, type: title) - - - } - .frame(width: width, height: height) - } -} - -struct DataObject: View { - @State var data: Double - @State var colour: Color - @State var type: String - - var body: some View { - let units = unit() - RoundedRectangle(cornerRadius: 25) - .foregroundColor(.white) - .overlay( - Text("\(units.0) \(data, specifier: "%.2f") \(units.1)") - .foregroundColor(colour) - .dataModifier() - ) - } - - func unit() -> (String, String) { - var dollar = "" - var pct = "" - if type == "price" { - dollar = "$" - } - else if type == "daily change" { - pct = "%" - } - - return (dollar, pct) - } -} -extension Text { - func dataModifier() -> some View { - self - .font(.title3) - .fontWeight(.bold) - } -} - -extension Text { - func titleModifier() -> some View { - self - .font(.title2) - .fontWeight(.bold) - } -} - -struct StockStats_Previews: PreviewProvider { - static var previews: some View { - StockStats(dataMax: 500.00, dataMin: 200.00, width: 360, height: 240, title: "price") - } -}
--- a/lazybear/Supply views/TransactionList.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// -// TransactionList.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 15/1/21. -// - -import SwiftUI - -struct TransactionList: View { - @State var transaction: InsiderTransaction - - var body: some View { - List { - ForEach(transaction.result, id:\.self) { trans in - TransactionRow(transaction: trans) - } - } - } -} - -struct TransactionList_Previews: PreviewProvider { - static var previews: some View { - TransactionList(transaction: InsiderTransaction.init()) - } -}
--- a/lazybear/Supply views/TransactionRow.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -// -// TransactionRow.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 4/1/21. -// - -import SwiftUI - -struct TransactionRow: View { - @State var transaction: InsiderTransactionModel - @State var showingDetails = false - - var body: some View { - Button(action: { self.showingDetails.toggle() }) { - VStack(alignment: .leading) { - HStack { - Image(systemName: "person.fill") - Text(transaction.reporting_owner.capitalized) - Spacer() - Text(String(transaction.number_securities_transacted)) - .foregroundColor(colourShares(type: transaction.acquisition_disposition)) - } - HStack { - Image(systemName: "calendar") - Text(transaction.transaction_date) - } - } - .padding() - } - .sheet(isPresented: $showingDetails) { - InsiderDetail(transaction: - InsiderTransactionModel( - acquisition_disposition: transaction.acquisition_disposition, - transaction_date: transaction.transaction_date, - reporting_owner: transaction.reporting_owner, - transaction_type: transaction.transaction_type, - number_securities_transacted: transaction.number_securities_transacted) - ) - } - } - - func colourShares(type: String) -> Color { - if type == "A" { // If aquisition_disposition == A, means "Acquisition" -> buy - return Color(.green) - } - else { - return Color(.red) - } - } -} - -struct TransactionRow_Previews: PreviewProvider { - static var previews: some View { - TransactionRow(transaction: InsiderTransactionModel(acquisition_disposition: "A", transaction_date: "2020-01-01", reporting_owner: "steve jobs", transaction_type: "F-SomeStuff", number_securities_transacted: 12345)) - } -}
--- a/lazybear/Supply views/WhatsNew.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -// -// WhatsNew.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 31/12/20. -// - -import SwiftUI -import SwiftUICharts - -struct WhatsNew: View { - var body: some View { - GeometryReader { geo in - ScrollView { - VStack(alignment: .leading, spacing: 20) { - Group { - let intro = "This new version comes with lots of changes and many cool stuff. I've been working hard to improve the backend efficiency, deploy a new API and other boring stuff that you probably are not interested in. So let's talk about the cool stuff." - Text(intro) - } - - Group { - let title1 = "New design" - let text1 = "As you can see, there is a completely new design, more clean, colourful, and simple. Less is more." - Text(title1 + " 😎") - .title() - - Text(text1) - } - - Group { - let title2 = "Charts! A bunch!" - let text2 = "Look how cool they are" - Text(title2) - .title() - - Text(text2 + " 😁") - } - - Group { - HStack { - Spacer() - let width = geo.size.height*0.4 - LineChartView(data: [8,23,54,32,12,37,7,23,43], title: "Some cool title", form: CGSize(width: width, height: width/2), rateValue: 14) - Spacer() - } - } - - Group { - let title3 = "Stock prices" - let text3 = "Finally I found a not-so-expensive method to show stock prices. In this version you can see the latest stock price from the previous day, but I promise you in future versions I am going to add real-time stock prices." - Text(title3) - .title() - - Text(text3) - } - - Group { - let title4 = "Watchlist 👀" - let text4 = "Now, you can save your favourite companies to have a quick access whenever you want." - Text(title4) - .title() - - Text(text4) - - Text("Favourites") - .font(.headline) - - ExampleFavourite(companyName: "Apple Inc") - ExampleFavourite(companyName: "Netflix") - ExampleFavourite(companyName: "Goldman Sachs") - } - } - .padding() - } - } - } -} -extension Text { - func title() -> some View { - self - .font(/*@START_MENU_TOKEN@*/.title/*@END_MENU_TOKEN@*/) - .fontWeight(.semibold) - } -} - -struct ExampleFavourite: View { - @State var companyName: String - var body: some View { - HStack { - Image(systemName: "star.fill") - .renderingMode(.original) - Text(companyName) - } - } -} - -struct WhatsNew_Previews: PreviewProvider { - static var previews: some View { - WhatsNew() - } -}
--- a/lazybear/User.swift Wed Jan 20 18:41:15 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -// -// User.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 27/12/20. -// - -import SwiftUI - -struct User: View { - @Environment(\.presentationMode) var userPresentation // Dismiss sheet - @State var searchedCompany: String = "" // Search bar - @State public var showingSearch: Bool = false // Search Bar - - var body: some View { - NavigationView { - VStack(alignment:.leading) { - SearchBar(searchedText: $searchedCompany, placeholder: "Add a company ...", showingSearch: $showingSearch, exitButton: "Done") - if showingSearch == false { - FavCompanies() - } - else { - if searchedCompany.count > 2 { - CompanyList(searchedCompany: $searchedCompany, isCoreData: true) - } - Spacer() - } - } - .padding() - .navigationTitle("My watchlist") - .navigationBarItems(leading: - Button(action: { self.userPresentation.wrappedValue.dismiss() }) { - Image(systemName: "multiply") - .resizable() - .frame(width: 25, height: 25) - - } - ) - } - } -} - -struct User_Previews: PreviewProvider { - static var previews: some View { - User() - } -}