This file contains 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
@testable import NetworkingEvolution | |
import SwiftyJSON | |
import XCTest | |
class ViewControllerTests: XCTestCase { | |
var viewController: ViewController! | |
override func setUp() | |
{ | |
super.setUp() |
This file contains 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 Alamofire | |
import SwiftyJSON | |
import UIKit | |
class ViewController: UIViewController { | |
convenience init() { self.init(nibName: "ViewController", bundle: nil) } | |
@IBOutlet weak var label: UILabel! | |
var networkClient: NetworkClientType = NetworkClient() | |
This file contains 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 Alamofire | |
import SwiftyJSON | |
protocol NetworkClientType { | |
func makeRequest<Response: JSONDecodable>(url: String, | |
params: [String : AnyObject], | |
callback: (Response?, ErrorType?) -> Void) | |
} | |
struct NetworkClient: NetworkClientType { |
This file contains 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 SwiftyJSON | |
struct User { | |
let name: String | |
} | |
// MARK: - JSON Decodable | |
extension User: JSONDecodable { | |
init?(json: JSON) | |
{ |
This file contains 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 SwiftyJSON | |
protocol JSONDecodable { | |
init?(json: JSON) | |
} |
This file contains 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
@testable import NetworkingEvolution | |
import SwiftyJSON | |
import XCTest | |
class ViewControllerTests: XCTestCase { | |
var viewController: ViewController! | |
override func setUp() | |
{ | |
super.setUp() |
This file contains 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 Alamofire | |
import SwiftyJSON | |
import UIKit | |
class ViewController: UIViewController { | |
convenience init() { self.init(nibName: "ViewController", bundle: nil) } | |
@IBOutlet weak var label: UILabel! | |
var networkClient: NetworkClientType = NetworkClient() | |
This file contains 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 Alamofire | |
import SwiftyJSON | |
protocol NetworkClientType { | |
func fetchUsername(callback: (String?, ErrorType?) -> Void) | |
func makeRequest(url: String, | |
params: [String : AnyObject], | |
callback: (JSON?, ErrorType?) -> Void) | |
} |
This file contains 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
@testable import NetworkingEvolution | |
import SwiftyJSON | |
import XCTest | |
class ViewControllerTests: XCTestCase { | |
var viewController: ViewController! | |
override func setUp() | |
{ | |
super.setUp() |
This file contains 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 Alamofire | |
import SwiftyJSON | |
protocol NetworkClientType { | |
func makeRequest(url: String, | |
params: [String : AnyObject], | |
callback: (JSON?, ErrorType?) -> Void) | |
} | |
struct NetworkClient: NetworkClientType { |