UnsplashMap is a simple app that lets you fetch random photos from Unsplash and explore their locations on a map.
I have created the app to further consolidate my knowledge in UIKit. I was also looking forward to working with maps and making API calls. As always, it was an interesting journey and lots of fun!
-
The first challenge I faced was to only fetch photos with location data, as I want every photo to be visible on the map. Unfourtunately it is not possible to specify the location pamameter inside the API URL.
I have solved this problem by synchronously making additional API calls, as long as the retrieved photo has no location data. Fortunately, it is possible to fetch several random photos on a single request. This leads to an estimated 1.15 expected requests each time, if we assume that every third photo has location data and we fetch five photos on each request.
-
Also challenging for me was to cluster all nearby photo markers on the map, in order to enhance performance and visibility. I found the documentation to be quite shallow so it took me some time to absorb all the necessary information from several resources.
- More familiarity with UIKit
- Synchronizing API calls using
DispatchSemaphore/DispatchGroup - Parsing JSON response with
JSONSerializationto save intoCoreDatadatabase - Using the
NSFetchedResultsController - WaterFall
UICollectionViewlayout and custom animations with the help of CocoaPods libraries - Making reusable custom Popups and MiniSheets with both
UITapGestureRecognizerandUIPanGestureRecognizer - Working with Google Maps SDK, custom MapStyles as well as Markers and Clustering
- Working with
LocationManagerand properly managing the authentication part
- Swift
- UIKit without storyboard
- CoreData
- Xcode
- GoogleMaps SDK
- CocoaPods
- Sketch
- Miro
- Adobe Photoshop
Design prototypes in Sketch
Data architecture diagram
Object diagram of CoreData entities
Unsplash API
https://unsplash.com/documentation#get-a-random-photo
https://unsplash.com/api-terms
Feel free to checkout my website https://www.kaizheng.de/.



