From b2760a2339cbd6143c136307dbb114dc1e350410 Mon Sep 17 00:00:00 2001 From: Johannes Kreutz Date: Sat, 1 Oct 2022 00:36:05 +0200 Subject: [PATCH] Fix compile issues with Charts v4 --- MensaGuthaben/Views/Helpers/ChartsContainer.swift | 9 ++++----- MensaGuthaben/Views/SettingsView.swift | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/MensaGuthaben/Views/Helpers/ChartsContainer.swift b/MensaGuthaben/Views/Helpers/ChartsContainer.swift index e901bdd..09482a7 100644 --- a/MensaGuthaben/Views/Helpers/ChartsContainer.swift +++ b/MensaGuthaben/Views/Helpers/ChartsContainer.swift @@ -3,7 +3,7 @@ // MensaGuthaben // // Created by Johannes Kreutz on 24.09.19. -// Copyright © 2019 - 2020 Johannes Kreutz. All rights reserved. +// Copyright © 2019 - 2022 Johannes Kreutz. All rights reserved. // // This file is part of MensaGuthaben. // @@ -61,8 +61,7 @@ struct ChartsContainer: UIViewRepresentable { } // Create and configure chart data set let dataSet: LineChartDataSet = LineChartDataSet(entries: entry, label: "balance history") - let data: LineChartData = LineChartData() - data.addDataSet(dataSet) + let data: LineChartData = LineChartData(dataSet: dataSet) data.setDrawValues(true) dataSet.colors = [UIColor.systemBlue] dataSet.setCircleColor(UIColor.systemBlue) @@ -73,7 +72,7 @@ struct ChartsContainer: UIViewRepresentable { guard let gradient = CGGradient.init(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: gradientColors, locations: [1.0, 0.0]) else { return } - dataSet.fill = Fill.fillWithLinearGradient(gradient, angle: 90.0) + dataSet.fill = LinearGradientFill(gradient: gradient, angle: 90.0) dataSet.drawFilledEnabled = true dataSet.label = "Test" // Setup formatter @@ -88,7 +87,7 @@ struct ChartsContainer: UIViewRepresentable { } -class ChartFormatter: NSObject, IValueFormatter { +class ChartFormatter: ValueFormatter { func stringForValue(_ value: Double, entry: ChartDataEntry, dataSetIndex: Int, viewPortHandler: ViewPortHandler?) -> String { return String(format: "%.2f", value).replacingOccurrences(of: ".", with: ",") diff --git a/MensaGuthaben/Views/SettingsView.swift b/MensaGuthaben/Views/SettingsView.swift index 871dfc5..bf94b2a 100644 --- a/MensaGuthaben/Views/SettingsView.swift +++ b/MensaGuthaben/Views/SettingsView.swift @@ -3,7 +3,7 @@ // MensaGuthaben // // Created by Johannes Kreutz on 24.08.19. -// Copyright © 2019 - 2021 Johannes Kreutz. All rights reserved. +// Copyright © 2019 - 2022 Johannes Kreutz. All rights reserved. // // This file is part of MensaGuthaben. // @@ -84,7 +84,7 @@ struct SettingsView: View { //NavigationLink("settings.addmy", destination: AddCanteenView()) } Section(header: Text("settings.about")) { - TextRow(title: "© 2019 - 2021 Johannes Kreutz.\nAlle Rechte vorbehalten.\nVersion \(appVersion) Build \(getBuildString())\n(compiled \(getCompileTimeString()))") + TextRow(title: "© 2019 - 2022 Johannes Kreutz.\nAlle Rechte vorbehalten.\nVersion \(appVersion) Build \(getBuildString())\n(compiled \(getCompileTimeString()))") NavigationLink("settings.legal", destination: LegalView()) } Section(header: Text("OPEN SOURCE"), footer: Text("Made with ❤ and some code on the 🚂 between Marburg and Darmstadt.")