iOS Projects
We are going to describe the most essential tools that we usually use on our iOS projects.
Dependency management
There are two main dependency management tools in iOS: cocoapods and Carthage. Here at CodigoDelSur we mostly use cocoapods. Using cocoapods, the dependencies are listed in a text file named Podfile. To initialize the project you just need to go to the Xcode project folder and run on a terminal the command $ pod init
, this will create the podfile setup. Once the project has the podfile with the dependency libraries listed inside you can install them by typing the command $ pod intall
. After the command finishes you can open the generated workspace to start coding.
Distribution tools
For distribute our app to our clients and test teams we use the next platforms:
- Hockeyapp Is a complete platform for distributing app builds, it provides a lot of useful feature like feedback, metrics and crash reporting.
- Crashlytics Another nice distribution tool. Originally it was a crash reporting tool and now is part of the Fabric platform and also provides a distribution system.
- Testflight The apple distribution system, is integrated with Xcode and it can allow the app to be tested by up to 2,000 testers by only having their emails.
- Diawi is a very straight forward platform you just drag and drop the ipa file and it will return you the url where the users can download it.
Code Style
Objective-C Code Style
On what concerns about naming classes, variables and methods we follow the Apple's Coding Guidelines for Cocoa. Regarding code style we have created an uncrustify configuration file to automatically apply our code style. On this link you can access to it. Here you can see some guides that we based from:
Swift Code Style
Commenting code
When commenting our code we like to comments our header's using the HeaderDoc notation. Usually we use the /** - */
notation to start a documentation block. HeaderDoc works with a series of tags. These tags can be grouped into two categories: Top-level tags describe the type of declaration that and Second-Level Tags that adds additional information about the declaration. Our preferred tags are:
Top-Level Tags
@class
Used to point the starting point of a documentation block regarding a class.@protocol
Just like the above, just for protocols.
Second-Level Tags
@brief
Used to write a short description about the method, property, class, file, struct, or enum you’re documenting. No line breaks are allowed.@discussion
Used to write a thorough description. You can add line breaks if needed.@param
With this you can describe a parameter of a method or function. You can have multiple such tags.@return
Used to specify the return value of a method or function.
By using this notation, you can build easily html documentation using tools like jazzy, Doxygen and HeaderDoc. On this link you can check an interesting article describing those tools.
Also we use the pragma mark
directive in all of our classes. The pragma mark
directive helps to organize the methods of a class making the code more clean and easy to read. It help us to separate methods and group them by delegates implementations, IBAction, etc.
Libraries
Here is the list of our most used iOS libraries:
- AFNetworking This is the networking framework that we mostly use. Its really nice, and it really makes life a little bit easy.
- Alamofire The networking framework we use for swift projects..
- Crashlytics is the crash reporting to that we use here.
- CocoaLumberjack Its a logging framework that helps us to organize and manage our app's console logs.
- FLEX An in-app debugging and exploration tool for iOS.
- Reachability A really simple but good way to evaluate host availability is using this library.
- SVProgressHUD Provides us a easy way to implement loading alert while waiting for something.
Other nice libraries
- Pusher Is a library that we have used to establish socket communication with the backend.
- Charts Help us when we want to display awesome charts.
- Mapbox Provide us ablilty to show really nice maps in our iOS apps.
On the links below you can find really complete list of iOS libraries: