This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class Job<R, E: Error> { | |
private let semaphore = DispatchSemaphore(value: 0) | |
var result: Result<R, E>? { | |
didSet { | |
semaphore.signal() | |
} | |
} | |
func await() throws -> R { | |
semaphore.wait() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
protocol StageProtocol { | |
associatedtype StageIn | |
associatedtype StageOut | |
} | |
class Stage<In, Out> : StageProtocol { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let presenter = Presenter(router: dummy()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func dummy<T>() -> T { | |
let memory = UnsafeMutablePointer<T>.allocate(capacity: 1) | |
let dummy = memory.pointee | |
memory.deallocate(capacity: 1) | |
return dummy | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testThatPresenterCallsShowUserNameOnVisualizerOnStart() { | |
class MockVisualizer : Visualizer { | |
var userName: String? = nil | |
func show(userName: String) { | |
self.userName = userName | |
} | |
} | |
let presenter = Presenter(router: Router(navigationController: UINavigationController())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Visualizer : class { | |
func show(userName: String) | |
} | |
struct Router { | |
let navigationController: UINavigationController | |
func moveToAnotherScreen() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Visualizer : class { | |
func show(userName: String) | |
} | |
struct Router { | |
let navigationController: UINavigationController | |
func moveToAnotherScreen() { | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP/1.1 200 OK | |
Server: nginx | |
Date: Mon, 16 Jan 2017 09:38:31 GMT | |
Content-Type: application/json | |
Transfer-Encoding: chunked | |
Connection: keep-alive | |
Expires: Thu, 19 Nov 1981 08:52:00 GMT | |
Cache-Control: no-store, no-cache, must-revalidate | |
Pragma: no-cache | |
Cache-Control: no-cache, must-revalidate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /classic/registration/verify HTTP/1.1 | |
Host: dev2.mobitee.com | |
X-DATE: 2017-01-16 09:25:42 +0000 | |
Accept: */* | |
X-AUTH: 1661:bdef2231db58c43236bd906dcb9f805f | |
Accept-Language: en-US;q=1.0, fr-US;q=0.9, it-US;q=0.8, es-US;q=0.7, de-US;q=0.6, en;q=0.5 | |
Accept-Encoding: gzip;q=1.0, compress;q=0.5 | |
Content-Type: application/x-www-form-urlencoded; charset=utf-8 | |
Content-Length: 52 | |
User-Agent: Mobitee Classic/4.0 (com.blrsoft.appname; build:1; iOS 10.1.0) Alamofire/4.2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST //classic/auth/verify HTTP/1.1 | |
Host: dev2.mobitee.com | |
X-DATE: 2017-01-16 09:17:16 +0000 | |
Accept: */* | |
X-AUTH: 1661:c8e4f06953f7d1ba450ccca49fd1e1f2 | |
Accept-Language: en-US;q=1.0, fr-US;q=0.9, it-US;q=0.8, es-US;q=0.7, de-US;q=0.6, en;q=0.5 | |
Accept-Encoding: gzip;q=1.0, compress;q=0.5 | |
Content-Type: application/x-www-form-urlencoded; charset=utf-8 | |
Content-Length: 52 | |
User-Agent: Mobitee Classic/4.0 (com.blrsoft.appname; build:1; iOS 10.1.0) Alamofire/4.2.0 |