var count = 0 [cell.star1ImageView, cell.star2ImageView, cell.star3ImageView, cell.star4ImageView, cell.star5ImageView].forEach { star in count += 1 if count <= rating { star?.image = UIImage(named: "star_sel") } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter