# HG changeset patch # User Dennis Concepcion Martin # Date 1628524884 -3600 # Node ID 83585aec70c8a1103dfe85f0d02c251236a48d3f # Parent f7f9067934ef49dee046389403ab84bdfaddb7c9 Update code to the newest version diff -r f7f9067934ef -r 83585aec70c8 Trades/Details.swift --- 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 ) diff -r f7f9067934ef -r 83585aec70c8 Trades/Helpers/Company.swift --- 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 ) diff -r f7f9067934ef -r 83585aec70c8 Trades/Popular.swift --- 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)