Size Classes - SwiftUI - Adopt Landscape Example

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

КОМЕНТАРІ • 45

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

    Good to see you back in "Teaching Mode" once again ..🙂 Thanks for the video..

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

      Good to be back. More to come!

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

    Thanks for some great ideas on how to improve an app by reacting to the layout and having separate views for both orientations. Thanks Sean!

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

    Demystified the whole SizeClasses topic, Thanks Sean!

  • @NotBob223
    @NotBob223 11 місяців тому +1

    @Sean Allen, you might want to mention that the iPhone considers upside down portrait to be NOT Portrait (in your code, "I'm Landscape"). It would be good to do a follow on to show us how to either lock it into one orientation or deal with the upside down case as well. Love your style.

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

    Thanks! Like your teaching style ))
    Looks so simple but important.

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

      Glad you enjoyed it, Maxim!

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

    that's it?! THANKS A LOT FOR MAKING MY LEARNING JOURNY A LOT EASIER!!

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

      Yup. Of course, building the proper UI can be tricky if it's complex. But detecting size classes is relatively simple.

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

      @@seanallen i understand building the proper UI can be tricky, but still!! Super easy and encourages me to keep going 💪🏼

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

      Happy to help!

  • @WattsnabbAB
    @WattsnabbAB 9 місяців тому +1

    Thanks man you doing it really good and easy to understand for a newbe =)

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

    What I really, REALLY love bout your teaching style, is that you show WHERE the information comes from in the docs and how to use them. I’ve written over a dozen apps in the App Store but I always struggle reading the Apple developer documentation. I can’t begin too say how grateful I am for this teaching style. ❤ Would you explore how to tell the difference between pro max vs regular iPhone though?

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

      Thanks for the kind words, Zoe 😀. When using size classes alone, there's no way to tell the difference (unless the phone is in landscape). There's a way to determine which device specifically, but it's pretty involved and you have to update it every year as new devices come out. But you can read about that here - stackoverflow.com/questions/26028918/how-to-determine-the-current-iphone-device-model

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

      @@seanallen Thank you so much! You're a wonderful member of the  Dev Community.

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

    I was waiting for it long, thank you lots.

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

      Hope you enjoyed it!

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

    Thank you Sean

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

      Happy to help, Christian.

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

    This was really helpful, thanks Sean!

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

      Glad it was helpful, Anup 😀

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

    I had to do 4 apps but worked thanks dude!

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

      Happy to hear it helped, Bertha!

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

    Very visual and to the point. Thank you Sean 💯

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

      Glad you enjoyed the video style, Joe 👍

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

    Great Video as always Sean!

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

    Great video, Sean. Keep it up the good work. 👍

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

    Great video as usual!

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

      Thanks for the support, Maegan!

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

    Hi again Sean, may I just ask one more question? Is this the CORRECT way to do this for iOS 16+? I ask because I've just had a WWDC 23 SwiftUI Tech lab and they said I must NOT use conditionals, size classes and 'UIScreen.main.trait...' stuff in my Views because I'm breaking 'IMPLICIT IDENTITY' So is this method in your video the new 'correct' way to do all this? Thanks so much, in advance.

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

    How does the isLandscape variable change? I thought that a variable had to be @State if it changes in the view.

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

      @Environment variables work like @State. So when the @Environment var changes, it triggers a UI update. isLandscape is a computed property, so it gets computed each time we use it (which happens when the UI redraws)

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

    I might be missing something but im on an IPad and when I present a hostingController as modalPresentationStyle set to .formSheet with hostingController.preferredContentSize = Some cgsize. The containing swift UI view always gets the horizontalSizeClass as .compact. Any idea?

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

    I loved the video and explanations. I wish to ask a question: how can I rearrange my interface elements depending on orientation (landscape or portrait)? Where can I find some code about this? Thank you very much.

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

    Great tuts

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

    Nice!

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

    Wow! Thanks a lot! You're awesome :) New like & sub

  • @benno-kress
    @benno-kress 2 роки тому

    Thanks for your concise video! To advance on that topic: how would you go about differentiating between iPad in Portrait and Landscape since they're both regular/regular size classes? In my case I have a quadratic content view element that should fill the whole height pushed to the left in landscape and the whole width pushed to the bottom in portrait while filling the empty area with designated illustrations. What I'm doing right now is using a Geometry Reader on the full window and combining that information with the size classes, but maybe you know an easier way, prefferably without the Geometry Reader ...

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

    Why does the iPad only have regular when landscape space is much larger and alters the layout!? What were apple thinking?! Surely there should be compact, regular and large?!