How to use Subscripts in Swift | Advanced Learning #32

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

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

  • @colbymehmen
    @colbymehmen Год назад +1

    Hey great videos, one thing i noticed was you said `You can only have one subscript for each type you are injecting`, because you aren't passing parameters. You actually can have parameters for subcripts example => `public subscript (safe index: Index?) -> Element? {`, but surprisingly enough, still limits limits yo to one subscript per type. Just thought i'd share.

    • @SwiftfulThinking
      @SwiftfulThinking  Год назад +1

      Oh man I did not realize that 😅 thanks for the comment. I’ll pin this so others can see it!

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

      @@SwiftfulThinking You were ultimately still right, it still limits you to one even with the parameter label. Really enjoy the vids! Thanks

  • @khaneja
    @khaneja Год назад +1

    Just wanted to say you and your work is awesome. Count me as a fan Nick!

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

    Amazing video once again Nick! You really are my favorite Swift/SwiftUI resource :)

  • @elaidzhashchukin7268
    @elaidzhashchukin7268 11 месяцев назад

    Thank u, Nick :)

  • @Jonathan.B
    @Jonathan.B 7 месяцев назад

    I don't know if something has changed, but if I put in an Int subscript, I get no crash and it uses my version. I checked by using if index == atIndex - 1 which gives me an array with subscripts starting at 1. (XCode 15.3, iOS 17.4)