RxSwiftCommunity / RxSwiftCommunity/RxController

Standard inputs and outputs for view model

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
45
Forks
8
Avg merge
2h 44m
Merged PRs (30d)
3

Description

The inputs/outputs model helps to make the data exchanging more standard.
https://github.com/kickstarter/native-docs/blob/master/inputs-outputs.md

Swift

Inputs

All input variables MutableProperty types that are invoked directly when needed from the view. The input setter function will set its appropriate member variable with the appropriate input parameter.

fileprivate let projectTappedProperty = MutableProperty<Project?>(nil)
public func projectTapped(_ project: Project) {
    self.projectTappedProperty.value = project
}

Note that the input variable is named with a Property suffix to clarify that it is a MutableProperty. Its function is the name of the action.

If an input value is void, use the following syntax:

fileprivate let viewDidLoadProperty = MutableProperty()
public func viewDidLoad() {
    self.viewDidLoadProperty.value = ()
}
Outputs

All output variables are Signal types with NoError as the second error parameter.

public let goToDiscovery: Signal<DiscoveryParams, NoError>

Note that Xcode will display an error on your output until it is instantiated in the view model's init(). You may set the output to .empty if you wish to continue without implementing, i.e. for testing purposes.

public let goToDiscovery: Signal<DiscoveryParams, NoError> = .empty

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced inputs-outputs.md specification and inspect the repository's existing view models and their init methods. Determine the intended scope for applying the MutableProperty inputs and Signal outputs conventions, then confirm that the affected view models follow the documented standard and that the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.