Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Post on 17-Jan-2017

180 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

Transcript

Building Your App SDK w/ Swift:A Soup to Nuts GuideJordan Yaker@jordanyaker

Supportify.io

State Of The Product (Spring 2015)•Mature Product•Few Client Libraries•Not Many Customers

Coming Up With A Plan

Libraries Created•.NET Nuget Package•Ruby Gem•PHP Composer Package•WordPress Plugin

Time For iOS•Learn Objective-C• tryobjectivec.codeschool.com• raywenderlich.com/category/ios

•Build Base SDK•???

Get Some Swagger

API Specification Frameworks•RAML• raml.org

•API Blue-Print•apiblueprint.org

•Swagger•swagger.io

•Protocol Buffers•developers.google.com/protocol-buffers

Swagger Project•Swagger Specification•github.com/OAI/OpenAPI-Specification

•Swagger Editor•editor.swagger.io

•Swagger Codegen•github.com/swagger-api/swagger-codegen

Problems With That Swagger•Beware Of Authentication•Early Adopter Woes

Supportify Got Swagger (Fall 2015)•.NET Nuget Package•Ruby Gem•PHP Composer Package•Python Package•Java/Android Maven Package•Objective-C CocoaPod

supportify-ios (1.0.0.beta)•Objective-C•AFNetworking•Erased From History•That’s a good thing.

•“Sick code, bro. No really I think it’s contagious. I feel sick just from looking at it.”

Swift: A Modern Language That’s Not Objective-C Code

Time For iOS (Again)•Learn Objective-C•Build Base SDK•Learn Swift•Code School: Swift Live Part 1 / Part 2• raywenderlich.com/category/swift•github.com/raywenderlich/swift-style-guide•developer.apple.com/swift

•Build Base SDK

supportify-ios (1.0.0)

•Swift•AlamoFire•supportify-ios/releases/tag/1.0.0

Image Credit: theoatmeal.com

Why Was The SDK Still Terrible?

“You’re telling me that this is going to save me time, but I have to jump through all of these

hoops to implement it? I’ve already got enough to do on a regular basis. F*ck that. Give me an easy to implement solution that

gives me no aggravation, man.”- Nate Bomberger

iOS Design Patterns

iOS Has Lots Of Design Patterns

Source: medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52

iOS Has Lots Of Design Patterns

Source: medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52

iOS Has Lots Of Design Patterns

Source: medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52

iOS Has Lots Of Design Patterns

Source: medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52

Here Comes A New Challenger:Clean Swift

The Clean Swift Design Pattern

Source: clean-swift.com/clean-swift-ios-architecture

•Configurators Wire Everything Together•Controllers Talk To The Router•Everything Else Talks To The “Next” Thing

The Benefits•Reduced Interdependencies•Component Isolation•Fine-Grained Exposure•Easier Inheritance•Easier Implementation

Oh Look, More Problems

I Got 99 Problems & Swagger Is One•No Passing Of Server Errors•No Parsing Of Server-Returned Error Objects•AlamoFire Demands Data With 200 Status •The API Wasn’t Using 204 Status Codes

The API Needed Some Tweaks•Tag And Category Filtering•CSV (“Tag 1, Tag 2, Tag 3”) •Rudimentary DSL (“Tag 1 AND (Tag 2 OR Tag

3)”)•The “Order” Parameter•…And The Tests Just Weren’t As Good We Thought

The Final Product

supportify-ios (3.1.2)

•Swagger-Based Proxy•API Client•Resource Models

•Global Configurator•Authentication•Global Filters

•Scene Components•Category List•Entry List•Entry•Search List

But Wait – We’re Still Not Done

What Makes For Good Docs?•Copy And Paste•Simple To Complex•Good Structure

Questions?

top related