diff options
Diffstat (limited to 'Juick/Helpers/LoadableState.swift')
-rw-r--r-- | Juick/Helpers/LoadableState.swift | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Juick/Helpers/LoadableState.swift b/Juick/Helpers/LoadableState.swift new file mode 100644 index 0000000..a45edb2 --- /dev/null +++ b/Juick/Helpers/LoadableState.swift @@ -0,0 +1,25 @@ +// +// LoadableState.swift +// tst +// +// Created by Vitaly Takmazov on 10.12.2019. +// Copyright © 2019 com.juick. All rights reserved. +// + +import Foundation + +enum LoadableState<T> { + case loading + case fetched(Result<T, FetchError>) +} + +enum FetchError: Error { + case error(String) + + var localizedDescription: String { + switch self { + case .error(let message): + return message + } + } +} |