thinking in swift

Post on 03-Mar-2017

26 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Thinking in Swift

Classes

Problems with classes

• Implicit sharing• Class inheritance is too intrusive• Lost type relationships

Protocol Oriented Programming

https://developer.apple.com/videos/play/wwdc2015/408/

Protocol Oriented Programming

• Protocols are more flexible• Structs are lightweight• Protocol extensions• Retroactive modelling

MVC

Model - View - View Model

Functional Reactive Programming

Streams

Transformations

Bindings

RXSwift

• Observable• Variable• Driver• bindTo

Objective-C libraries

Networking library

• Based on NSURLConnection• No dependency on Objective-C• Not complex requirements• To try something new

Networking

Start with a protocol

protocol HTTP { func executeRequest(request: Request) -> Result<Response, NSError>}

Demo

• Table views• Protocols• HTTP client

Finishing thoughts• More expressive• Less bugs• Better testing• Different• Fun

var questions?

https://martinmitrevski.com

top related