@swanros
class ContactView: UIView {
private lazy var avatarImageView = AvatarImageView()
}
Slide 15
Slide 15 text
@swanros
open class P3NetworkOperation: P3Operation {
// MARK: - Private Support Types
private enum OperationType {
case GetData
case Download
}
}
Slide 16
Slide 16 text
@swanros
public class BaseNetworkOperation: 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
}
}
Slide 17
Slide 17 text
@swanros
Tools can be
dependencies too
Slide 18
Slide 18 text
@swanros
Slide 19
Slide 19 text
@swanros
Slide 20
Slide 20 text
@swanros
Slide 21
Slide 21 text
@swanros
“have you used the
Facebook SDK with Swift 3?”
Slide 22
Slide 22 text
@swanros
Slide 23
Slide 23 text
@swanros
every single part of your app
that you don't have _control_ of
in your app, is a dependency
Slide 24
Slide 24 text
@swanros
data services
Slide 25
Slide 25 text
@swanros
data persistence
Slide 26
Slide 26 text
@swanros
if it’s not
essential…
Slide 27
Slide 27 text
@swanros
Tools can prevent us
from making mistakes
Slide 28
Slide 28 text
@swanros
Slide 29
Slide 29 text
@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.”
}
}
}
Slide 30
Slide 30 text
@swanros
public struct UserCollection:
JSONParselable,
Collection,
IteratorProtocol,
CustomDebugStringConvertible,
ExpressibleByArrayLiteral
{ }
let users: UserCollection = [firstUser, secondUser]
Slide 31
Slide 31 text
@swanros
public class GetContactsOperation: BaseOperation {
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)
Slide 32
Slide 32 text
@swanros
Your architecture and
toolset should work for
you, not against you
Slide 33
Slide 33 text
@swanros
don’t trip yourself
up
Slide 34
Slide 34 text
@swanros
new features requests
may arrive at any time
Slide 35
Slide 35 text
@swanros
no iOS app is feature-complete
for more than 360 days
Slide 36
Slide 36 text
@swanros
/users/:user_id/favorites
Slide 37
Slide 37 text
@swanros
Demo
Slide 38
Slide 38 text
@swanros
This is not an
universal solution
Slide 39
Slide 39 text
@swanros
Your toolset should be
much more than just
pieces of code
Slide 40
Slide 40 text
@swanros
Soft tools
Personal/professional
relationships
Ability to speak to
people
Asking for help is actually
okay
Slide 41
Slide 41 text
@swanros
Meta tools
How are you going to
know why you did something?
Document every single
decision you make
Time machines do
exist!
Slide 42
Slide 42 text
@swanros
Questions?
Slide 43
Slide 43 text
@swanros
getcloudapp.com
cloudlovesaltconf
50% off