How to improve your Swift Code - PART 1 - Swift Coding Best Practices & Style Guide

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

КОМЕНТАРІ • 9

  • @renatapuchbauer1682
    @renatapuchbauer1682 Рік тому

    Awesome content! Very informative and inspiring! Please keep publishing more of these videos! 💯

  • @ImTheShrey
    @ImTheShrey Рік тому +1

    You can instead use something like:
    extenstion Bool {
    func not() -> Bool {
    !self
    }
    }
    Then it will be:
    .disabled(subscription.isActive.not())

  • @muncho404
    @muncho404 2 роки тому

    Thanks for very useful tip avoiding negative statements. Your channel is outstanding.

  • @bobweiram6321
    @bobweiram6321 2 роки тому +2

    The subscription.isActive == true could be shortened to the more readable subscription.isActive. I don't know, however, if you have to explicitly add the operators in Swift.

    • @markaurelius61
      @markaurelius61 2 роки тому

      Me too, I would prefer the shorter version

    • @treboc2942
      @treboc2942 2 роки тому +1

      I find the shorter version more readable, too. I think it reads nearly like a sentence.

  • @deanolium
    @deanolium 2 роки тому

    Nice video. The issues with the implementation of the `isActive` function is a perfect use case for unit testing. Also it's worth noting that the .enabled section is never going to be met, since if the subscription isn't active, then the button won't be rendered due to the `if subscription.isActive` line.

  • @KimbrellBrad
    @KimbrellBrad 2 роки тому

    Love your content but have a hard time watching due to sensitive eyes. Can you please record in Dark Mode going forward? Many people suffer from this problem. Thanks either way! Not to also ignore the fact that the contrast and colors show up so much better when using a dark theme.