Skip to content

adrianod1as/TheFeels

Repository files navigation

MIT License LinkedIn


Logo

The Feels

Analyze the sentiments of tweets!

Table of Contents

About The Project

The main goal of this project is to demonstrate my knowledge with a few of the technologies and concepts I have been working with for the past few years. Although its straightforward use, sentiment analysis of tweets, the choices made in this app intend to cover projects that might grow exponentially and have as key factors: layer segregation, build time, maintainability, testatibility, among another real world features. Besides all that, you can also have some fun analyzing the sentiment of texts publically tweeted by any searched twitter user.

Features

The features are the following:

Their development progress is detailed in the Project Management section.

Getting Started

For starters go on and clone this repository. In oder to run this project you will need Xcode and usually a mac (ba dum tss), but you also gonna need the following.

Prerequisites

Installation

After installing bundler, run in your terminal:

bundle install

It will install the remaining gems, and now you can run:

pod install

which will install the projet dependencies needed and prompt you for the keys & tokens you obtained from Twitter. Such credentials will be stored only locally at your keychain and will be ignored from git history (vide cocoapods-keys guidelines). Finally you may open TheFeels.xcworkspace and run the project in the simulator or in your device by renaming its bundle identifier.

Technical

Written in

This appiclation is written fully in Swift and applies Codable, Equatable, Hashable, Higher order functions, Extensions, Associated Types, Typealias, Generics, among many others of its features.

Principles

This project heavily follows the S.O.L.I.D. Principles.

Architecture

This project is architectured following the concepts of Clean Architecture(https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html). Each layer has its own set of models, classes, and protocols, being the last one used for communication among the layers (Dependency Inversion Principle).

Modularization

This project is organized in modules primarily following the segregation of layers presented by Clean Architecture. Also, each layer has its own segregation.

  • Domain: module containing the bussiness rules of the project, applied by models and use cases. Does not depend from any other module and provide protocols to be used and/or implemented by the other modules. For instance, Repository for the Data layer and UseCase for the Presentation layer.
  • Data: This layer is segregated by how they relate to the app's data. Networking is a module for obtaining/sending data from/to web services, while Storage perform the same task but with local data. AppData then manage both datasources and how their data relate together. However it must be clarified that this is perfomed applying inversion of control. AppData provides datasource protocols which are implemented by their corresponding module and then injected in the Appdata Repostiry classes.
    • Networking: module for performing network requests.
    • Storage: module for performing local calls.
    • AppData: module for managing both data sources.
  • Presentation: This layer is segregated mainly by features. The current features in this project are quite small, but you may consider larger concepts. For instance all flows related to transfers in a banking app would compose a module. Likewise all flows related to registration in another module. For sharing code between these features, you have the Common module. However since these features don't know each other, they can't navigated to one another. For that you have the AppNavigation module, which knows any present feauture and can navigative from/to them using protocols implemented by coordinators.
    • User: a feature module
    • Tweet: a feature module.
    • Common: module for sharing code.
    • AppNavigation: module for navigation between features.
  • DI: module for dependency Injection.
  • Main: application original module.

Main Patterns

  • Model-View-ViewModel
  • Coordinator
  • Delegation
  • Factory

Folder Structure

Besides being physically divied by modules, each module has its files grouped by its reponsibility.

Unit tests

Each module has its own group of unit tests, as well the necessaries components (spies, stubs, fakes) for such tests. This project uses XCTest, assisted by RxTest & RxBlocking for Rx classes.

Dependencies

This project uses dependencies managed by Cocoapods. Each dependency is available only for its necessary modules.

Shared Pods

  • SwiftLint: A tool to enforce Swift style and conventions.
  • Fakery: Generates fake data. In association with Fakeable, a protocol of mine, Models can be randomly generated.
  • RxSwift: High level abstraction, reactive, functional and declarative programming. 😍
  • RxSwiftExt: Useful and conveniente extensions for Rx.

Testing Pods

Presentation Pods

  • SwiftGen: Type-safe them all.
  • Kingfisher: Downloading and caching of images from the web.
  • lottie-io: Loadings should be pretty.
  • RxCocoa: Rx capabilities for Cocoa APIs. Extra points for Driver.
  • RxSwiftUtilities: Track progress of stream events. Basically it tells when to start/stop loading.
  • RxDataSources: Upgraded Rx way of binding your datasource to your TableView/CollectionView.

DI Pods

  • Swinject: Well-known framework for dependency injection.
  • SwinjectAutoregistration: Automate the dependencies registrations in a generic way and reduce their boilerplate.

NetworkingPods

Roadmap

This app has many spaces for improvement, and I intend to fill them in them following moments. In the next section you may read some of them.

TO-DO

  • Replace current sentiment analysis for the one provided by Google* or better alternative.
  • Improve layout by showing more information (hashtags, mentions, photos, etc..) for each tweet.
  • Cache searches and analysis, providing a offline-first behavior.

*: At the moment of this writing, it was not possible to register for a free trial due to a system malfunction.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Adriano Dias - adrianodsilva

Projects

TheFeels

OxeNetworking

UDTM