edonv / CalendarView

SwiftUI wrapper for UICalendarView.
https://swiftpackageindex.com/edonv/CalendarView/documentation/calendarview
MIT License
2 stars 1 forks source link

Add a sample documentation to use this wrapper in SwiftUI #1

Closed peterpoliwoda closed 3 months ago

peterpoliwoda commented 3 months ago

Hi there @edonv, would you mind writing a simple how to use section here please? I'm new to Swift and UIKit is this ghost from the past that I knew I will inevitably hit but your package might actually save the day.

peterpoliwoda commented 3 months ago

Actually, if you think this is a good start it would help the newbies 🙂. Thanks! https://github.com/edonv/CalendarView/pull/2

edonv commented 3 months ago

Hi Peter! Thanks for this. I'll take a look at your PR. But for what it's worth, the goal of this package is to be able to use UIKit's UICalendarView without needing to use or know any UIKit. I'll work on something for now and get back to you!

edonv commented 3 months ago

You also can check out this file for an example I made for testing. This could be useful until I've finished the documentation example.

peterpoliwoda commented 3 months ago

Awesome. Thanks @edonv. This helps. I think it would be great to also add some decorators that can do something along the lines of

.decoration(date, CustomView)

or something like that.

I'll show you what's I've built already. This is a simple streak view for elements I've written to my SwiftData store. Each entry has an associated created on date attribute. I'd like to show a blue circle 🔵 when there's an entry of type morning and a purple circle 🟣 if there's one on the evening. Showing both if there's both. This is a sample I have now:

image

UIKit is something I've never come across before and my SwiftUI is pretty new (about 2 weeks into it now and loving it but still quite a newbie when it comes to pure iOS in general). Assuming I know backgrounds, for loops, foreground colours, tints, etc is ok but the actual "here's how to display an item in the calendar" is still something that is voodoo magic to me 🙂. I think yours is my first external library I've needed to use for my project so... this is going to make history.

edonv commented 3 months ago

Thanks for all the input. I've just finished writing up detailed documentation. It's accessible in the GitHub repo's README, as well as an article bundled in the package. Once the package is added to your project using Swift Package Manager in Xcode (File > Add Package Dependencies... > paste the repo url into the search bar), you can Build Documentation (Product > Build Documentation), then access the article. ALSO, once it's updated (it happens automatically, so it could take up to 24 hours), it'll be found on Swift Package Index as well. Once that's updated, I'll link to it from the GitHub repo. Good luck! 🫡

peterpoliwoda commented 3 months ago

Amazing stuff. Thanks so much @edonv!

edonv commented 3 months ago

@peterpoliwoda Take a look here at the updated documentation: https://swiftpackageindex.com/edonv/CalendarView/0.2.1/documentation/calendarview Here's the article: https://swiftpackageindex.com/edonv/calendarview/0.2.1/documentation/calendarview/calendarview+howto