And even more Swift

class SearchResultsLoaderTests: XCTestCase { func testLoadingSingleResult() throws { let engine = NetworkEngineMock.makeForSearchResults(named: ["Query"]) let loader = SearchResultsLoader(networkEngine: engine) var result: Result<[SearchResult], SearchResultsLoader.Error>? loader.loadResults(matching: "query") { result = $0 } let searchResults = try result?.resolve() XCTAssertEqual(searchResults?.count, 1) XCTAssertEqual(searchResults?.first?.name, "Query&…

And more swift

class SearchResultsLoaderTests: XCTestCase { func testLoadingSingleResult() throws { let engine = NetworkEngineMock.makeForSearchResults(named: ["Query"]) let loader = SearchResultsLoader(networkEngine: engine) var result: Result<[SearchResult], SearchResultsLoader.Error>? loader.loadResults(matching: "query") { result = $0 } let searchResults = try result?.resolve() XCTAssertEqual(searchResults?.count, 1) XCTAssertEqual(searchResults?.first?.name, "Query&…

Some more Swift

class SearchResultsLoaderTests: XCTestCase { func testLoadingSingleResult() throws { let engine = NetworkEngineMock.makeForSearchResults(named: ["Query"]) let loader = SearchResultsLoader(networkEngine: engine) var result: Result<[SearchResult], SearchResultsLoader.Error>? loader.loadResults(matching: "query") { result = $0 } let searchResults = try result?.resolve() XCTAssertEqual(searchResults?.count, 1) XCTAssertEqual(searchResults?.first?.name, "Query&…

Variables in Swift 4.1

This is my very first blog post on my new site. I'll be testing the syntax highlighting with this post. Let's see if it works with some Swift! load { [weak self] result in switch result { case .success(let data): self?.handle(data) case .failure(let error): // Since we now know…