Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The property is not passed from the parent to the child #470

Closed
gnori-zon opened this issue Jan 14, 2024 · 1 comment
Closed

The property is not passed from the parent to the child #470

gnori-zon opened this issue Jan 14, 2024 · 1 comment

Comments

@gnori-zon
Copy link

gnori-zon commented Jan 14, 2024

final class Root: BootstrapComponent {
   var child: Child {
      shared { Child(parent: self) }
   }
    var food: Food {
       shared { Food(parent: self) }
    }
}

final class Food: Component<EmptyDependency> {

   var foodVC: FoodVC {
       FoodVC()
   }
}

protocol MyDependency: Dependency {
    var food: Food { get }
}

final class Child: Component<MyDependency> {

    var foodContainer: FoodContainer {
       FoodContainer(vc: dependency.food.foodVC)
    }
}

It should be compiled from the instructions, but it is not.
Outputs: Could not find a provider for (vc: FoodVC)...
Please help me understand what I'm doing wrong.

@gnori-zon
Copy link
Author

upd: I dug around and found the problem, it is necessary to change the access modifier of the property in parent

THIS IS COMPILED

final class Root: BootstrapComponent {
   var child: Child {
      shared { Child(parent: self) }
   }
    public var food: Food {
       shared { Food(parent: self) }
    }
}

final class Food: Component<EmptyDependency> {

   var foodVC: FoodVC {
       FoodVC()
   }
}

protocol MyDependency: Dependency {
    var food: Food { get }
}

final class Child: Component<MyDependency> {

    var foodContainer: FoodContainer {
       FoodContainer(vc: dependency.food.foodVC)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant