Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Becoming a Better iOS Developer Through Tooling

Becoming a Better iOS Developer Through Tooling

Slides for a presentation that I gave at AltConf 2017, in San José, California.

I talked about how investing in you toolset can help you reach the next level as an iOS developer.

Oscar Swanros

June 08, 2017
Tweet

More Decks by Oscar Swanros

Other Decks in Programming

Transcript

  1. @swanros open class P3NetworkOperation: P3Operation { // MARK: - Private

    Support Types private enum OperationType { case GetData case Download } }
  2. @swanros public class BaseNetworkOperation<T: Codable>: P3NetworkOperation { override public var

    headerParams: [String : String]? { var headers: [String:String] = [:] if let session = SessionManager.sharedManager.currentSession { headers["Authorization"] = "Token token=\"\(session.token)\"" } if [.put, .patch, .post].contains(method) { headers["Content-Type"] = "application/json" } return headers } }
  3. @swanros every single part of your app that you don't

    have _control_ of in your app, is a dependency
  4. @swanros public enum APIError: String, ErrorConvertible { case malformedServerResponse =

    "malformed_error_response" case emailTaken = "email_taken" case unverifiedUser = "unverified_user" // ... public var errorDescription: String { return self.description } public var domain: String { return "net.Pacific3.CallicoAPIKit.Error" } } extension APIError: CustomStringConvertible { public var description: String { switch self { case .phoneNumberTaken: return "Phone number already taken." case .emailTaken: return "Email already taken.” } } }
  5. @swanros public class GetContactsOperation: BaseOperation<UserCollection> { public override var simpleEndpoint:

    EndpointConvertible { return Endpoint.contacts } public var contacts: UserCollection? public init?() { super.init() } override func generated(result: UserCollection) { contacts = result finish() } } guard let op = GetContactsOperation() else { return } P3OperationQueue().addOperation(op)
  6. @swanros Meta tools How are you going to know why

    you did something? Document every single decision you make Time machines do exist!