changeset 421:9b7af8e83d12

Change intraday prices model
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 12 Jun 2021 15:20:04 +0200
parents 523b780ad892
children a38e8acccb85
files LazyBear.xcodeproj/project.pbxproj LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate LazyBear/Global Models/IntradayPricesModel.swift LazyBear/Views/Global Helpers/Extensive List/ExtensiveList.swift LazyBear/Views/Global Helpers/StockItem.swift LazyBear/Views/Global Helpers/StockRow.swift LazyBear/Views/Home/Networking/HomeResponse.swift LazyBear/Views/Profile/Networking/ProfileResponse.swift
diffstat 8 files changed, 11 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/LazyBear.xcodeproj/project.pbxproj	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear.xcodeproj/project.pbxproj	Sat Jun 12 15:20:04 2021 +0200
@@ -56,7 +56,6 @@
 		958A735225E0170900FD7ECA /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 958A735125E0170900FD7ECA /* CloudKit.framework */; };
 		9594331326691789004A0339 /* Bazooka in Frameworks */ = {isa = PBXBuildFile; productRef = 9594331226691789004A0339 /* Bazooka */; };
 		9594F0402651355B00CFA8D4 /* HistoricalPricesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9594F03F2651355B00CFA8D4 /* HistoricalPricesModel.swift */; };
-		95A07F5D26305A8F009865AA /* IntradayPricesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A07F5C26305A8F009865AA /* IntradayPricesModel.swift */; };
 		95A07F6226305A9B009865AA /* CurrencyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A07F6126305A9B009865AA /* CurrencyModel.swift */; };
 		95A07F6C26305AC6009865AA /* QuoteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A07F6B26305AC6009865AA /* QuoteModel.swift */; };
 		95A07F7126305AD5009865AA /* SectorPerformanceModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A07F7026305AD5009865AA /* SectorPerformanceModel.swift */; };
@@ -165,7 +164,6 @@
 		958A734E25E016FD00FD7ECA /* LazyBear.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LazyBear.entitlements; sourceTree = "<group>"; };
 		958A735125E0170900FD7ECA /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; };
 		9594F03F2651355B00CFA8D4 /* HistoricalPricesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoricalPricesModel.swift; sourceTree = "<group>"; };
-		95A07F5C26305A8F009865AA /* IntradayPricesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntradayPricesModel.swift; sourceTree = "<group>"; };
 		95A07F6126305A9B009865AA /* CurrencyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyModel.swift; sourceTree = "<group>"; };
 		95A07F6B26305AC6009865AA /* QuoteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuoteModel.swift; sourceTree = "<group>"; };
 		95A07F7026305AD5009865AA /* SectorPerformanceModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectorPerformanceModel.swift; sourceTree = "<group>"; };
@@ -317,7 +315,6 @@
 			children = (
 				954D7EA5260BBA6600A13C50 /* WatchlistCompany+CoreDataClass.swift */,
 				954D7EA6260BBA6600A13C50 /* WatchlistCompany+CoreDataProperties.swift */,
-				95A07F5C26305A8F009865AA /* IntradayPricesModel.swift */,
 				95A07F6126305A9B009865AA /* CurrencyModel.swift */,
 				95A07F6B26305AC6009865AA /* QuoteModel.swift */,
 				95A07F7026305AD5009865AA /* SectorPerformanceModel.swift */,
@@ -773,7 +770,6 @@
 				952045152610C7C600A76362 /* ConvertEpoch.swift in Sources */,
 				95BD2FAE26341BD1008B6752 /* TextfieldAlert.swift in Sources */,
 				95CCFB60266E864C00C384A1 /* ConvertStringToDate.swift in Sources */,
-				95A07F5D26305A8F009865AA /* IntradayPricesModel.swift in Sources */,
 				95A07F7626305AE3009865AA /* TradingDatesModel.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/LazyBear/Global Models/IntradayPricesModel.swift	Fri Jun 11 13:02:18 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-//
-//  IntradayPricesModel.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 21/4/21.
-//
-
-import SwiftUI
-
-struct IntradayPriceModel: Codable {
-  var open: Double
-}
--- a/LazyBear/Views/Global Helpers/Extensive List/ExtensiveList.swift	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear/Views/Global Helpers/Extensive List/ExtensiveList.swift	Sat Jun 12 15:20:04 2021 +0200
@@ -10,7 +10,7 @@
 struct ExtensiveList: View {
     var listName: String
     var list: [String: QuoteModel]?
-    var intradayPrices: [String: [IntradayPriceModel]]?
+    var intradayPrices: [String: [Double]]?
     var latestCurrencies: [String: CurrencyModel]?
     var addOnDelete: Bool
     
--- a/LazyBear/Views/Global Helpers/StockItem.swift	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear/Views/Global Helpers/StockItem.swift	Sat Jun 12 15:20:04 2021 +0200
@@ -15,7 +15,7 @@
 struct StockItem: View {
     var symbol: String
     var company: QuoteModel
-    var intradayPrices: [IntradayPriceModel]?
+    var intradayPrices: [Double]?
     var orientation: OrientationView
     var hidePriceView: Bool?
     
@@ -43,7 +43,7 @@
     static var previews: some View {
         StockItem(
             symbol: "AAPL", company: QuoteModel(changePercent: 0.03, companyName: "apple inc", latestPrice: 130.3),
-            intradayPrices: [IntradayPriceModel(open: 130.3), IntradayPriceModel(open: 132.3)], orientation: .horizontal
+            intradayPrices: [130.3, 132.3], orientation: .horizontal
         )
     }
 }
@@ -52,7 +52,7 @@
 struct VerticalStockRow: View {
     var symbol: String
     var company: QuoteModel
-    var intradayPrices: [IntradayPriceModel]?
+    var intradayPrices: [Double]?
     
     var body: some View {
         RoundedRectangle(cornerRadius: 20)
@@ -93,7 +93,7 @@
                     
                     Spacer()
                      
-                    if let prices = intradayPrices?.compactMap { $0.open } {
+                    if let prices = intradayPrices {
                         LineChartView(data: prices, dates: nil, hours: nil, dragGesture: false)
                             .padding(.vertical)
                             .clipShape(RoundedRectangle(cornerRadius: 20))
@@ -109,7 +109,7 @@
 struct HorizontalStockRow: View {
     var symbol: String
     var company: QuoteModel
-    var intradayPrices: [IntradayPriceModel]?
+    var intradayPrices: [Double]?
     var hidePriceView: Bool
     
     var body: some View {
@@ -127,7 +127,7 @@
             
             Spacer()
             if !hidePriceView {
-                if let prices = intradayPrices?.compactMap { $0.open } {
+                if let prices = intradayPrices {
                     LineChartView(data: prices, dates: nil, hours: nil, dragGesture: false)
                         .frame(width: 80)
                         .padding(.vertical, 10)
--- a/LazyBear/Views/Global Helpers/StockRow.swift	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear/Views/Global Helpers/StockRow.swift	Sat Jun 12 15:20:04 2021 +0200
@@ -11,7 +11,7 @@
 struct StockRow: View {
     var listName: String
     var list: [String: QuoteModel]
-    var intradayPrices: [String: [IntradayPriceModel]]?
+    var intradayPrices: [String: [Double]]?
     var addOnDelete: Bool
 
     @State private var showExtensiveList = false
@@ -64,7 +64,7 @@
         StockRow(
             listName: "Gainers",
             list: ["AAPL": QuoteModel(changePercent: 0.03, companyName: "Apple Inc", latestPrice: 130.3)],
-            intradayPrices: ["AAPL": [IntradayPriceModel(open: 130.2)]], addOnDelete: false
+            intradayPrices: ["AAPL": [130.2]], addOnDelete: false
         )
     }
 }
--- a/LazyBear/Views/Home/Networking/HomeResponse.swift	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear/Views/Home/Networking/HomeResponse.swift	Sat Jun 12 15:20:04 2021 +0200
@@ -8,7 +8,7 @@
 import SwiftUI
 
 struct HomeResponse: Codable {
-  var intradayPrices: [String: [IntradayPriceModel]]?
+  var intradayPrices: [String: [Double]]?
   var latestCurrencies: [String: CurrencyModel]?
   var lists: ListsModel?
   var sectorPerformance: [SectorPerformanceModel]?
--- a/LazyBear/Views/Profile/Networking/ProfileResponse.swift	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear/Views/Profile/Networking/ProfileResponse.swift	Sat Jun 12 15:20:04 2021 +0200
@@ -8,7 +8,7 @@
 import SwiftUI
 
 struct ProfileResponse: Codable {
-  var intradayPrices: [String: [IntradayPriceModel]]?
+  var intradayPrices: [String: [Double]]?
   var quotes: [String: QuoteModel]?
   
     private enum CodingKeys : String, CodingKey {