SwiftUI Bar Chart with Customizations | Swift Charts

  Рет қаралды 27,934

Sean Allen

Sean Allen

Күн бұрын

Пікірлер: 39
@seanallen
@seanallen 2 жыл бұрын
My iOS Developer Courses - seanallen.teachable.com
@ordazgustavo
@ordazgustavo 6 ай бұрын
My solution for fixing the alignment and missing label in 17:21 is: AxisMarks(values: .stride(by: .month, count: 1)) { AxisValueLabel(format: .dateTime.month(.narrow), centered: true) }
@FloWritesCode
@FloWritesCode 2 жыл бұрын
Great overview! This framework can be a bit overwhelming in the beginning, since it's so customisable.
@seanallen
@seanallen 2 жыл бұрын
Indeed. There is A LOT there. I'm excited to dive into more.
@Neha-oo6jr
@Neha-oo6jr Жыл бұрын
Hi Sean, I have tried these two solution for that last label invisibility issue on x Axis 1. AxisValueLable(format: .dateTime.month(.narrow), multipleAlignment: .centre), 2. AxisValueLable(format: .dateTime.month(.narrow), horizontalSpacing: 10)
@jimscubicle
@jimscubicle Жыл бұрын
The key here is the horizontal spacing. Unfortunately, the spacing is slightly different to center the labels for devices of different widths, or for different orientations.
@TheseEyesSeeDarknessClearly7
@TheseEyesSeeDarknessClearly7 2 жыл бұрын
I wish there was a way to easily press the chart and see the exact number for each month. For when the rough estimate won’t cut it
@seanallen
@seanallen 2 жыл бұрын
This functionality is built into Swift Charts. As I say in the video, this is a pretty deep framework with a lot of customization possibilities.
@andremoi88
@andremoi88 9 ай бұрын
Great video! Do you have any plans to offer a course on Swift charts? I’m struggling to implement tooltips on line charts (display values on touch) and have not found much by way of guidance. Thanks for all the great videos.
@seanallen
@seanallen 9 ай бұрын
I don't have plans for a dedicated course on it. But I plan on implementing charts into the apps I build for larger courses. So it'll be sort of a sub-topic - but won't be dedicated to everything to know about charts.
@MarkFilterDeveloper
@MarkFilterDeveloper Жыл бұрын
Awesome tutorial. Another way you can get the dashed lines in the Legend is by using Path { }. Not sure if this will keep the formatting when I post it. This way, the dashed line will be displayed matching the RuleMark, if you make it dashed like you do in the video. HStack { Path { path in path.move(to: CGPoint(x: 0, y: 7)) path.addLine(to: CGPoint(x: 35, y: 7)) } .stroke(Color.secondary, style: StrokeStyle(lineWidth: 3, lineCap: .round, lineJoin: .round, dash: [3, 10])) .frame(width: 50) Text("Monthly Goal") .foregroundStyle(Color.secondary) .font(.caption) Spacer() }
@WestCoastAce27
@WestCoastAce27 Жыл бұрын
😲 Longtime Objective-C/XCode dev - this may be the video that makes me learn Swift. That’s ridiculously easier. Great job as always.
@KileeKoderLLC
@KileeKoderLLC 2 ай бұрын
Do you have a video or can you point me to one that does it by quarter and not month. 1st quarter Jan 1/2024 - Mar 31/2024 2nd quarter Apr 1/2024 - Jun 30/2024 3rd quarter July 1/2024 - present 4th quarter Oct 1/2023 - Dec 31/2023
@chezchezchezchez
@chezchezchezchez Жыл бұрын
How do you make more than one chart inside the same ForEach?
@comexbackkid
@comexbackkid 2 жыл бұрын
Sean this is dope thank you! By chance, do you know if there is a way to manually set the X Axis scale instead of it just going by the data provided? For example if a chart is displaying monthly values for the current year we're in, & it's only February, the chart would look silly just having two massive bar marks representing January & February. Thanks!
@seanallen
@seanallen 2 жыл бұрын
Hey Chris, yes, I believe you can do this. When you create a custom XAxis (like we do later in this video) you have the ability to pass in a new set of data for that axis. Working with that is how you could recreate this. I don't have the exact code for you, but based on my initial learnings (remember, this is a brand new framework), I believe this is possible. Mainly because your example is such a common use case that it would be a huge oversight for the framework to not support that.
@TheFistRZ
@TheFistRZ 2 жыл бұрын
Very informative video! I was wondering if there is a way to make the charts swipable like they are in Apple's Health app? I have tried to find how to do this but I can't seem to find anyone doing it.
@seanallen
@seanallen 2 жыл бұрын
I believe there is. However, Swift Charts is a brand new framework and I'm only just starting to learn it. Because it's so new, that's why you haven't seen too many deep dives into everything it can do.
@TheFistRZ
@TheFistRZ 2 жыл бұрын
@@seanallen Fantastic! Looking forward to future videos!
@harold_davis
@harold_davis 2 жыл бұрын
🚀 Love it just started playing with this for an app. Great video! 🤘🏾
@seanallen
@seanallen 2 жыл бұрын
It's an awesome framework, isn't it?
@harold_davis
@harold_davis 2 жыл бұрын
@@seanallen It is excellent my intimidation about business ideas flew away when I checked it it.
@stammix
@stammix Жыл бұрын
hi Sean, are Charts a better way to create a weekly calendar than Grids are? with all the possible customizations you show and tease, I imagine a lot of usefull elements for building up a structure like calendars. thanks
@s.tunahanustuntepe2966
@s.tunahanustuntepe2966 Жыл бұрын
Can't find 'Chart' in scope I'm getting an error I wonder how can I solve it?
@seanallen
@seanallen Жыл бұрын
You need to be supporting a minimum of iOS 16 to use Charts. If you are supporting iOS 15, Xcode won't be able to find Charts.
@s.tunahanustuntepe2966
@s.tunahanustuntepe2966 Жыл бұрын
@@seanallen so where can I upgrade to iOS 16 or. Xcode I'm new here
@seanallen
@seanallen Жыл бұрын
It’s tough to describe in the KZbin comments without visuals. If you Google “how to change minimum ios target in Xcode” that should help.
@s.tunahanustuntepe2966
@s.tunahanustuntepe2966 Жыл бұрын
@@seanallen I upgraded to Xcode 14 and chose IOS 16, but I'm getting a wine Can't find "Chart" in scope error. I made Import Charts.I wonder what else could be the problem?
@s.tunahanustuntepe2966
@s.tunahanustuntepe2966 Жыл бұрын
@@seanallen I did what you said, but the same problem continues
@sani21OK
@sani21OK 8 ай бұрын
Thanks
@seanallen
@seanallen 8 ай бұрын
Happy to help :)
@jsedlacekjr
@jsedlacekjr 2 жыл бұрын
Instead of doing the workaround of rotating a diagonal line you could just use a RoundedRectangle
@seanallen
@seanallen 2 жыл бұрын
Yup. Many different ways to do things in SwiftUI
@mkhasson97
@mkhasson97 2 жыл бұрын
Brilliant ❤
@seanallen
@seanallen 2 жыл бұрын
Thanks Mohammad!
@isaacl7782
@isaacl7782 Жыл бұрын
thank sir
@seanallen
@seanallen Жыл бұрын
Happy to help!
@sphericalwave
@sphericalwave Жыл бұрын
🥷
SwiftUI Alerts - Buttons, TextFields, & Passing Errors
13:18
Sean Allen
Рет қаралды 7 М.
NavigationStack - SwiftUI Programmatic Navigation - iOS 16
20:20
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 23 МЛН
Introduction to SwiftCharts: Creating Charts and Graphs in SwiftUI
48:20
How to Make a Card View in SwiftUI - Step by Step for Beginners (2023)
32:02
A Swiftly Tilting Planet
Рет қаралды 11 М.
WWDC24: Swift Charts: Vectorized and function plots | Apple
13:30
Apple Developer
Рет қаралды 3,5 М.
SwiftUI Charts Basics Tutorial
10:00
CodeWithChris
Рет қаралды 11 М.
How To Use SwiftData with Preview | SwiftData Tutorial | #10
26:16
SwiftUI Drag and Drop with Transferable Custom Object
26:33
Sean Allen
Рет қаралды 24 М.
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН