12 Replies
      Latest reply on Jul 10, 2019 3:40 PM by KMT
      Mat_16 Level 1 Level 1 (0 points)

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

        • Re: Calendar
          Claude31 Level 8 Level 8 (6,585 points)

          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.

            • Re: Calendar
              Mat_16 Level 1 Level 1 (0 points)

              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.

                • Re: Calendar
                  Claude31 Level 8 Level 8 (6,585 points)

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

                    • Re: Calendar
                      Mat_16 Level 1 Level 1 (0 points)

                      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.

                        • Re: Calendar
                          Claude31 Level 8 Level 8 (6,585 points)

                          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/

                            • Re: Calendar
                              Mat_16 Level 1 Level 1 (0 points)

                              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.

                    • Re: Calendar
                      godiegogo Level 1 Level 1 (0 points)

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

                      • Re: Calendar
                        KMT Level 9 Level 9 (14,825 points)

                        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.

                          • Re: Calendar
                            Mat_16 Level 1 Level 1 (0 points)

                            Yes, I checked it, but I don’t understand how to actually put it in my viewController.

                              • Re: Calendar
                                KMT Level 9 Level 9 (14,825 points)

                                     >I don’t understand how to

                                 

                                What did you try, what did you expect, what happened, how those differ. Show any errors or warnings.

                                 

                                Have you made any apps at all, of any type, or is this about not knowing the tools and where to start? Did you spend time studying the HIGs?

                                  • Re: Calendar
                                    Mat_16 Level 1 Level 1 (0 points)

                                    What I don’t understand is that I see that there is a struct called Calendar but I don’t know how to put it in the code.

                                      • Re: Calendar
                                        KMT Level 9 Level 9 (14,825 points)

                                        Did you apply your curiosity and use any of the linked examples to see if they show you how?

                                         

                                        Example:

                                        class ViewController: UIViewController, FBSDKLoginButtonDelegate {
                                        
                                        override func viewDidLoad() {
                                            super.viewDidLoad()
                                        
                                            struct fbDemographics {
                                                static var relationship_status: String?
                                                static var gender: String?
                                                static var user_education_history: String?
                                                static var user_location: String?
                                                static var email: String?
                                                static var name: String?
                                            }