The Wayback Machine - https://web.archive.org/web/20201007221333/https://github.com/uber/RIBs/issues/362
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

[iOS] How Uber create a viewable RIB based on UIView not UIViewController ? #362

Open
qhhonx opened this issue Dec 6, 2019 · 3 comments
Open

Comments

@qhhonx
Copy link

@qhhonx qhhonx commented Dec 6, 2019

As documentation mentioned that a RIB can be viewable or viewless, it is found that viewable RIB must be associated with UIViewController. However, I think it is not possible and most viewable RIB should be UIView-based as RIBs framework encouraging us to make reusable and micro components.

As the below image shown, are those viewable RIBs (Confirmation, Location Refinements, Menu) UIViewController based?
image

@qhhonx qhhonx changed the title [iOS] How Uber create a viewable RIB with UIView not UIViewController ? [iOS] How Uber create a viewable RIB based on UIView not UIViewController ? Dec 6, 2019
@dangthaison91
Copy link

@dangthaison91 dangthaison91 commented Dec 19, 2019

My idea is that we can recursive to get parent viewcontroller from a UIView:

extension UIView {
    func findViewController() -> UIViewController? {
        if let nextResponder = self.next as? UIViewController {
            return nextResponder
        } else if let nextResponder = self.next as? UIView {
            return nextResponder.findViewController()
        } else {
            return nil
        }
    }
}

But not sure if actually does Uber team are having UIView with RIB instead of UIViewController.

@kovpas
Copy link
Contributor

@kovpas kovpas commented Jan 7, 2020

All viewable RIBs on the diagram above (Confirmation, Location Refinements, Menu) are UIViewController based.

@Angel-Cortez
Copy link

@Angel-Cortez Angel-Cortez commented Mar 26, 2020

@qhhonx, Why would you like to use a UIView vs. UIViewController? A common misconception in iOS development is that UIViewController needs to represent a single "screen" in application; however, this is not the case. UIViewController can be composed of subsequent child UIViewControllers. These child UIViewControllers can represent something as small as a button. Hence, why it seems why these examples stick to using UIViewControllers instead of UIViews. What's the use case for just using a UIView?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.