Custom Calendar Tallies in SwiftUI

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024

Комментарии • 47

  • @StewartLynch
    @StewartLynch  3 месяца назад +1

    It appears that I made a dumb error on the initializer for the CalendarView where I subtract 1 from the end of the month rather than adding a day.
    init(date: Date, selectedActivity: Activity?) {
    self.date = date
    self.selectedActivity = selectedActivity
    let endOfMonthAdjustment = Calendar.current.date(byAdding: .day, value: 1, to: date.endOfMonth)!
    let predicate = #Predicate {$0.date >= date.startOfMonth && $0.date < endOfMonthAdjustment}
    _workouts = Query(filter: predicate, sort: \Workout.date)
    }

    • @bharned3
      @bharned3 3 месяца назад

      Thanks Stewart

  • @predicked
    @predicked 22 дня назад

    I like the way you organize the folders, sample preview, and ModalType enum; the code structure is so neat.

  • @MikeGranberry
    @MikeGranberry 3 месяца назад

    I just reviewed both videos tonight. I was trying to learn EventKit when I discovered your two videos. Your implementation of displaying how many activities have been recorded on a specific date seems to implement my use case in a much simpler manner. I hope I can replicate your process instead.

  • @SkipKelley56
    @SkipKelley56 7 месяцев назад

    Thank you Stewart. I've enjoyed this set of videos and have learned a lot from all of them. New to Swift, but have been programming databases for 45 years. Nw to the visual front end and you have explained many of the small nuances that have been annoying me. Keep up the great work.

  • @nitramluap
    @nitramluap 7 месяцев назад +1

    Yes, we call the weekend, the weekend because it's the end of the week 😛

  • @cruiseqe2
    @cruiseqe2 7 месяцев назад

    Great set of videos. I already have a couple of uses for this calendar view with counts.

  • @dibjr
    @dibjr 7 месяцев назад

    Thank you, Stewart! Excellent! Great fun! I learned some good techniques!

  • @w0mblemania
    @w0mblemania 7 месяцев назад

    Excellent work again Stewart. Thanks.

  • @tazman7689
    @tazman7689 4 месяца назад

    Stewart great video, I really liked it a lot. I've implemented this is an app I have been redoing for SwiftData. There is one problem that I would love to see an updated video on, only because I've been trying to figure it out for a couple days and nothing works. That is that on an iPad the overlay for the counts doesn't stay on the circle its shifted over to the right quite a bit.
    First thought was try checking the device and orientation and that hasn't produced anything that works. Could you give us a look at how this could be solved.
    Anyway, love the video and all the effort you put into showing us these skills, I learn a lot every time.,

    • @StewartLynch
      @StewartLynch  4 месяца назад

      It looks like I put the overlay in the wrong place. Move the overlay of the count up so that it is overlaying the Circle.

  • @bharned3
    @bharned3 6 месяцев назад

    Great work

  • @OrtoInScatola
    @OrtoInScatola 7 месяцев назад

    Very good starting point for something I need for an app I am working on. I just need to make this scrollable to go to different months and to be able to click on a date to select a date instead of having the picker which seems redundant

    • @StewartLynch
      @StewartLynch  7 месяцев назад +1

      Share your code when you have it.

    • @Bakira05
      @Bakira05 Месяц назад

      Hi, have you figured out a way how to swipe though months?

    • @StewartLynch
      @StewartLynch  Месяц назад

      Unfortunately, I have not had the time to explore this yet.

  • @hemantstha4144
    @hemantstha4144 7 месяцев назад

    thank you

  • @foilhat
    @foilhat 7 месяцев назад

    There's another problem, it's about weekdays naming. You're taking first letters of day names, which is fine for English (SMTWTFS), and works fine for some other locales (for example, for Russian: ПВСЧПСВ, although it's more common to use two letters in Russian: Пн, Вт, Ср, etc.) There's a problem with Chinese, because names for Chinese weekdays are 週一,週二,週三 and so on. 週 means "week", and 一二三 are just numbers, and I think you already see what's the problem here.

    • @w0mblemania
      @w0mblemania 7 месяцев назад

      At that point, you're not talking about full localization.
      After all, if you're going to localize just part of a calendar, you might as well localize everything.
      And, IMO, that should only be done post launch.
      i.e. see if there is a real demand for the app first, before commiting to expensive localization efforts.

    • @foilhat
      @foilhat 7 месяцев назад

      @@w0mblemania I'd argue that "dateFormatter.setLocalizedDateFormatFromTemplate("EEEEE")" will do exactly that, what Mr. Lynch tries to achieve.

    • @nigelgee3576
      @nigelgee3576 7 месяцев назад

      if you add `calendar.locale = Locale(identifier: "zh-CN")` to the 'capitlisedFirstLettersOfWeekday` I would also remove taking the `first` letter too.

  • @georgemalouf4298
    @georgemalouf4298 7 месяцев назад

    Thank you old man. We are tremendously fortunate to catch up with your stuff before your health seriously impedes your productivity. Keep outputting and stay consistent.

    • @OrtoInScatola
      @OrtoInScatola 7 месяцев назад

      can you be any more rude???

    • @georgemalouf4298
      @georgemalouf4298 7 месяцев назад

      @@OrtoInScatola These are unfair accusations. I have never been rude to anyone. I’m just stating facts. I hope people in your capacity wouldn’t take my words out of context.

    • @StewartLynch
      @StewartLynch  7 месяцев назад +1

      In English, calling someone an old man is not the best introduction but not to worry. I may be old, but I am experienced and in good shape. Lots of life left in me yet.

    • @georgemalouf4298
      @georgemalouf4298 7 месяцев назад +1

      @@StewartLynch Accept my humble apologies, Sir. I don’t mean insult or any of that sort. I’m truly not familiar with taboos of your Western culture, and my comment was purely spontaneous.

    • @StewartLynch
      @StewartLynch  7 месяцев назад

      No worries at all George. In the west we just don’t like to admit we are getting old. Thanks for clarification

  • @bharned3
    @bharned3 6 месяцев назад

    any way to add this logic of highlighting the days with the counts with the out of the box date picker (.datePickerStyle(.graphical) ) and/or I can't seem to figure out how to make this calendar scrollable between months --

    • @StewartLynch
      @StewartLynch  6 месяцев назад

      Making it scrollable will be tough because I only load one month at a time. You might want to modify it to load 3 months at a time. The current, previous and next and change that up each time the current month changes. I have not tested it, but in theory, it should work. I am not sure what you mean in the other question re "highlighting the days"

    • @bharned3
      @bharned3 6 месяцев назад

      Thanks @@StewartLynch -- highlighting the days -> What I meant here is I am using the date picker in .graphical mode and wanted to do the same concept of adding the circle count with that calendar. This give e the ability to use the same calendar for also adding new activity with the same calendar. Hope that makes sense. I ll add some months to the original code and see how that works

  • @milanlabus1582
    @milanlabus1582 Месяц назад

    Steward how would make the calendar clickable for example an event tracking app where i want to tap on 3 of the days and mark them yellow to symbolize an event (i.e tapping them turns them yellow)

    • @StewartLynch
      @StewartLynch  Месяц назад

      You could add an onTapGesture to items in the ForEach loop that captures the day and create an event for that day if there isn't one. This will then allow you to change the color of the calendar day. if there is one, you could delete it and that would remove the color

    • @milanlabus1582
      @milanlabus1582 Месяц назад

      @@StewartLynch Wow thank you, your channel is really important to young developers nobody else goes this indepth on topics

  • @gnovation706
    @gnovation706 6 месяцев назад

    Hello Stewart, and how to do Monday first day of the week?

    • @StewartLynch
      @StewartLynch  6 месяцев назад +1

      I have updated the code from the previous viddo to handle the first day of the week to follow the locale. I talk about this and show the update within the first couple of minues of this video. Did you not see that part?

    • @gnovation706
      @gnovation706 6 месяцев назад

      @@StewartLynch Oh, I missed that, thank you

  • @nigelgee3576
    @nigelgee3576 7 месяцев назад

    Great video. I have pick up a few points from these video for my calendar. Just one thing when using Picker do not use “” for label put the title as this will not read in Voice Over and then use modifier .labelHidden.

  • @ВеняГулько
    @ВеняГулько 7 месяцев назад

    Shalom, are you from Israel?

  • @Cook-Genius
    @Cook-Genius 4 месяца назад

    Stewart! thank you so much for this video!
    I had a question regarding the pros and cons of this custom calendar tallies view vs. this video? what are your pros and cons to these methods? UIcalendarView ruclips.net/video/d8KYAeBDQAQ/видео.html
    it seems like the UICalendarView is fairly simplistic, but struggles with customization long term.But prodomenitly works for UIKit. to implement this into SwiftUI seems a little difficult. However, this Custom Calendar Tallies seems to be better for customization is is already for SwiftUI. just more coding for customization. thanks in advance :)