Custom SwiftUI Calendar

Поділитися
Вставка
  • Опубліковано 30 вер 2024

КОМЕНТАРІ • 38

  • @tomross4599
    @tomross4599 2 місяці тому

    Your date helpers should be 6 lines, not 17:
    static var capitalizedFirstLettersOfWeekdays: [String] { Calendar.current.veryShortStandaloneWeekdaySymbols
    }
    static var fullMonthNames: [String] { Calendar.current.monthSymbols
    }
    Typical ChatGPT being a blabbermouth.

    • @StewartLynch
      @StewartLynch  2 місяці тому

      Whatever works for you, Thanks for your contribution.

  • @andrejkling3886
    @andrejkling3886 7 місяців тому +1

    Awesome lessons Stewart… 🔥💯 thank you

  • @bharned3
    @bharned3 3 місяці тому

    I just noticed for June 29, 2024 and 30, 2024 this is not displaying the counts. Have you noticed this?

    • @StewartLynch
      @StewartLynch  3 місяці тому

      I will have to check

    • @bharned3
      @bharned3 3 місяці тому

      @@StewartLynch It is actually on your other one where you added setupCounts - Trying to debug now to see if I can figure it out

    • @StewartLynch
      @StewartLynch  3 місяці тому

      It is a dumb error on my part. I will pin a comment with the fix

    • @bharned3
      @bharned3 3 місяці тому

      @@StewartLynch You rock.. Was not expecting a response so quickly

  • @m_pa_p
    @m_pa_p 2 місяці тому

    Thank you Stewart, great tutorial!

  • @stevelang-y8m
    @stevelang-y8m 4 місяці тому

    Thanks for the video Stewart, i have an anomaly when using a start of week other than a sunday, if i set monday as a start day, scrolling along to September, or October 2024 misses the first day of the month from the view.
    I think it's coming from this function: var firstWeekDayBeforeStart: Date
    startOfMonthWeekday - Self.firstDayOfWeek causes issues if startOfMonthWeekday is less than Self.firstDayOfWeek.
    I've amended my version to:
    let numberFromPreviousMonth = startOfMonthWeekday < Self.firstDayOfWeek ? (startOfMonthWeekday + 7) - Self.firstDayOfWeek : startOfMonthWeekday - Self.firstDayOfWeek
    This works for any week day start , thanks for the inspiration

    • @StewartLynch
      @StewartLynch  4 місяці тому

      I believe my final source code also has fixed this issue.

  • @ArchangelMichael94
    @ArchangelMichael94 6 місяців тому

    Great content, this is exactly what I was looking to learn how to do

  • @markgeorge4202
    @markgeorge4202 7 місяців тому +1

    Why didn't you use the new Date.formatted()?

    • @StewartLynch
      @StewartLynch  7 місяців тому

      At what point of the video are you referring to

    • @markgeorge4202
      @markgeorge4202 7 місяців тому

      4:59, when defining fullMonthNames@@StewartLynch

    • @markgeorge4202
      @markgeorge4202 7 місяців тому

      at 4:59@@StewartLynch

    • @StewartLynch
      @StewartLynch  7 місяців тому +2

      @@markgeorge4202 I am not sure that you can get that level of granularity with the formatted options. I could be wrong, but I stuck with what I was most familiar with. I will have to explore the formatted option more. Would love to see what you come up with as an alternative though if you care to share.

  • @w0mblemania
    @w0mblemania 7 місяців тому

    Excellent Stewart. Thanks!

  • @PeterWitham
    @PeterWitham 7 місяців тому

    Fantastic, thanks to you and Sean for this.

  • @emadsiddiq2040
    @emadsiddiq2040 7 місяців тому

    Great tutorial! Looking forward to the next one.

  • @danielcrompton7818
    @danielcrompton7818 7 місяців тому

    When are you going over the basics like $ bindings, \.self etc. I’m a beginner to SwiftUI!!

    • @StewartLynch
      @StewartLynch  7 місяців тому

      You might want to check out my video on that topic ua-cam.com/video/EuAGDhJpUN0/v-deo.html

  • @bharned3
    @bharned3 6 місяців тому

    Thanks for the video. I watch Sean also. I noticed when I add it to my app and view on my phone the Sun - Sat are all bunched together and you cant read.. What did I miss? Almost like it is to big for my screen

    • @StewartLynch
      @StewartLynch  6 місяців тому

      No idea. Can you compare to the source code?

    • @bharned3
      @bharned3 6 місяців тому

      I copied and pasted from your project only added a zstack- to change the background- let me debug some more.

  • @drmucahiderdogan
    @drmucahiderdogan 6 місяців тому

    Thank you again for this great tutorial!
    19:00 I believe you can check if two dates are in the same day with the following function:
    Calendar.current.isDate(_ date1: Date, inSameDayAs: Date)

    • @StewartLynch
      @StewartLynch  6 місяців тому

      Doesn’t this also mention that the time has to be the same too? A Date has a time so if you are matching two dates it will also compare the time of that date

    • @drmucahiderdogan
      @drmucahiderdogan 6 місяців тому

      @@StewartLynch No, it only returns true if the two dates are equal in terms of day (eg. March 12th).
      print(date1)
      print(date2)
      let bool = Calendar.current.isDate(date1, inSameDayAs: date2)
      print(bool)
      Output 1:
      2024-03-13 19:23:00 +0000
      2024-03-12 19:23:15 +0000
      false
      Output 2:
      2024-03-12 15:23:00 +0000
      2024-03-12 19:23:15 +0000
      true

    • @StewartLynch
      @StewartLynch  6 місяців тому

      @@drmucahiderdogan Excellent. Good to know. Thanks for sharing

    • @drmucahiderdogan
      @drmucahiderdogan 6 місяців тому

      @@StewartLynch We thank you for sharing these great content. 🙏🏻

  • @tessalimbeek1074
    @tessalimbeek1074 7 місяців тому

    how can i have the week start at Monday instead of sunday

    • @StewartLynch
      @StewartLynch  7 місяців тому +1

      Thank you so much for brining this to my attention. I have updated the source code for the completed project (link in the description). I have updated the Date+Extension to accommodate for different weekday starts.

    • @tessalimbeek1074
      @tessalimbeek1074 7 місяців тому

      @@StewartLynchperfect thank you so much

  • @ankeecodeverse
    @ankeecodeverse 7 місяців тому

    🫶🫶

  • @poppastillplaying
    @poppastillplaying Місяць тому

    Great video @stewart I am getting the following error with XCODE 15.4 "Static method 'buildExpression' requires that 'Text' conform to 'TableRowContent'". This error appears after "if day.monthInt != date.monthInt { Texr("")". Can you or anyone help me fix this error?

    • @StewartLynch
      @StewartLynch  Місяць тому

      Do you see that with my code?

    • @poppastillplaying
      @poppastillplaying Місяць тому

      @@StewartLynch no sir I do not. However even if I copy your text into my files I still get the error. I seem to be getting it when I ad in the current date display. I remove 'Date.now.startOfDay == day.startOfDay ? .red.opacity(0.3) :' and everything works except the current date.