Skip to content

UIRefreshControl being displayed before view appears #239

@tcezario

Description

@tcezario

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions