Top Banner
Building Your App SDK w/ Swift: A Soup to Nuts Guide Jordan Yaker @jordanyaker
32

Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Jan 17, 2017

Download

Technology

Jordan Yaker
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 2: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Supportify.io

Page 3: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 4: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Coming Up With A Plan

Page 5: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 6: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

•Build Base SDK•???

Page 7: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Get Some Swagger

Page 8: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

API Specification Frameworks•RAML• raml.org

•API Blue-Print•apiblueprint.org

•Swagger•swagger.io

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

Page 9: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

•Swagger Editor•editor.swagger.io

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

Page 10: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 11: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 12: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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.”

Page 13: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 14: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 15: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

supportify-ios (1.0.0)

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

Image Credit: theoatmeal.com

Page 16: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 17: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

iOS Design Patterns

Page 18: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

iOS Has Lots Of Design Patterns

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

Page 19: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

iOS Has Lots Of Design Patterns

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

Page 20: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

iOS Has Lots Of Design Patterns

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

Page 21: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

iOS Has Lots Of Design Patterns

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

Page 22: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Here Comes A New Challenger:Clean Swift

Page 23: Philly CocoaHeads 20160414 - Building Your App SDK With 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

Page 24: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 25: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Oh Look, More Problems

Page 26: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 27: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 28: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

The Final Product

Page 29: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 30: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

But Wait – We’re Still Not Done

Page 31: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

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

Page 32: Philly CocoaHeads 20160414 - Building Your App SDK With Swift

Questions?