It's portrait iOS application working with News API. Note: it's possible to discover only 100 news per session since api key of free plan is used.
- Run
pod install
in terminal from project directory. - Open
News.xcworkspace
in Xcode. - Run project.
- News Feed: get familiar with news on topic "bitcoin".
- Article: check out extended information about specific news article.
Implemented features: pull to refresh, pagination, offline mode, alerts on network errors.
- MVVM as the main design pattern
- Combine for binding between View and ViewModel layers
- Coordinators to separate navigation logic from View and ViewModel layers
- CoreData for data persistence
- Network layer with the ability to flexibly change implementations
Network layer details:
- RequestType – represent the requirements for a specific request, such as endpoint, method, parameters and headers. They are grouped in RequestData struct for convenience.
- NetworkDispatcher – dispatches request and handles response by identifying error or getting result data as Data. URLSessionNetworkDispatcher is basic implementation of NetworkDispatcher which utilizes URLSession.
- NetworkManager – executes specific request by firstly delegating dispatching of the request to NetworkDispatcher; then (on completion of dispatching) it performs decoding of returned Data into specific model object
- NewsApi – creates and delegates NewsAPI-specific requests to NetworkManager. Result type of request is inferred at the point of calling execute(request:) method.
Dispatcher is interchangeable, so it's possible to use another implementation, as long as it conforms to NetworkDispatcher protocol. Also, NetworkLogger service is used to debug requests and their responses conveniently.
DataSource details:
- DataSource protocol represents the requirements for news data fetchers.
- RemoteDataSource – fetches news using Internet requests, then caches them using NewsPersistenceManager (abstraction over CoreData).
- LocalDataSource – fetches cached news from local SQLite database, again using NewsPersistenceManager.
- CacheableDataSource – combination of Remote- and LocalDataSource; uses first when Internet connection is established, and second otherwise.
Tools used: Xcode 11, Swift 5. Third-party dependencies: Kingfisher.
- Unit-tests
- Embed Article view components into ScrollView to support landscape orientation