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 XCTest | |
| struct Scenario: ScenarioGivenContinuation, ScenarioWhenContinuation { | |
| init(_ description: String) { | |
| print("Scenario: \(description)") | |
| } | |
| struct Given: ScenarioWhenContinuation { | |
| fileprivate init(description: String, setup: () throws -> Void) rethrows { | 
  
    
      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
    
  
  
    
  | // Reference: https://github.com/asensei/AnyCodable/blob/master/Sources/AnyCodable/AnyCodable.swift | |
| import Foundation | |
| public struct AnyCodable { | |
| // MARK: Initialization | |
| public init(_ value: Any?) { | |
| self.value = 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
    
  
  
    
  | extension KeyedDecodingContainer { | |
| func decodeIfPresent<T: Decodable>(key: K) throws -> T? { | |
| return try decodeIfPresent(T.self, forKey: key) | |
| } | |
| func decode<T: Decodable>(key: K) throws -> T { | |
| return try decode(T.self, forKey: key) | |
| } | |
| } | 
  
    
      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 Place: Unboxable { | |
| static let dateAddedFormatter: DateFormatter = { | |
| let formatter = DateFormatter() | |
| formatter.dateFormat = "YYYY-mm-dd" | |
| return formatter | |
| }() | |
| init(unboxer: Unboxer) throws { | |
| name = try unboxer.unbox(key: "placeName") | 
  
    
      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 Place { | |
| enum CodingKeys: String, CodingKey { | |
| case name = "placeName" | |
| case lat | |
| case lon | |
| case dateAdded | |
| case info | |
| } | |
  
    
      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
    
  
  
    
  | protocol MovieListView: MovieListPresenterDelegate { | |
| private var presenter: MovieListPresenter | |
| func didTapOnReload() | |
| func didTapOnMovie(at index: Int) | |
| } | |
| protocol MovieListPresenterDelegate { | |
| func updateWithMoviePresentations(_ movies: [MoviePresentation]) | |
| } | 
  
    
      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
    
  
  
    
  | protocol MovieListView: MovieListPresenterDelegate { | |
| private var presenter: MovieListPresenter | |
| func didTapOnReload() | |
| func didTapOnMovie(at index: Int) | |
| func showDetailView(for movie: Movie) | |
| } | |
| protocol MovieListPresenterDelegate { | |
| func updateWithMoviePresentations(_ movies: [MoviePresentation]) | |
| } | 
  
    
      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
    
  
  
    
  | protocol MovieListView: MovieListViewModelDelegate { | |
| private var viewModel: MovieListViewModel | |
| func updateWithMovies(_ movies: [Movie]) | |
| func didTapOnReload() | |
| func didTapOnMovie(at index: Int) | |
| func showDetailView(for movie: Movie) | |
| } | |
| protocol MovieListViewModelDelegate: class { | |
| func viewModelDidUpdate(_ model: MovieListViewModel) | 
  
    
      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 Theme: String { | |
| case light, dark | |
| } | |
| class UserSettings { | |
| enum Message { | |
| case didUpdateTheme(Theme) | |
| } | |
NewerOlder