# iOS Manifesto ## What do we do? We develop effective native iOS applications using [Swift](https://swift.org) programming language, version 5.2, and leveraging on MVP pattern and VIPER architecture. ## Tools #### IDE The default IDE is XCode, version 12; upgrading to major releases are always agreed within the team, because some resources are shared with other team members. #### Dependency Management ##### Cocoapods To manage dependencies we recommend using the latest stable version of [CocoaPods](https://cocoapods.org). To install it you can use the following command: `sudo gem install cocoapods` To adopt CocoaPods in a new project you need to run `pod init` on the root folder of your project Dependencies are managed using a text file, named `Podfile`, that can be found in your Xcode project directory You can add libraries by writing `pod <your-library>` on the Podfile, to install them you need to run command `pod install` After `pod install` has run successfully you need to open `<your-app>.xcworkspace` file. ##### Swift Package Manager [Swift Package Manager](https://swift.org/package-manager/) was introduced with Swift 3.0 and since then has grown adding new features. As of now we still use CocoaPods as the default method to manage dependencies, but if a library has added support for Swift Package Manager we recommend using it, as we think this will be the preferred way dependencies will be managed in the future. To add a new library using Swift Package Manager on Xcode you need to go to `File -> Swift Packages -> Add Package Dependency`, select your project and add the library URL. #### Common libraries ##### CocoaDebug [CocoaDebug](https://github.com/CocoaDebug/CocoaDebug) is a powerful debugging tool, its most appreciated features include listing of all the network requests sent by the application, real-time display of memory usage and real-time display of CPU and FPS. Since it shows a black bubble on your device it is better to use it only for development or QA purpose, this can be achieved using the `:configurations` param for CocoaPods. For example, to install it just for the `Debug` configuration add the following line to your `Podfile`. `pod 'CocoaDebug', :configurations => ['Debug']` ##### SwiftLint [SwiftLint](https://github.com/realm/SwiftLint) is a static analysis tool to enforce Swift style and conventions. Its rules can be defined in the `.swiftlint.yml` file, [here](https://github.com/realm/SwiftLint#configuration) you can find how to work with SwiftLint rules. ##### Apollo [Apollo](https://github.com/apollographql/apollo-ios) is the default client to perform queries to a GraphQL server. It offers a set features from downloading schema to generating queries and model abstraction. ##### PromiseKit [PromiseKit](https://github.com/mxcl/PromiseKit) is a complete implementation of promises written in Swift and Objective-C. It is used to ease asynchronous programming and helps making code more readable. ##### Alamofire [Alamofire](https://github.com/Alamofire/Alamofire) is the most complete and used HTTP networking library written in Swift. To keep the library focused on HTTP networking, some component libraries have been developed and are available thanks to the Alamofire community. ##### VIPER Template [VIPER Template](https://github.com/vidiemme/VIPER-Module-Template-Swift) is a template to create a new module based on VIPER architecture. Its goal is to speed up development by automating a repetitive task, like creating files and default variables for every VIPER module. We developed this template internally, so new features are discussed within the Mobile Team, and new tasks can be monitored on the [Mobile internal activities Kanban Board on Tracker](https://tracker.vidiemme.it/projects/mobile-internal-activities/agile/board?utf8=✓&set_filter=1&f%5B%5D=issue_tags&op%5Bissue_tags%5D=%3D&v%5Bissue_tags%5D%5B%5D=VIPERTemplate&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&f_status%5B%5D=1&f_status%5B%5D=2&f_status%5B%5D=18&f_status%5B%5D=6&f_status%5B%5D=3&c%5B%5D=id&c%5B%5D=tracker&c%5B%5D=assigned_to&c%5B%5D=tags_relations&group_by=category&color_base=priority). ##### VidiUtils [VidiUtils](https://github.com/vidiemme/VidiUtils-Swift) is a collection of utils that we think would ease development. Its features are discussed within the Mobile Team and upcoming activities can be found on the [Mobile internal activities Kanban Board on Tracker](https://tracker.vidiemme.it/projects/mobile-internal-activities/agile/board?utf8=✓&set_filter=1&f%5B%5D=issue_tags&op%5Bissue_tags%5D=%3D&v%5Bissue_tags%5D%5B%5D=VidiUtils&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&f_status%5B%5D=1&f_status%5B%5D=2&f_status%5B%5D=18&f_status%5B%5D=6&f_status%5B%5D=3&c%5B%5D=id&c%5B%5D=tracker&c%5B%5D=assigned_to&c%5B%5D=tags_relations&group_by=category&color_base=priority). ##### KingFisher [Kingfisher](https://github.com/onevcat/Kingfisher) is a library to download and cache images from a remote source. Previously we were using [SDWebImage](https://github.com/SDWebImage/SDWebImage), but we preferred switching to Kingfisher since it is written in Swift. #### Recommended Libraries ##### Reusable [Reusable](https://github.com/AliSoftware/Reusable) is a library that aims to avoid writing a lot of duplicated code when loading reusable views and view controllers. ## Other tools ##### Fastlane [Fastlane](https://github.com/fastlane/fastlane) is a tool to automate repetitive tasks such as code signing and app releases. It has other features, for example screenshots generating, but we mostly use Fastlane to release apps. To install it on your Mac use this `brew` command `brew install fastlane`. To initialize a project using Fastlane from the command line type `fastlane init` from your project's directory. ## CI/CD CI/CD is a key part of mobile development, as we leverage on it to deliver version of the apps to the respective stakeholders. Continuous Integration and Continuous Delivery are achieved using a combination of tools and services; as explained before we use Fastlane to automate code signing and app release, Firebase App Distribution and Testflight are the services used to deliver builds to the stakeholders. To setup CI/CD for your project follow [this](https://tracker.vidiemme.it/projects/vdm181/knowledgebase/categories/9) guide.