Skip to content

Recipes

James Barr edited this page Dec 12, 2017 · 2 revisions

We've written some recipes that demonstrate how to solve common problems with Artist. Read through them to learn about how everything works together. Cut-and-paste these examples freely; that's what they're for.

Perform an Action OnClick

Use the ArtistRxConfig object's processTap to perform an action whenever a View is clicked.

Automatic Instrumentation

Use the ArtistRxConfig object's processImpression to perform an action whenever a View is displayed (such as invoking onNext() on a relay/subject exposed by your analytics library).

Making Traits Easier to Write

Implementing a Trait can involve writing a lot of code to do the codegen. To alleviate this, consider pushing the bulk of your logic into a utility method that can then be invoked via codegen. This sample is a good example of delegating the bulk of the logic to a util class.

Clone this wiki locally