SwiftUI Coordinator Pattern: Everything You Need to Know

Поділитися
Вставка
  • Опубліковано 5 лют 2025

КОМЕНТАРІ • 24

  • @rebeloper
    @rebeloper  11 місяців тому +2

    Simplifying SwiftUI Navigation Sheets with Enums 👉 ua-cam.com/video/G-sNeBn2XwM/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @khadykavadim
    @khadykavadim 4 місяці тому

    I'm going to buy your package for navigation. I like how is simple on the implementation, but I would like to know how can we pass data between views?
    I read a comment below about EnviromentObject and heard from the tutorial video that you don't recommend to use associated values for enum, but how can pass data in a viewmodel using your package?
    How can we handle navigation from a viewmodel with your package?

    • @rebeloper
      @rebeloper  4 місяці тому

      Hey there. There are demo Xcode projects with the product where you can learn how to move data between views.
      Next check out AI in Xcode: Elevate Your App Development to the Next Level 👇
      ua-cam.com/video/L7OI_o1IN3A/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

    • @khadykavadim
      @khadykavadim 3 місяці тому

      @@rebeloper Hey. Thanks for the great library.
      I'm following your demo and realized that AppleViewModel initialized once again when any sheet has been presented over the AppleView.
      I think it shouldn't because of StateObject

    • @khadykavadim
      @khadykavadim 3 місяці тому

      Hi Alex. I'm following your example and realized that AppleViewModel init twice when any sheet from the AppleView is presented, but StateObject shouldn't init twice. Any tips how to avoid it?

  • @rostbalanyuk8142
    @rostbalanyuk8142 5 місяців тому

    But what if i want achieve deeplink and popToRoot with a single transition? Is it possible?

    • @rebeloper
      @rebeloper  5 місяців тому

      Yes, that is also possible.
      Next chech out DurationPicker in SwiftUI: Simple & Fast Solution! 👇
      ua-cam.com/video/jMhTwDxuNPk/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @bastienl.2839
    @bastienl.2839 10 місяців тому

    Very nice ! But which approach would you recommend if you need property Injection in your view ?

    • @rebeloper
      @rebeloper  10 місяців тому +1

      Use the @EnvironmentObject
      Shocking: AI Creates Complete iOS App 👇
      ua-cam.com/video/v2lq4B0VMFk/v-deo.html

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

      Absolutely not. @EnvironmentObject is for passing data to a distant view which might not be directly connected to rootView. For general purposes you should pass data through initializer, also for complex case you might pass closure to the initializer parameter, this approach I am not sure how you can do that.

  • @vcastroc
    @vcastroc 8 місяців тому +1

    How to send parameters to other View??

    • @rebeloper
      @rebeloper  8 місяців тому

      My advice is to use Environment Objects: ua-cam.com/video/2D05dGo3jB4/v-deo.htmlsi=YzAkBvjeGwMhcf56
      Next watch SwiftUI Alerts Using Sheets: A More Efficient Implementation Method 👇
      ua-cam.com/video/_xod2ZVrUHk/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

    • @vcastroc
      @vcastroc 8 місяців тому

      @@rebeloper sure, I understand how to use environment object, but that it works in a really big projects ? (Like a HomeBanking)

  • @davidrichardkozikowski6847
    @davidrichardkozikowski6847 6 місяців тому

    So I bought the code, in trying to set it up it looks like to use the push and pop it needs to be included in the setup in the contentView. What I’m trying to do is use a tabView after the welcome screen intro and a successful login happens. I do not want the tab bar showing when these screens are shown.
    Workflow is when app launches it shows intro screen, when it’s dismissed goes to login screen. After successful login. It goes to the Tabbar view( that is shown in your demo project). I have tried many different things but when I try to use the navigation.push(.home) nothing happens.
    So first question does all the SwiftUI views need to be included in the tabView ( like your contentView in your example) to work?
    Thanks

    • @davidrichardkozikowski6847
      @davidrichardkozikowski6847 6 місяців тому

      I have been using NStack, I thought this might be better but it looks like it has limitations. If you could include a login screen that when is dismisses it goes to a tabView that would be great.

    • @rebeloper
      @rebeloper  6 місяців тому

      Have added an example project with TabView and login logic :)
      Have you seen my latest video? 👉 NavigationStack vs. NavigationCoordinator: You Won’t Believe the Difference!
      ua-cam.com/video/7fb7CXty5i4/v-deo.html

  • @anmolrajpalofficial
    @anmolrajpalofficial 9 місяців тому

    99$ too expensive for me. Can you discount?

    • @rebeloper
      @rebeloper  9 місяців тому

      There are some in the description.

  • @AnushkaSamarasinghe-97
    @AnushkaSamarasinghe-97 11 місяців тому +1

    amazing.. thankyou.. can you give it to me free

    • @rebeloper
      @rebeloper  11 місяців тому

      Check the links in the description.
      Next escape the GeometryReader nightmare 👇
      ua-cam.com/video/zf-Qnx4laT4/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

  • @vcastroc
    @vcastroc 8 місяців тому

    HI @rebeloper
    I suggest to enable NavigationStack to iOS 16 or higher in struct struct DestinationLinkModifier: ViewModifier
    @ViewBuilder
    func groupContent(_ content: Content) -> some View {
    if #available(iOS 16.0, *) {
    NavigationStack {
    content
    .navigationDestination(isPresented: $isPresented, destination: destination)
    }
    } else {
    content
    .background(
    NavigationLink(isActive: $isPresented, destination: destination, label: {
    EmptyView()
    })
    )
    }
    }

    • @rebeloper
      @rebeloper  8 місяців тому

      Thanks for the feedback. Unfortunately this will mess up the pop functionality
      Next check out In-App Purchases in SwiftUI: Full Tutorial! 👇
      ua-cam.com/video/Nxq_ildDObE/v-deo.html&ab_channel=Rebeloper-RebelDeveloper