Create a custom line chart to display historical price data | SwiftUI Crypto App #21
Вставка
- Опубліковано 22 сер 2024
- This line chart is going to be one of the highlights of our app. The end product looks awesome (especially in dark mode) and gives the user a visual representation of the coin's price over the last 7 days!
This is one of the more challenging videos in this course because it involves a bit of math and you need to understand the coordinate system of the iPhone. As always, I will try to explain each step we take in detail but don't hesitate to leave a comment if you get confused.
Admittedly, I have not yet covered creating custom shapes and paths in an individual bootcamp video yet! I am planning on doing that soon, but I didn't want that to hold up releasing this entire course.
*** LINKS:
- Downloadable Resources: www.swiftful-t...
- CoinGecko API: www.coingecko....
- CoinModel API: api.coingecko....
- Market Data API: api.coingecko....
- Coin Detail API: api.coingecko....
- Buy Me A Coffee: www.buymeacoff...
Next video: • Build an expandable / ...
Last video: • Display downloaded dat...
🤙 WELCOME BACK 🤙
WEBSITE: www.swiftful-t...
DISCORD: / discord
GITHUB: github.com/Swi...
SAY THANKS: www.buymeacoff...
This guy never stop's helping me . greatest tutor on this platform fr
I can't find a word to describe this video just waaow. this charts section is my favorite part in this app
This chartview looks absolutly amazing. Thank you so much for creating this course and the other courses. If I have money left, I will definitely buy you some coffees!
😂 haha thanks!
Super cool, I would've never thought of this logic to convert numbers into graph. Thank you bro.
This was amazing and it looks freaking incredible in dark mode
This one is really nice Nick! Had to wrestle with my animation a bit then found that I failed to change the 1.0 to "percentage" in the .trim(from 0.0, to: 1.0) statement (just in case others are having trouble). My oversight!
But all of the math here was well-explained and will be useful in making other charts in our projects. Thanks again Nick!
I've made the same mistake in the past haha
@@SwiftfulThinking This was driving me nuts - couldn't get animation working. On the "Trim" statement, autocompletion had made it "Trimmed" - I didn't catch it until I read this comment... Thanks guys! Getting close to buying another coffee!
Best stock chart I ever seen on mobile device. Thanks for the tutorial!
Thanks Nick, i really appreciate your efforts and you are really amazing man
This was amazing and it looks very cool
super cool!
🙃
Dark mode😘. Awesome tutorial 👌
good job !!
Pretty cool, Nick
Don't beat yourself up on the math. I guess a 10 year old should be able to do the math inside this lesson. The app is getting nicer each lesson. Time to wrap things up if you ask me. ;-) Thanks again!
Hahaha glad you understood!
That's looks great~~~ I love it.
Your tuts are appreciated
Line drawing animation starts at 33:50
Just amazing.
I know you are.
Amazing!
Hi, Nick. I'm really grateful to you for making a crypto app. I have a question. Preview is well drawn. but, run it as a simulator, chart is not drawn.. Where should I look? Is it related to three value points that are displayed as 0 in the chart, although the date is displayed?
Awesome. Thank you!
Thanks Anday!
Hi Nick, there is a new Charts library introduced to Swift in WWDC 2022, is there any chance you create a course of using that library to make a chart like this one?
did you try it?
great video.
Amazing!!! Thank you so much 😀
Thanks Andres!
Great work
Nick, thanks for the great lesson!
I have a problem with the shadows. When the path is animating I have the only one shadow. And when the animation is finished all the others appear. Did anyone face the same problem and maybe find out how to fix it?
i got the same problem. do you figure out the reason of this problem
bro, i found a solution of this problem, just add .clipped() before all shadows
it's not a fix like crutch but it's work
.shadow(color: lineColor.opacity(0), radius: 10, x: 0.0, y: 10)
.shadow(color: lineColor.opacity(1), radius: 10, x: 0.0, y: 10)
.shadow(color: lineColor.opacity(0.5), radius: 10, x: 0.0, y: 10)
.shadow(color: lineColor.opacity(0.2), radius: 10, x: 0.0, y: 20)
.shadow(color: lineColor.opacity(0.1), radius: 10, x: 0.0, y: 30)
1 line ignore the animation for some reason, but 2 the same line working. If you just make the first line transparent, the behavior of the second line will change. If some body know the reason of this behavior, please tell me.
@@vladyslavsushko1967 Your fix works fine for me! Thanks :)
@Nick Mate you're a beast! Plane beast! I've watched your whole series and I can say, this is an impressing teaching right here! I'll like to know, of course if you're willing to do it and explain how you can do a "update scenario from v1.0 to v1.5" for an app and if it's the same for macOS Apps and iOS Apps. I'm new to programming and I'm not shame to say it xD. Thanks alot and god bless you.
And yea, forgot to say, of the app is not present in the App Store but it's a legit one and needs an update system, like a update button or some any other stylish way of pushing the latest version to a client.
This is a bit hard to explain over comments haha. You basically need to update the version/build number and then push it. I'm planning to do a playlist to cover this, along with Git practices, but it wont be for a little while!
@@SwiftfulThinking Awesome! Don't worry, at least from my part I'm just at my first interaction with code what so ever hehe. I never coded but somehow I find swift/swiftui very very pleasing and your channel is amazing! Love to way you present, teach and really trying to keep everything as professional as possible! You're simply a freaking beast!
One suggestion: where we determine lineColor I suggest >= so we do not color a zero movement in red. Small issue likely never comes up over 7 days unless the crypto is dormant.
Yea haha that makes a lot of sense lol I think the red might look cooler though?
This is awesome
Love it!
When Nick is changing variables up top to private at the end you can use multiline edit: CONTROL + SHIFT arrow keys up or down, then type private. Magic.
Very useful comments, thank you 😀
So cool 😎
Hi Nick, thaks a lot.
One questions to fully understand - for example ETH is -4,51(minus), but graph is green - end is higher then start. What exactly mean -4,51% (what period is calculated for that result?)
your a beast!
respect!
it's a great technique. How can I achieve interactive part and show line while draging?
how can i you show respective value in graph when someone hover over it?
what is the recommend way if my app is not code by swiftUI can use only the chart section as different module
Sir, this is crypto app so what's your favorite cryptocurrency? Where is your coin address :D ? Maybe one day one of us will sent you some coins to thank you for your big teaching. I hope I can apply iOS position for the next two months. Btw thank you again.
Hahaha I love all the coins! I have a whole bunch in my portfolio, recently doing a lot of research on AMP and SOL. I haven't posted my address, but I accept tips on my Buy Me A Coffee :) I think they will start accepting crypto soon! What's your favorite? www.buymeacoffee.com/nicksarno
@@SwiftfulThinking
yup I believe that crypto is the next chapter of digital asset and monetary freedom. I'm holding BTT.
@@SwiftfulThinking SOL did surge during this last 7 month a couple of time and huge increase, I hope you were on board!
@@TuanAnhLe-ef9yk BTT Holding it for a long time but it makes me depressed when I look at its chart :)))
the chart don't seem to work for me
Preview is running correct, but in the simulator I don't get the chart. What are I do'ing wrong?????
Hey Stefan, sorry to hear this. Did you figure it out?
@@SwiftfulThinking yes found a misspelling in the API, everything working now.
A VStack appeared at 21.24