Let's say that I have this code: class Stat { var statEvents : [StatEvents] = [] } struct StatEvents { var name: String var date: String var hours
I've seen a few examples of this but all of those seem to rely on knowing which element you want to count the occurrences of. My array is generated dynamically
Lets say I have an array var values:[CGFloat] = [-12.0, 450, 300] I need to find out which of these numbers is closest to a given value, say var givenValue