A simple application using the Unsplash API to search for photos by keywor
UnsplashApp
Test app A simple application using the Unsplash API to search for photos by keyword. On the first tab bar VC – the search screen displayed random fetched images. On the second tab bar VC – the favorites screen displayed liked and saved in UserDefaults images
Functionality
ViewControllers
PhotosCollectionViewController
The search screen at the beginning displayed random fetched images.
PhotosCollectionView
- During scrolling, if scrolled down to the last element of collectionView, asynchronously start loading more images
- Custom “waterFall” layout
- Custom apearing alpha animation
SearchController
- When text in searchBar begin changing the searchBar, requests are made to search for images by keyword
- Since the API has a limit of 50 requests per hour, created Timer to avoid or minimize unnecessary requests, while user printing
FavoritesCollectionViewController
- The favorites screen displayed liked and saved in UserDefaults images
- Custom apearing alpha animation
DetailViewController
Appears after touching on selected cell. Present a large image and detailed information of this image in custom Bottom Sheet
InfoView
Represents detail info of Image \
Contains info:
- Author name
- Description
- Location
- Downloads number
- Creation date
Buttons:
- Like button -> save / remove from Favorites List
- Action button -> UIActivityViewController()
- Original size -> PhotoViewController()
PhotoViewController
Used to display the best quality image in the correct aspect ratio. Also here is saveBarButtonItem
Services
1. Network
1.1 NetworkService
Serves to configuring URLS with parameters and REQUESTS for Unsplash API
1.2 NetworkManager
Contains methods to decode JSON and fetching data
2. StorageManager
Serves to work with UserDefaults for saving, fetching, remove favorites photo
3. AppUtility
Serves to lock orientation and prevent screen rotation
Demonstration
Practice with: Unsplash API UserDefaults UrlSession SDWebImage