Relative Content

Tag Archive for iosswiftswiftuiswiftcharts

Get widget accent color on bar marks for Swift Chart

I am currently trying to update my apps widgets to support iOS 18’s tinted Home Screen customization option. For that I am trying to apply .widgetAccentable() where needed. However, I encounter an issue when it comes to Swift Charts.

SwiftCharts extra line running through the bottom of line charts

I have 2 line charts in SwiftCharts that show the user’s time asleep and total time in bed. When you first see the chart, it looks normal, but when you click on the different buttons (they are NavigationLinks) a random curved line comes at the bottom of it. It also appears when clicking on the toolbar items.

timestamp as string convert to Date for swiftui

I have data that returns a timestamp. I want to stride through these dates every 3 days – something like this. The issue is that the data I have is a string but I need it to be a Date object for the purpose of the chart. Can anyone advise the best way to approach this?

SwiftUI charts – only show RuleMark below plotted line

I am having some issues with Swift charts. I have the following Chart which has RuleMark. As you can see from the screenshot below the RuleMark extends the length of the screen. I am attempting to only show the mark below the line. Something like this question is asking. If any further clarity is required let me know. The code is below.