Calendar

Hi, is there a way to implement a calendar in Xcode? (I can’t). I am pretty new at this. Thanks, Mateo.

Replies

Yes there is, of course.


But you question is too vague, the only answer is "code it", which is probably not what you expect.


So, could you tell what is the first point you don't know how to solve ?

Have you already started to write some code ?


If you google "swift create calendar app", you will find a lot of tutorials.

The thing is that I am trying to do a calendar in which each day square shows the date and the things planned for that day (like in google calendar), but I don’t know what UI element to use for this. If you have the answer, please tell me.

The calendar could be a collectionView. Each cell could contain a tableView, or a textView to store the appointments of the day.

Try JTAppleCalendar framework, you can customize it to fit your needs

Quoting myself from your original thread, same topic:

-=-

See: https://developer.apple.com/documentation/foundation/calendar


And for examples:

h ttps://iosexample.com/tag/calendars/


Note the HIGs can help you better understand which layouts/APIs fit which UI, etc. I highly recommend you spend time w/them.

Actually that’s what I tried, but when creating the functions that define the number of cells and the content of each cell I can’t do all those functions for each tableView in only one ViewController.

You should define a custom CollectionViewCell, with the tableView inside. So, you know which tableView you refer to for a given cell in Collection.


The tableView should probably have a fixed number of rows (the number of periods you want in a day: 12 or 24 or 48 if each quarter for 12 hours).


Otherwise, the number of rows could be computed, depending on how many events you have in calendar/

Thanks. This is my last question and I leave you in peace. So, should I define 30 custom UICollectionViewCells? And, what is a “custom” CollectionViewCell? I am really new. Thanks, Mateo.