changeset 12:83585aec70c8

Update code to the newest version
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Mon, 09 Aug 2021 17:01:24 +0100
parents f7f9067934ef
children 1356de50cff3
files Trades/Details.swift Trades/Helpers/Company.swift Trades/Popular.swift
diffstat 3 files changed, 13 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/Trades/Details.swift	Thu Aug 05 15:35:19 2021 +0100
+++ b/Trades/Details.swift	Mon Aug 09 17:01:24 2021 +0100
@@ -29,24 +29,14 @@
                                     .fontWeight(.semibold)
                                     .padding()
                                 
-                                let data = randomDataManager.create()
-                                let lineChartStyle = LineChartStyle(
-                                    labelColor: Color(.systemBlue),
-                                    indicatorPointColor: Color(.systemTeal),
-                                    showingIndicatorLineColor: Color(.systemBlue),
-                                    flatTrendLineColor: Color(.systemTeal),
-                                    uptrendLineColor: Color(.systemGreen),
-                                    downtrendLineColor: Color(.systemRed)
+                                LineChartView(
+                                    lineChartController:
+                                        LineChartController(
+                                            prices: randomDataManager.create(),
+                                            dragGesture: true
+                                        )
                                 )
-                                
-                                LineChartView(
-                                    data: data,
-                                    dates: nil,
-                                    hours: nil,
-                                    dragGesture: true,
-                                    style: lineChartStyle
-                                )
-                                .padding(.bottom)
+                                    .padding(.bottom)
                             }
                             ,alignment: .leading
                         )
--- a/Trades/Helpers/Company.swift	Thu Aug 05 15:35:19 2021 +0100
+++ b/Trades/Helpers/Company.swift	Mon Aug 09 17:01:24 2021 +0100
@@ -37,24 +37,9 @@
                     
                     Spacer()
                     
-                    let data = randomDataManager.create()
-                    let lineChartStyle = LineChartStyle(
-                        labelColor: Color(.systemBlue),
-                        indicatorPointColor: Color(.systemTeal),
-                        showingIndicatorLineColor: Color(.systemBlue),
-                        flatTrendLineColor: Color(.systemTeal),
-                        uptrendLineColor: Color(.systemGreen),
-                        downtrendLineColor: Color(.systemRed)
-                    )
-                    
-                    LineChartView(
-                        data: data,
-                        dates: nil,
-                        hours: nil,
-                        dragGesture: false,
-                        style: lineChartStyle
-                    )
-                    .padding(.bottom, 5)
+                    let prices = randomDataManager.create()
+                    LineChartView(lineChartController: LineChartController(prices: prices))
+                        .padding(.bottom, 5)
                 }
                 , alignment: .leading
             )
--- a/Trades/Popular.swift	Thu Aug 05 15:35:19 2021 +0100
+++ b/Trades/Popular.swift	Mon Aug 09 17:01:24 2021 +0100
@@ -28,26 +28,11 @@
                         }
                         .padding(.trailing)
                         
-                        let data = randomDataManager.create()
-                        let lineChartStyle = LineChartStyle(
-                            labelColor: Color(.systemBlue),
-                            indicatorPointColor: Color(.systemTeal),
-                            showingIndicatorLineColor: Color(.systemBlue),
-                            flatTrendLineColor: Color(.systemTeal),
-                            uptrendLineColor: Color(.systemGreen),
-                            downtrendLineColor: Color(.systemRed)
-                        )
-                        
                         Spacer()
                         
-                        LineChartView(
-                            data: data,
-                            dates: nil,
-                            hours: nil,
-                            dragGesture: false,
-                            style: lineChartStyle
-                        )
-                        .frame(width: 150)
+                        let prices = randomDataManager.create()
+                        LineChartView(lineChartController: LineChartController(prices: prices))
+                            .frame(width: 150)
                         
                             Text("\(company.price, specifier: "%.2f")")
                                 .fontWeight(.semibold)