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
// MARK: Frameworks | |
import XCTest | |
// MARK: CalculatorInteractorTests | |
class CalculatorInteractorTests: XCTestCase { | |
// MARK: Variables | |
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
// MARK: Frameworks | |
import XCTest | |
// MARK: CalculatorInteractorTests | |
class CalculatorInteractorTests: XCTestCase { | |
// MARK: Variables | |
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 FirebaseDatabase | |
// MARK: Item | |
enum ItemParameters: String { | |
case item = "item" | |
} | |
// MARK: Item |
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
// MARK: Variables | |
var items: [Item] = [] { | |
didSet { | |
myTableView.reloadData() | |
} | |
} |
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
// MARK: UITableViewDataSource Methods | |
extension MainViewController: UITableViewDataSource { | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return items.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell") | |
let item = items[indexPath.row] | |
cell.textLabel?.text = item.item |
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
// MARK: Frameworks | |
import Foundation | |
import FirebaseDatabase | |
// MARK: ItemsRemote | |
class ItemsRemote { | |
// MARK: Constants |
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
// MARK: View Methods | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
loadItems() | |
} | |
// MARK: Action Methods | |
@IBAction func add(_ sender: Any?) { | |
guard let itemText = addTextField.text else { |
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
// MARK: Frameworks | |
import UIKit | |
// MARK: ArticleViewController | |
class ArticleViewController: UIViewController { | |
// MARK: Outlets | |
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
// MARK: Frameworks | |
import Foundation | |
// MARK: ArticleRemote | |
class ArticleRemote { | |
static func retrieveArticles(completion: @escaping(_ articles: Articles) -> Void) { | |
let session = URLSession(configuration: .default) | |
let apiURL: URL = URL(string: "https://api.nytimes.com/svc/mostpopular/v2/mostviewed/Technology/1.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
// MARK: Frameworks | |
import Foundation | |
// MARK: Article | |
struct Articles: Decodable { | |
let count: Int | |
let results: [Article] | |