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
// webapp /payments and /paymentOptions returns account details | |
// we use this to show bank transfer info | |
let type: BankType | |
let title: String? | |
let description: DescriptionResponse? | |
let summaries: [SummaryItemResponse] | |
let details: [DetailsItemResponse] | |
let alert: AlertResponse? | |
let shareText: String? |
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
struct Step { | |
enum StepFlowResult { | |
case finished | |
case dismissed | |
} | |
enum Presentable { | |
case viewController(UIViewController, delegate: HasUSBalanceInterestActivationFlowStepDelegate) | |
case flow(any Flow<StepFlowResult>) | |
} |
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
final class WeatherPresenterImpl { | |
var selectedDay: DailyEntry | |
private let days: [DailyEntry] | |
private weak var view: WeatherView? | |
// 1. | |
func selectDay(_ day: WeatherViewModel.Day) { | |
guard let selectedDayModel = days.first(where: { $0.id == day.id }) else { | |
return | |
} |
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
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | |
guard | |
let item = dataSource.itemIdentifier(for: indexPath), | |
case let WeatherViewModel.Item.day(day) = item | |
else { return } | |
presenter.selectDay(day) | |
} |
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
struct DailyEntry { | |
let name: String | |
let icon: WeatherIcon | |
let minTemp: String | |
let maxTemp: String | |
let hours: [HourlyEntry] | |
let id: UUID | |
} | |
struct HourlyEntry { |
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
struct WeatherViewModel { | |
enum Item: Hashable { | |
case day(Day) | |
case hour(Hour) | |
} | |
var sections: [Section: [Item]] | |
let title: String | |
} |
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
struct WeatherViewModel { | |
struct Day: Hashable { | |
let name: String | |
let icon: WeatherIcon | |
let minTemp: String | |
let maxTemp: String | |
let selected: Bool | |
let id: UUID | |
} | |
struct Hour: Hashable { |
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
extension WeatherViewModel { | |
mutating func select(dailyEntry: DailyEntry) { | |
// 1. | |
guard let index = (sections[.daily] as? [DailyEntry])?.firstIndex(of: dailyEntry) else { | |
return | |
} | |
// 2. | |
var mutableCopy = dailyEntry | |
// 3. | |
mutableCopy.selected = true |
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
extension WeatherViewModel { | |
mutating func select(dailyEntry: DailyEntry) { | |
// 1. | |
guard let index = (sections[.daily] as? [DailyEntry])?.firstIndex(of: dailyEntry) else { | |
return | |
} | |
// 2. | |
var mutableCopy = dailyEntry | |
// 3. | |
mutableCopy.selected = true |
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
extension WeatherViewController { | |
func configure(with viewModel: WeatherViewModel) { | |
self.viewModel = viewModel | |
title = viewModel.title | |
reloadData() | |
} | |
private func makeSnapshot() -> NSDiffableDataSourceSnapshot<WeatherViewModel.Section, WeatherViewModel.Item> { | |
var snapshot = NSDiffableDataSourceSnapshot<WeatherViewModel.Section, WeatherViewModel.Item>() |
NewerOlder