16
STYLE GUIDE @r.szeja /netguru/swi+,stye,guide

How We Tamed Swift Syntax: the Open Source Style Guide

  • Upload
    netguru

  • View
    1.042

  • Download
    2

Embed Size (px)

Citation preview

STYLE%GUIDE

@r.szeja

/netguru/swi+,stye,guide

COMMON%STACK

@r.szeja

ExperienceImprovement

KnowledgeStabilityMaintenancePleasant&SyntaxExperiments

COMMON%STACK

@r.szeja

AUTO&LAYOUTObjective-C / Swift

USER&AUTHENTICATIONNETWORKINGUNIT&TESTSDATA&PERSISTENCEOTHERS

AUTO%LAYOUT

@r.szeja

PureLayout

Masonry

ObjecLveMC SwiN

SnapKit

PureLayout

Cartography

AUTO%LAYOUT

@r.szeja

Very&autoMlayout’ish

Claimed&to&be&engineered&&for&performance

Syntax

PureLayout Masonry

Nice&ObjecLveMC&syntax

Bugfix&only&state&M&use&SnapKit&instead

Powerful

Syntax

Compromise&between&best&syntax&and&flexibility

Looks&a&bit&complicated

Verbose&syntax

Powerful

You&may&already&know&it

AUTO%LAYOUT

@r.szeja

Syntax

PureLayout SnapKit

ImperaLve&programming&only&!

WriVen&in&SwiN

Syntax&as&in&Masonry

Syntax

Very&autoMlayout’ish

Claimed&to&be&engineered&&for&performance

Compromise&between&best&syntax&and&flexibility

Looks&a&bit&complicated

Verbose&syntax

PowerfulImperaLve&programming&in&SwiN

PreVy&flexible

AUTO%LAYOUT

@r.szeja

Nice&declaraLve&syntaxVery&easy&to&use

Flexible

Syntax

NaLve&SwiN&of&courseHad&some&problems&in&Roomguru&M&can’t&remind&specifics

Cartography

Nice&support&(4&issues&M&enhancements/help&M&&open,&75&closed)

USER%AUTH

@r.szeja

Not&well&known,&but&support&is&here

Our&own&thing

Very&good&maintenance&"

Devise auth0&lock

No&mobile&SDK&etc.

Backend&soluLon

NETWORKING

@r.szeja

May&have&bugs

Well&maintained

May&lack&some&specific&features

AFNetworking&has&not&so&good&success/failure&response&handling

People&usually&wrap&them&anyway

+1&dependency&

AFNetworking%/%Alamofire

Probably&well&known

Both&wraps&NSURLSession

NETWORKING

@r.szeja

FlexibleEasy&to&use

Has&every&feature&that&may&be&needed

Probably&not&that&well&known

Easy&to&wrap&with&custom&classesNo&dependency&needed

NSURLSession

GO%%FOR%%

@r.szeja

NSURLSession

UNIT%TESTS

@r.szeja

Specta&/&Expecta

ObjecLveMC SwiN

Quick&/&Nimble=

UNIT%TESTS

@r.szeja

OHHTTPStubs

Mocking&HTTP&Responses

NocillaA&bit&messy&syntax

Works&with&SwiN

We&know&how&to&use&it

Nice&DSL

Works&with&SwiN

Stubbing&with&regex

DATA%PERSISTENCE

@r.szeja

Performs&wellMany&informaLon&on&how&to&use&it

CoreData Realm

Realm&is&openMsourcedClaimed&to&be&faster&than&raw&SQLite

Internal&C++&Core&not&openMsourced&yet

Advanced&and&full&of&featuresMature

Promising&&&young&M&0.93.1Seems&to&be&easy&to&use117&issues&on&GH,&but&665&closed!What&doesn’t&mean&great

ThreadMsafety&problems&M&hard&to&do&it&rightTons&of&boilerplate

SQLite&based

Missing&some&features&M&NoLficaLons&&&KVONSDate&truncated&to&seconds&#

LimitaLons&on&name&length&&&NSData&sizeAlways&makes&some&problems

OTHER

@r.szeja

TimepieceCryptoSwiNKeychainAccessSwiNyJSON

SwiNyUserDefaults

AsyncSwiNRecord

NSDateEncrypLonKeychain

JSONGCD

CoreDataNSUserDefaults

DateToolsRNCryptorUICKeyChainStore???

M&/&???

MMagicalRecord

ValidaLon NGRValidator NGRValidator

[email protected] 18.05%9%2.06.2015