WhisperSystems/Signal-iOS — pull request #201 by gavia (2014-11-20 00:08:37+00:00)
Title: Code modernisation and refactoring

Syntactic changes:
- Objects are now written as `NSObject*` instead of `NSObject *` across the entire code base. This is the case for method declarations as well as variable declarations. This was done according to discussions.
- Method declarations now all follow the convention: `- (type)methodNameWithArgument:(NSObject*)object;`
- `[NSObject new]` has been replaced with `[[NSObject alloc] init]`. This is in line with Apple's move towards the same convention.
- Constructors now use `instancetype` as their type, as opposed to id or their explicit type. This is for both instance constructors and static constructors.
- enums have been changed to use `NS_ENUM`, and where appropriate their entries have been standardised.
- Dot notation has been dropped for class methods and some instance methods where appropriate. This was done since dot notation is generally used for property getters.
- It's possible that I missed some.
- Environment class methods have been left with dot notation. This whole object needs a rethink if you ask me.
- We should have a more general conversation about dot notation. My opinion is that if we want to use dot notation for methods then those methods should have corresponding properties.

Shared instances
- Code for shared instances have been standardised to use `dispatch_once`. (This is faster than using `@synchronized(self)`).

File changes:
- Categories have been renamed to follow the convention `NSObject+Category.h`.
- Where appropriate some files have been split into two. This is generally the case with multiple interfaces in one file.
- Objects (and files) that contain acronyms have had their acronyms capitalised to reflect that they actually stand for a phrase, and are not a word by themselves. e.g. `Http` -> `HTTP`.

Constructors:
- Static constructors have been widely replaced with instance constructors. Most remaining static constructors have been renamed to better reflect their intention.

Properties:
- There has been an overhaul on the way properties are accessed! ivars have been completely removed and replaced with appropriate properties.
- There is strictly no more direct accessing of properties via their synthesized variable. The only exceptions are:
- Explicitly written setters/getters for custom functionality.
- When the address of the property needs to be used (e.g. `&_object`). In this scenario properties have been explicitly synthesized. i.e. `@synthesize object = _object;` is included in the implementation.
- Interface extensions have been widely implemented as part of the removal of direct access to properties. These are particularly used for `readonly` properties (rewritten as `readwrite` in the extension).
- Non ARC property types have been almost entirely replaced with their ARC equivalents. In particular, delegates are now defined with `weak` references. Furthermore, to prevent XCode throwing warnings at us, delegates are now assigned a strong local reference when used in the implementation. This idea has been taken from http://stackoverflow.com/a/11899135/3577738

Warnings:
- iOS8 specific warnings have been fixed
- Explicit warnings have been added for deprecated methods (`UIAlertView`)

Other:
- I have tried to adopt coding conventions similar to the direction that Apple seem to be going. That said, totally open to criticism of any changes that I've made.
- Tests pass in the simulator but I can't get them to run on my phone.
- The app runs normally on my phone and I can't seem to identify any bugs (fixes were made as I went).
- Very few changes were made to crypto/, but it's crypto, so someone should scrutinize what I have done.