RedPotion provides a variety of ways to update a view's data or attributes. All of which are chain-able.


You can use .data to either set or retrieve the "data" of the selected views. Depending on the view type, it will be the most common attribute, such as .text for UITextField or .image for UIImageView.

To set the data, you can do this


To get the data:

=> 'Foo'

# Returns an array if more than one view is selected
=> ['Foo', 'Bar']

This is chain-able. For example, let's say you need to set a label's title before applying a style, you could do this:

find.append(UILabel).data('Some long title').apply_style(:name_label)

You also use an = like so, but it's not chain-able:

find(my_text_field).data = 'foo'


You can set any attribute:

find(my_text_field).attr(text: 'Foo')

Worse case scenario, you can use send:

find(UILabel).send(:some_method, args)