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
| import UIKit | |
| // Services conforming to protocols. | |
| // SOLID: Depend on abstractions, not concrete implementations. Dependency Inversion principle | |
| // DECLARE FIRST SERVICE | |
| protocol MyFirstServiceProtocol { | |
| func myFirstMethod() | |
| } |
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 test_failure() { | |
| let response = | |
| """ | |
| [ | |
| { | |
| "firstName": "Lee", | |
| "lastName": "Burrows" | |
| }, | |
| { |
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 test_success() { | |
| let response = | |
| """ | |
| [ | |
| { | |
| "firstName": "Lee", | |
| "lastName": "Burrows" | |
| }, | |
| { |
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
| struct PersonName: Codable { | |
| var firstName: String | |
| var lastName: String | |
| } | |
| final class NameService { | |
| private var apiClient: APIClientProtocol | |
| init(apiClient: APIClientProtocol) { | |
| self.apiClient = apiClient |
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
| // | |
| // File.swift | |
| // | |
| // | |
| // Created by Lee Burrows on 04/01/2021. | |
| // | |
| import Foundation | |
| class MockURLProtocol: URLProtocol { |
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
| import UIKit | |
| var dictionary = NSMutableDictionary() | |
| let key = "@123" | |
| dictionary[key] = "Test Value" | |
| let value = dictionary[key] // Test Value | |
| let newKey = "@4321" | |
| dictionary[newKey] = "New Test Value" |
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
| xcrun simctl uninstall booted com.theiosdude.bundleid |