Would integer division work better than the modulus operator?

batteryIcon.image = UIImage(named:"\(min(10, (Int(_myBatteryLevel) / 10) + 1))")

--
Bryan Vines

> On Mar 10, 2017, at 9:54 AM, Jeff Kelley <slauncha...@gmail.com> wrote:
> 
> I realized after sending that 100 won’t be correct, so you’ll need
> something like this:
> 
> batteryIcon.image = UIImage(named: "\(min(10, (_myBatteryLevel % 10) + 1))")
> 
> 
> Jeff Kelley
> 
> slauncha...@gmail.com | @SlaunchaMan <https://twitter.com/SlaunchaMan> |
> jeffkelley.org


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to