Nearest Sites
This was the last screen worked on. Initially, it had been part of the site search but I moved it out of there as it was getting messy because of the Award and State buttons, plus it is more informational.
The latitude and longitude shown at the bottom of the screen is derived from the internal GPS on the phone. Swift has special functions I can call to determine the user’s current location.
Allen’s API includes functions that pass back data in JSON format. I just pass in the latitude, longitude and the radius to the API function and it passes back the data requested. Then I just break it up into bits and place it into labels on the screen.
The second screen here shows the Grid Square, nearest park, summit and shire. Same deal although I call 4 API functions with the latitude and longitude to get the 4 rows.