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 Foundation | |
| enum AppEnvironment { | |
| case Development | |
| case QA | |
| case Release | |
| } | |
| struct AppConfig { | |
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 Foundation | |
| struct Person: Codable { | |
| var firstName: String | |
| var surName: String | |
| var alias: String? | |
| var age: Int | |
| var height: Double | |
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 url = Bundle.main.url(forResource: "persons", withExtension: "json") | |
| let fileData = try! Data(contentsOf: url!) | |
| let persons:[Person] = try! JSONDecoder().decode([Person].self, from: fileData) |
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
| enum CodingKeys: String, CodingKey { | |
| case firstName = "first_name" | |
| case surName | |
| case alias | |
| case age | |
| case height | |
| } |
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
| extension DateFormatter { | |
| static let bornDate: DateFormatter = { | |
| let formatter = DateFormatter() | |
| formatter.dateFormat = "dd/MM/yyyy HH:mm" | |
| return formatter | |
| }() | |
| } |
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 url = Bundle.main.url(forResource: "persons", withExtension: "json") | |
| let fileData = try! Data(contentsOf: url!) | |
| let decoder = JSONDecoder() | |
| decoder.dateDecodingStrategy = .formatted(DateFormatter.bornDate) | |
| let persons:[Person] = try! decoder.decode([Person].self, from: fileData) |
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 Foundation | |
| class Person: NSObject { | |
| var name:String! | |
| var age:Int! | |
| } |
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 Foundation | |
| import Alamofire | |
| protocol PersonsInteractorInput: class { | |
| func fetchPersons() | |
| } | |
| class PersonsInteractor: NSObject, PersonsInteractorInput { | |
| let url = "https://www.example.com" |
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 Foundation | |
| // Protocolo que define los comandos mandados desde la vista al presenter. | |
| protocol PersonsModuleInterface: class { | |
| func updateView() | |
| func showDetailsForPerson(_ person: Person) | |
| } | |
| // Protocolo que define los comandos mandados desde el interactor al presenter. | |
| protocol PersonsInteractorOutput: class { |
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 | |
| protocol PersonsViewInterface: class { | |
| func showPersonsData(persons: [Person]) | |
| func showNoContentScreen() | |
| } | |
| class PersonsViewController: UIViewController, PersonsViewInterface { | |
| @IBOutlet weak var table: UITableView! |
OlderNewer