Page 1
Consuming API The Good, the Bad and the Ugly
Page 4
Don’t reinvent the wheelUse libraries!
Page 5
Can we improve it?
• Not reusable
• What if there is some authorization?
• Common error handling?
Page 6
API ManagerACHIEVEMENT UNLOCKED
Page 8
Data (de)serializationACHIEVEMENT UNLOCKED
Page 9
Creating objects from JSON
[User userWithDictionary:(NSDictionary*)dict]
[UserFactory createUserWithDictionary:(NSDictionary*)dict]
Page 10
Alternatives
• KZPropertyMapper • Mantle • JSONModel
Page 12
Let’s just paste the new parsing code everywhere, or….
Page 13
Abstraction is nice
Page 14
Abstraction is nice
Page 15
Abstraction is nice
• Network engine independent
• Easy to use
• Extendable
Page 18
Categories to the rescue!
Page 21
ALAMOFIREis the new AFNetworking
Page 23
More complicated is more complicated*
* - If you are begginer in swift