How to use Enums in Swift | Swift Basics #10

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

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

  • @matthew_cramer
    @matthew_cramer 2 дня назад

    Nick is the GOAT! So glad I found him and this channel, it's a great free resource for the New Year. Here is to staying consistent.

  • @ScottSchwartz-Owen
    @ScottSchwartz-Owen 8 месяцев назад +4

    Hoping this comment covers multiple comments for all your Swift videos/playlists - Nick you have an incredible ability to genuinely explain all this for beginners in a way that is easy to assimilate the information AND remember it. The relaxed pace and warm tone of your voice is truly a huge part of that. Other RUclipsrs (who I do appreciate) have a frantic, fast and often not as clearly articulate way of speaking and it's easy to miss important parts of their instruction. Thanks again for your deep dive tutorials into iOS - whether these videos stay free or you introduce another paid course, am a HUGE fan!!

    • @SwiftfulThinking
      @SwiftfulThinking  8 месяцев назад +2

      Thank you Scott! Comments like this are why I keep this content free. Glad the videos help 🤙

  • @rubioo_1419
    @rubioo_1419 5 месяцев назад +2

    Maybe this alternative makes the code even cleaner:
    enum cardBrandOption: String {
    case ford, toyota, honda
    var title: String {
    return self.rawValue
    }
    }

    • @lowlydeveloper3693
      @lowlydeveloper3693 2 месяца назад

      Cool... And to be grammatically correct, this:
      return self.rawValue.capitalized

  • @CMessineo
    @CMessineo 10 месяцев назад

    Doing one or two lessons a day and really enjoying them. However I'm not getting error messages in Xcode. For example, at 13:07, I don't get the helpful "Switch must be exhaustive" message. Do I have to do something to turn on error messages?

    • @dorix439
      @dorix439 10 месяцев назад

      Go to Settings -> General, and make sure you've selected 'Show live issues". This might help

    • @CMessineo
      @CMessineo 10 месяцев назад

      @@dorix439 Thanks for the tip. But, it's already checked.

  • @Rafaglg
    @Rafaglg 10 месяцев назад

    i have read that strings is a value type but the string stores the contents of its characters indirectly on the heap, so if we are creating the struct using the string we are going to create referente to the heap, so what we need to use instead? using string inside the struct is bad ? im confuse, please let me know

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

    Hey Sir,
    Really grateful for the video.
    Besides, I'd like to add a NavigationLink for each enum's case. How can I do that?

  • @rahulchaurasia5011
    @rahulchaurasia5011 Год назад

    Amazing 😀

  • @jameskayten6563
    @jameskayten6563 Год назад

    Per lesson on Enums # 10
    Why is a : used in one set of variables while another just uses the = sign?
    //var car1: CarModel = CarModel(brand: "Ford", model: "Fiesta")
    //var car2: CarModel = CarModel(brand: "Ford", model: "Focus")
    //var car3: CarModel = CarModel(brand: "Toytota", model: "Camry")
    //var car1 = CarModel(brand: brand1, model: "Fiesta")
    //var car1 = CarModel(brand: brand1, model: "Focus")
    //var car1 = CarModel(brand: brand2, model: "Camry")

    • @ShadowSkotone
      @ShadowSkotone Год назад

      Just to specify that car1,2,3 should be specifically of type CarModel and not something else. It's more of a good practice.

    • @jameskayten6563
      @jameskayten6563 Год назад

      So the : specifies while the = does what?@@ShadowSkotone

    • @ShadowSkotone
      @ShadowSkotone Год назад

      @@jameskayten6563 = attributes a value to the variable car1, the value will be of type CarModel, and the value will be an instance of CarModel which has the properties(brand...,model...)

  • @Thomas-Tao
    @Thomas-Tao 2 месяца назад +1

    why not this?
    enum CarBrand: String {
    case ford = "Ford"
    case toyota = "Toyota"
    case honda = "Honda"
    }

  • @jameskayten6563
    @jameskayten6563 Год назад +4

    Yeah, it's really difficult to take in the lesson when you keep changing the content instead of creating new examples. On some level having to figure out what's wrong is educational, but after awhile it's just an obstacle. Following along requires going back in the vid to rewatch critical aspects and this only increases the confusion.

  • @toheeborelope107
    @toheeborelope107 Год назад

    Hello Nick
    Thank you very much for this and for giving me a new focus by watching your videos and I hope there could be some videos that shows how to put these into action in real life by buiding apps.
    Beside on your videos there are always suggestion whenever you want to use an optional I have tried to set this on my xCode but still not showing option. for instance var car1 = carBrand(brand: .ford) I was expecting a suggestion or quick help but is not working.
    If you don't mind if there anyway to contact you please for mentoring