[cocoaheads tricity] michał zygar - consuming api

26
Consuming API The Good, the Bad and the Ugly

Upload: cocoaheads-tricity

Post on 14-Aug-2015

116 views

Category:

Software


2 download

TRANSCRIPT

Consuming API The Good, the Bad and the Ugly

Easy!

Don’t reinvent the wheelUse libraries!

Can we improve it?

• Not reusable

• What if there is some authorization?

• Common error handling?

API ManagerACHIEVEMENT UNLOCKED

Data (de)serializationACHIEVEMENT UNLOCKED

Creating objects from JSON

[User userWithDictionary:(NSDictionary*)dict]

[UserFactory createUserWithDictionary:(NSDictionary*)dict]

Alternatives

• KZPropertyMapper • Mantle • JSONModel

Let’s just paste the new parsing code everywhere, or….

Abstraction is nice

Abstraction is nice

Abstraction is nice

• Network engine independent

• Easy to use

• Extendable

Categories to the rescue!

SWIFT

ALAMOFIREis the new AFNetworking

Easy!

More complicated is more complicated*

* - If you are begginer in swift

ashfurrow/Moya

Thanks!

@mzygar