SwiftUI: Facebook Complex Layouts - Horizontal Scroll View

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

КОМЕНТАРІ • 167

  • @hailahong3021
    @hailahong3021 5 років тому +2

    This is the only channel that does advanced things. Other channels are just for beginners. Hope you doing well.

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому +6

      True, I find it much more interesting to talk about real world problems and not intro bs.

  • @TreyCox1
    @TreyCox1 5 років тому +12

    I can't thank you enough for these videos, Brian. THANK YOU.

    • @maxcodes
      @maxcodes 5 років тому

      Brain is a code god

    • @maxcodes
      @maxcodes 5 років тому

      Brian*

  • @xxfkee
    @xxfkee 5 років тому +1

    I understand Apple is enfin catching up with coding style and philosophy of our visionary teacher Brian which I am now somehow accustomed to after having finished Brian's several video tutorials. No wonder I feel very comfortable with SwiftUI. Merci beaucoup!

  • @cappuccinopapi3038
    @cappuccinopapi3038 4 роки тому

    Just watching this could have saved me a couple of days

  • @serkanm1365
    @serkanm1365 5 років тому +1

    u re the best of swift world. when i search on internet to "swift ui" and everywhere ur videos. thanks

  • @CuriosMindDIY
    @CuriosMindDIY 5 років тому +29

    we'll need a tutorial on making a network request and displaying data and images, please! Thank you for this tutorial we're catching up very quickly on the new framework!

    • @donathmm3881
      @donathmm3881 5 років тому

      Yess

    • @Aaron-dt3xz
      @Aaron-dt3xz 5 років тому

      If you want to make a network request and display stuff, what I've been doing is using an loading all of the data in the SceneDelegate asynchronously with an @EnvironmentObject that I pass into the root view in the SceneDelegate. You can then do conditional checks and stuff in your views so that you can display something while the content loads. There's a good tutorial on EnvironmentObjects here: www.hackingwithswift.com/quick-start/swiftui/how-to-use-environmentobject-to-share-data-between-views
      Once you get the hang of it, SwiftUI is certainly WAY easier to do stuff like this in than UIKit.

    • @donathmm3881
      @donathmm3881 5 років тому

      @@Aaron-dt3xz I have to pass .environmentObject Everytime I present a next screen if I don't do it my app crashes

    • @Aaron-dt3xz
      @Aaron-dt3xz 5 років тому

      Donat Hmm If you pass .environmentObject in the SceneDelegate then you shouldn’t have to do it for every view.

    • @donathmm3881
      @donathmm3881 5 років тому

      @@Aaron-dt3xz I have done it but still crashes. Maybe because of the beta

  • @talldane2538
    @talldane2538 5 років тому

    These complete App build-out's this early are fantastic!

  • @piyushsharma1638
    @piyushsharma1638 5 років тому

    Wow, roller coaster ride of development, loved it.

  • @w0mblemania
    @w0mblemania 5 років тому +1

    Keep up the great work Brian. Your efforts are much appreciated. Please say hello to Professor Brains.

  • @30guarino
    @30guarino 5 років тому +5

    Your “Rough around the edges” is like my feeling of accomplishment when I get no errors lol

  • @TwoTwenty8LLC
    @TwoTwenty8LLC 5 років тому +2

    If I didn’t go through your course, I would be totally lost. Now, looking at how you built this app, I can see that using your tools, swiftui is very simple. -Patrick

    • @Justgoodvids
      @Justgoodvids 5 років тому

      TwoTwenty8 LLC your videos should use distinguishing thumbnails

  • @justcallmemarly
    @justcallmemarly 5 років тому +15

    Could you make a tutorial on using the TabbedView ?

  • @vipullal7689
    @vipullal7689 3 роки тому

    Always the best! Thanks for this video.

  • @himshikhargayan
    @himshikhargayan 5 років тому +13

    In case the "identified by" is not working -
    ForEach(posts, id: \.id) { post in
    Text(post.propertyName)
    }

    • @bossomc
      @bossomc 5 років тому

      I found that case. It changed "ForEach(posts, id: \.self) { Text($0) }" good luck :)

    • @govindpathak2486
      @govindpathak2486 4 роки тому +1

      Apple has changed the syntax below is the correct syntax -->
      ForEach(users , id: \.id ){
      user in
      UserRow(user: user)
      }

  • @graywire
    @graywire 4 роки тому

    Thanks Alot, It was really Helpful. I just did a small modification and moved Text("trending") before top vstack to have it while scrolling.

  • @giuseppecapoluongo4510
    @giuseppecapoluongo4510 5 років тому

    Nice work! I'm working on SwiftUI and was stuck with the image issue you mentioned at min 23:00! Thanks, keep doing this kind of videos, we appreciate!

  • @damienissa
    @damienissa 5 років тому +1

    18:25
    Hi Brian. About padding make sense to use
    Text("Some text").padding([.leading, .trailing], 12)
    or
    Text("Some text").padding(.horizontal, 12)

  • @chemamaldonado8511
    @chemamaldonado8511 5 років тому

    Man keep that work! You are the best at swift tutorials in the platform. Highly recommended 🙌🏻

  • @esyx6476
    @esyx6476 5 років тому +8

    Hi Brian, I believe you can you use .edgesIgnoringSafeArea() function on the VStack instead of -20 padding :)

  • @girishadapa90
    @girishadapa90 5 років тому

    Awesome no words ... NYC explanation ...

  • @swiftprogrammer8972
    @swiftprogrammer8972 5 років тому +20

    I just followed this tutorial and my scrollview wouldn't scroll till i added ScrollView(.horizontal), like this. Just posting in case anyone encounters the same problem

    • @areola_ayatollah
      @areola_ayatollah 5 років тому +1

      Thank you! How did you figure that out?

    • @anirup.patnaik
      @anirup.patnaik 5 років тому +1

      Even I did struggled on the same and then ended up discovering that

    • @swiftprogrammer8972
      @swiftprogrammer8972 5 років тому

      @@areola_ayatollah I just thought maybe because i was not specific with the kind of scroll direction i wanted so i implemented that

    • @asankasudesh900
      @asankasudesh900 4 роки тому

      thanks for amazing tutorial.i can't see these replies

    • @SuperMarucca
      @SuperMarucca 4 роки тому

      if you don't want scroll indicators set ScrollView like that: ScrollView(.horizontal, showsIndicators: false)

  • @mattheaney729
    @mattheaney729 5 років тому

    Great tutorial! SwiftUI is such a massive game changer for iOS dev! Thanks Brian! 😁

  • @timmy334
    @timmy334 5 років тому

    Great video! I'm loving SwiftUI and will probably roll with it full time since I'm just getting into real apps. Thanks!

  • @SwiftySanders
    @SwiftySanders 5 років тому

    Great video Brian!!! Thanks again.

  • @romulolobo9493
    @romulolobo9493 5 років тому +4

    ForEach syntax changed a little bit in newer versions of swift, its causing an error on tutorial code... New syntax:
    ForEach(posts, id: \.self) { post in
    Text(post)
    }

  • @marcaupont9145
    @marcaupont9145 5 років тому

    Another great one Brian!

  • @mintchocolove4485
    @mintchocolove4485 5 років тому +1

    I found some codes are not working in my XCode.
    Here is my revision.
    1.
    ForEach(Range, id: \.self) { }
    Or, insert
    let id = UUID() in struct Post: Identifiable
    2.
    Text("blah blah").color(.primary) is not working.
    Instead, use Text("blah blah").foregroundColor(.primary)

  • @MrSwisyn
    @MrSwisyn 5 років тому

    Definitely a great tutorial! Keep that good work up.

  • @armaandhanji2112
    @armaandhanji2112 5 років тому +3

    Hey Brian will this layout work on an iPad screen? Or do we need to do make special accommodations so it looks good on an iPad too? Love your channel

  • @owenmoore3782
    @owenmoore3782 5 років тому

    Awesome stuff Brian!

  • @maxcodes
    @maxcodes 5 років тому

    resizable() gives you a similar effect to clipped. Well, it resizes it instead of clipping it. But either way, makes it smaller. UPDATE: Just got to the point in the video where you decide to use resizable.

  • @marcx3827
    @marcx3827 5 років тому

    Hey Brian! First of all , thanks for your afford doing all this amazing tutorials. I also studied the new SwiftUI tutorial, and maybe this modifier helps you to ignore the "Safe Areas" instead of using the padding. The modifier is ".edgesIgnoringSafeArea(.top)" in your case .leading. I couldn't try it yet. greets from Germany

  • @RodLandaeta
    @RodLandaeta 5 років тому +2

    Hey mate, commenting out just to let you know the `.padding(.leading, -20)` can be done by `.listRowInsets(EdgeInsets())` or just `insets(EdgeInsets())` which is a better approach

  • @kenn850
    @kenn850 5 років тому +1

    Quick question is this not Apple's Version of flutter

  • @tonytonystache
    @tonytonystache 4 роки тому +1

    In order to be able to scroll the "ScrollView" you must ad a ".horizontal" so it looks like this
    ScrollView(.horizontal){
    }

  • @mmcanhaoable
    @mmcanhaoable 4 роки тому

    Awesome video

  • @luiswoldu
    @luiswoldu 4 роки тому

    Right next to "ScrollView {" I get the error "Generic parameter 'Content' could not be inferred". Google has no answer to fix this. What can I do?

  • @koustav2008
    @koustav2008 5 років тому

    Excellent Tutorial !!!

  • @SuperMarucca
    @SuperMarucca 4 роки тому

    Hi Brian, for correct dynamic aspect ratio of the Post Image I set the frame of the image in PostView struct like that: .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .leading) and the padding of VStack like this: .padding(.init(top: 0, leading: -20, bottom: -8, trailing: -20))... This work perfect for me, is this the right way? THX

  • @masbro1901
    @masbro1901 5 років тому

    amazing... you are my best teacher. *thumbs up

  • @hectormejia499
    @hectormejia499 5 років тому +5

    am I the only who finds swift ui code really messy? its still cool though, just rough on the eyes

  • @davidclawson6776
    @davidclawson6776 5 років тому

    I just completed this, and had to make a couple changes to get it all to fit: The "post_puppy" image needed to have the addition of ".aspectRatio(contentMode: .fit)", and also had leading padding of zero and trailing padding of -20.

  • @syedaurangzaib3861
    @syedaurangzaib3861 5 років тому

    Superb man 👏🏽👏🏽👏🏽

  • @uttamsahu6965
    @uttamsahu6965 5 років тому

    Awesome 👍 no words

  • @Tristan-zr6gf
    @Tristan-zr6gf 5 років тому +1

    Super cool tutorial. Q: all the images are „somewhat hard coded“. How would this work if you had i.e. 3 users, they upload a picture and as you pull down the feed, it updates and shows the new posts. Surely one would also hook it up to firebase or so, but a tutorial on that in swiftUI would be super cool 🤙🤓📱🤩

  • @danbird8114
    @danbird8114 4 роки тому

    How do you get the background color of a list to change?

  • @KDChenStudio
    @KDChenStudio 5 років тому +1

    Great tutorial!
    Is there a way to set the List as a horizontal style instead? Back in old days an UICollectionView would do the job, but how do we do that with SwiftUI?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому +1

      I'm sure we'll get a horizontal list view when SwiftUI hits release.

    • @KDChenStudio
      @KDChenStudio 5 років тому +1

      @@LetsBuildThatApp Nice, can't wait. I can see that we will no longer need RxCocoa framework once SwiftUI + Combine dominates the developer community.....haha very exciting.

  • @timmy334
    @timmy334 5 років тому

    Could you include passing data between views and using Firebase using SwiftUI in a future video, please?

  • @glennadams7047
    @glennadams7047 5 років тому

    Great tutorial. Thanks

  • @shiju861
    @shiju861 5 років тому

    NavigationLink is not working for me, If i used top header. Could you please add NavigationLink in this video? Like to display detail screen. Thanks in advance!!

  • @mevanslondon
    @mevanslondon 5 років тому

    Hi Brian. If you were just starting to develop a new app, would you download the beta Xcode, wait for the final release, or develop with UIKit and refactor to SwiftUI further down the road? Also, I noticed you upgraded to the new OS X on your old machine but not the new one. How risky is installing the new OS at this point and who would you recommend could do that? Thanks, your tutorials are fantastic.

  • @АлексйУваровъ
    @АлексйУваровъ 5 років тому

    Awesome. Thank you.

  • @benhwang6378
    @benhwang6378 5 років тому

    Nice tutorial! thanks man !

  • @ialtoobi
    @ialtoobi 5 років тому

    Thanks Brain 👍🏼

  • @anthonygiannini7767
    @anthonygiannini7767 5 років тому

    So can consumers like add post to this app? Like normal Facebook?

  • @aaronhawkins3722
    @aaronhawkins3722 5 років тому

    Thanks Brian

  • @mohamedemad1172
    @mohamedemad1172 5 років тому

    .renderingmode(.original) don't work why?

  • @LeviKline
    @LeviKline 5 років тому

    This is such a great video. With SwiftUI I know you can make cross platform apps, but could you use original Swift in addition to it for things like a normal for loop and still make the app cross platform? Or does it have to conform only to SwiftUI?

  • @Zerocool37
    @Zerocool37 5 років тому

    nice tutorial!

  • @sunithabalasubramanian4817
    @sunithabalasubramanian4817 4 роки тому

    In scrollView, the scrolling is not working-
    ScrollView(.horizontal, showsIndicators: false) {
    Hstack{
    //code
    }
    }

  • @waynezong8418
    @waynezong8418 5 років тому

    SwiftUI is amazingly powerful. Thanks Brian! But I'm wondering how you can specify the snappy horizontal collection view behavior like we did before by using SwiftUI? It looks to me like a separate layout file from the actual coding part of an app by far.

  • @pastpianist
    @pastpianist 5 років тому

    For the scrollview portion though, you lose all the cell recycling capabilities right? Or is SwiftUI smart enough to not render until it shows even in ScrollView()?

  • @SMC247
    @SMC247 5 років тому +1

    Coding with this seems to feel like coding using React Native... Although, I've not actually used it yet as could not install the new Xcode yet.

  • @ChrisKiix
    @ChrisKiix 5 років тому

    Great work so far with SwiftUI! The auto completion is sooo annoying !!! I’m struggling to get a Tabbar to work correctly (TabbedView) do you have any experience with it? I followed the WWDC video “SwiftUI essentials” and its not working for me 😬😬 they also use a View that is currently not available in the Beta “Form”? Greets from Stuttgart Germany! Love your content!

  • @mobilestar6575
    @mobilestar6575 5 років тому

    Hello, Thanks again for your video.
    Is "var body: some View " must to have when declaring new view?
    And How can we implement MVMM or MVC model when we use SwiftUI?
    Regards.

  • @EimantasK
    @EimantasK 5 років тому

    Nice video! Thank you : )

  • @vikkaalfyorova
    @vikkaalfyorova 5 років тому

    I got an error value of type '[String]' has no member 'identified' with ForEach (6:23). Just change to ForEach(posts, id: \.self) they changed it in Xcode 11 Beta 5 and above

  • @russellwarwick
    @russellwarwick 4 роки тому

    Anyone know how to make the horizontal ScrollView maintain it's scrolled position. When you scroll down the ScrollView resets it's position. Any help would be awesome :)

  • @michaziobro5301
    @michaziobro5301 5 років тому

    It is compatible with old storyboard approach? Can I mix them both somehow, or is it totally independent?

  • @ashokmurthy7831
    @ashokmurthy7831 4 роки тому

    In XCode 12.2 "NavigationButton" has been deprecated.
    Use "NavigationLink" instead, as follows :
    NavigationLink(destination: GroupDetailView) {
    GroupView()
    }
    Thanks for a great tutorial.

  • @jamescampbell2822
    @jamescampbell2822 4 роки тому +1

    NavigationButton has changed too, "NavigationLink"

  • @droid6298
    @droid6298 4 роки тому

    sir how can we pick videos from picker
    help me plz

  • @SlehyderMartinezM
    @SlehyderMartinezM 5 років тому

    Could you make a video of why hackintosh? is that I am struck by the theme of an original Mac or a hackinstosh.

  • @ckwcfm
    @ckwcfm 5 років тому

    Wondering how to make a multi column collectionView with Swift UI.

  • @maheshnallabothula609
    @maheshnallabothula609 5 років тому

    Could you make a tutorial on CollectionView kind of Grid which is inherit from UIViewRespresentable and When tap on that collectionviewcell need to navigate to some other swiftUI view.Thanks in advance.

  • @ghanshyamdoifode9479
    @ghanshyamdoifode9479 4 роки тому

    Thank you so much

  • @shivakittusamy5560
    @shivakittusamy5560 5 років тому

    I would really like some sign in with Apple tutorial

  • @oscargidefjord848
    @oscargidefjord848 5 років тому

    Please guide us how how use firebase (crud) with this!

  • @2019RS3
    @2019RS3 4 роки тому

    Out of curiosity can you do a Firebase video?

  • @mohammedzee2416
    @mohammedzee2416 5 років тому

    Many thanks 🙏🏼

  • @arsalanhashemi4469
    @arsalanhashemi4469 5 років тому

    hey brian ,
    why you didn’t use ScrollView(.horizontal , showsIndicators: false){}

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      Its up to you how you want to customize your view.

  • @AgentCell
    @AgentCell 5 років тому

    Hey Brian I asked this question in a previous video but is there a difference in RAM usage between the live preview and simulator? Is it less with the live preview?

  • @yeilmusic
    @yeilmusic 5 років тому +2

    idk , how this work with landscape.

  • @clivegoransson4992
    @clivegoransson4992 5 років тому

    i notice navigationbutton has now changed to navigationlink which automatically adds an annoying arrow, this ruins the look of your sample app somewhat

  • @kidrainen01
    @kidrainen01 5 років тому

    This was something I struggled with.. how is it possible to have a collection view that displays users post, but above the collection view it displays a horizontal view with different user profiles to follow or something like that?

    • @kidrainen01
      @kidrainen01 5 років тому

      I haven’t updated to the Xcode 11 beta yet too.

  • @nizz4m
    @nizz4m 5 років тому

    you are awesome.

  • @Fabio-rg9nv
    @Fabio-rg9nv 5 років тому

    I’m on beta 4 and I‘m working on a similar layout as your „Trending“ view (horizontal scrollbar with clickable images that open a new view). NavigationButton is deprecated and replaced with NavigationLink. But my issue is that when I use NavigationLink for the individual images in a list element, the images are not clickable. But what happens is that the List item where the horizontal scrollbar is in, gets clickable. I think it‘s a bug because I‘m using the same code as in one of Apple‘s tutorials. Does the same happen to you? Is there a decent workaround so my app at least works for now?

  • @denniswhite6779
    @denniswhite6779 5 років тому

    intereseting... so deque is gone?? if so does that mean that all the rows are created at run time regardless of their display?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      I assume the lists treats the repeating row as a cell internally.

  • @ashwynkhandelwal4525
    @ashwynkhandelwal4525 5 років тому

    Are you going to post an updated instagram clone video for swiftUI?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      Might retire that course to make another much better course when SwiftUI is official.

  • @VishnuVijayan96
    @VishnuVijayan96 5 років тому

    How to have a condition inside the body? in case if I want to hide an Image if I don't have URL

    • @creejohnson
      @creejohnson 5 років тому

      Try this: Image(user.imageName == "" ? "avatar" : user.imageName)
      .resizable()
      .clipShape(Circle())
      .overlay(Circle().stroke(Color.black, lineWidth: 2))
      .frame(width: 80, height: 80)

  • @liant9314
    @liant9314 4 роки тому

    Hi Brian, could you please make a SwiftUI tutorial on 'Integrating Wordpress Posts and Send Push Notification whenever new posts are publish on the Wordpress website'?

    • @LetsBuildThatApp
      @LetsBuildThatApp  4 роки тому +1

      Where's the documentation for that?

    • @liant9314
      @liant9314 4 роки тому

      ​@@LetsBuildThatApp Thanks so much for the reply. There is no documentation for it, it's just my wish. I've a Wordpress site and want to create IOS app for it and achieve my first comment. Thank you

  • @HisMajesty99
    @HisMajesty99 5 років тому +1

    You make me wanna learn SwiftUI rn lol

  • @nickng8069
    @nickng8069 5 років тому

    When I click on Assets Catalog, xcode crashes everytime. Anyone else has/had this problem?

  • @Aussienicko
    @Aussienicko 5 років тому

    .identified no longer works, what is the new code, does anyone know?

  • @raulcattelan4506
    @raulcattelan4506 4 роки тому +1

    to remove separator line
    struct ContentView: View {
    let posts = ["1","2","3"]
    //to remove the separator line from list of posts
    init() {
    // To remove only extra separators below the list:
    UITableView.appearance().tableFooterView = UIView()
    // To remove all separators including the actual ones:
    UITableView.appearance().separatorStyle = .none
    }
    var body: some View {

  • @robindelaater9353
    @robindelaater9353 5 років тому

    Beginner Swift IOS development course?

  • @lamtrankhanh6406
    @lamtrankhanh6406 5 років тому

    Thanks!

  • @michaelstamper5434
    @michaelstamper5434 5 років тому

    Does anyone know how to do webview in SwiftUI

  • @aliakkawi4759
    @aliakkawi4759 5 років тому

    Awesome

  • @lallimann8952
    @lallimann8952 5 років тому

    Hey, we were planning to launch a app after ios13 launch. And some backend classes are ready. We are using firestore for login and our database. We have to start writing code in july after ui design, what would you recommend? Storyboard or swiftui. And if storyboard , how difficult it would be to use swiftui after that.

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому +1

      I personally haven’t used storyboards for 4 years. Swiftui is up and coming but I wouldn’t refactor entire codebases until maybe a year after release.

    • @lallimann8952
      @lallimann8952 5 років тому +1

      Lets Build That App so what should i do, start building app in old way and refactor code base next year when its out of its beta phase.?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому +1

      Refactors easy and you have to do it anyways in a year.

    • @lallimann8952
      @lallimann8952 5 років тому

      Lets Build That App Thanks, i will do it in old way. It would be helpful if you upload a tutorial on this topic. “Change storyboard to swiftui”.😬