-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Check searchFactsViewModel to bind SuggestionsCell * Improve Category View * Use NSLayoutConstraint * Make classes final * Refactor APIError * FactsListError ViewModel * Fix unit tests * ErrorView -> ErrorAlert * Remove reference to errorView
- Loading branch information
1 parent
c70c9e8
commit b8b2abb
Showing
33 changed files
with
341 additions
and
372 deletions.
There are no files selected for viewing
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
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
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
31 changes: 31 additions & 0 deletions
31
Chuck Norris Facts/App/Scenes/Facts/FactsList/Error/FactsListErrorViewModel.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// FactsListErrorViewModel.swift | ||
// Chuck Norris Facts | ||
// | ||
// Created by Djorkaeff Alexandre Vilela Pereira on 11/2/20. | ||
// Copyright © 2020 Djorkaeff Alexandre Vilela Pereira. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct FactsListErrorViewModel { | ||
|
||
let error: APIError | ||
let title: String | ||
let message: String | ||
var shouldRetry: Bool = false | ||
|
||
init(factsListError: FactsListError) { | ||
self.error = factsListError.error | ||
|
||
self.title = factsListError.message | ||
self.message = error.message | ||
|
||
switch factsListError { | ||
case .syncCategories: | ||
self.shouldRetry = error.code != APIError.noConnection.code | ||
default: | ||
break | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.