Skip to content

Commit

Permalink
Removed code comments, which expose too much of internal implementati…
Browse files Browse the repository at this point in the history
…on logic, reduced visibility of variables
  • Loading branch information
leviathan committed Aug 19, 2016
1 parent b91867f commit 60417ca
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Source/KakapoServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ import Foundation
*/
public final class KakapoServer: NSURLProtocol {

/**
The overall list of `Router` objects, which is know to all `KakapoServer` instances.
Visibility is on the `KakapoServer` class level, because `NSURLProtocol` just allows us to register
class elements (no instances are possible).
*/
public static var routers: [Router] = []
private static var routers: [Router] = []

/**
`true`, if the `request` of the `KakapoServer` instance has been cancelled, otherwise `false`.
Expand All @@ -54,7 +49,7 @@ public final class KakapoServer: NSURLProtocol {
Note: calls to `stopLoading()` will set this value to `true`
*/
public private(set) var requestCancelled:Bool = false
private(set) var requestCancelled:Bool = false

/**
Register and return a new Router in the Server
Expand Down Expand Up @@ -112,10 +107,12 @@ public final class KakapoServer: NSURLProtocol {

/// Start loading the matched requested, the route handler will be called and the returned object will be serialized.
override public func startLoading() {
if requestCancelled == false {
if let routerIndex = KakapoServer.routers.indexOf({ $0.canInitWithRequest(request) }) {
KakapoServer.routers[routerIndex].startLoading(self)
}
if requestCancelled {
return
}

if let routerIndex = KakapoServer.routers.indexOf({ $0.canInitWithRequest(request) }) {
KakapoServer.routers[routerIndex].startLoading(self)
}
}

Expand Down

0 comments on commit 60417ca

Please sign in to comment.