Skip to content

Refactor SearchScreen #14

@rafsanjani

Description

@rafsanjani

You can improve SearchScreen by applying the following;

  • Do not pass the ViewModel object down to its children. Instead, extract the data you need from the ViewModel and pass those data along.
  • Make all other functions in SearchScreen private to prevent namespace pollution.
  • ObserveCurrentTime is quite misleading because it does more than just time observation. It also emits UI components.
  • You are exposing Mutable data types from your ViewModel to the public. Normally, you would want your ViewModel to only expose states to the UI. The sequence of UI->VM usually goes along these lines;
    UI: Observes state from the VM
    UI: Invokes a function from the VM
    VM: Performs an operation
    VM: Updates a state internally and publishes to subscribers
    UI: Receives new state updates and refreshes components accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions