RxController icon indicating copy to clipboard operation
RxController copied to clipboard

RxController storyboard support

Open brcbydr opened this issue 5 years ago • 5 comments

Sorry for disturbing you but this is really urgent for me. Unfortunately I have just now seen your suggestion about Snapkit and I already completed the storyboards.

It is very important for me that how can I initialize my viewcontrollers using storyboards? Is it possible?

Please let me know as soon as possible. Thank you so much!

brcbydr avatar Apr 30 '20 16:04 brcbydr

RxViewController and RxViewModel based on generic class, I do not know how to set a class in the storyboard with such a style ViewController<ViewModel>. Maybe, xib can be supported

lm2343635 avatar Apr 30 '20 17:04 lm2343635

Without generic class, it is possible. Set view model(an IUO property), after initialization of the view controller.

lm2343635 avatar Apr 30 '20 17:04 lm2343635

Thanks for your quick return and it is very good to hear that I don't have to give up on RxController. But I couldn't make it:( How can I define viewmodel for viewcontroller without using generic class? And also navigation ? Could you send me a sample code/url or more detail please?

brcbydr avatar May 01 '20 05:05 brcbydr

With RxController, using storyboard directly is not allowed. Maybe, you can fork it and remove the generic class. Without generic class, you can write as the following

class ViewController {

    private let viewModel: ViewModel!

    override func viewDidLoad() {
         super.viewDidLoad()

        viewModel = ViewModel()
    }

lm2343635 avatar May 03 '20 05:05 lm2343635

In fact, compared to storyboard, I recommend you to use xib. You can load the xib in the init method with RxController With storyboard, the advantages of RxFlow will disappear.

lm2343635 avatar May 03 '20 05:05 lm2343635