Can you change to:

```ruby
icon_image = UIImage.imageNamed(icon_image) if icon_image.is_a?(String)
```