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

UIRefreshControl being displayed before view appears #239

Open
tcezario opened this issue Aug 23, 2022 · 0 comments
Open

UIRefreshControl being displayed before view appears #239

tcezario opened this issue Aug 23, 2022 · 0 comments

Comments

@tcezario
Copy link

tcezario commented Aug 23, 2022

Hi,
I've been trying to implement a UIRefreshControl and bind it to an Action:

refreshControl.rx.bind(to: viewModel.action, inputTransform: { _ in })

This is being done in the init of the view and before the view appears the action method is executed to populate some info.
The issue is that whenever this screen is opened the refresh control is shown at the top before disappearing after the action finishes executing. This only happens when the view is instantiated and displayed, navigating back to it doesn't trigger this behavior. Executing on viewDidAppear also doesn't give this issue.

override public func viewWillAppear(_ animated: Bool) {
        self.viewModel.action.execute()
        super.viewWillAppear(animated)
    }

Declaration of the viewModel with the action:

let action: Action<Void, ServiceResponse>

...

public init(...) {
        ...
        getCartAction = Action {
            repository.getInfo()
                .asObservable()
        }
       ...
}

This is happening on both iPhone and Simulator.

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