-
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.
- Loading branch information
1 parent
8118076
commit 664ad43
Showing
3 changed files
with
52 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// Copyright © 2024 Alexander Romanov | ||
// HealthKitErrors.swift, created on 26.03.2024 | ||
// | ||
|
||
import OversizeLocalizable | ||
import SwiftUI | ||
|
||
public extension AppError.Enums { | ||
enum HealthKit { | ||
case deleteItem | ||
case updateItem | ||
case savingItem | ||
case fetchItems | ||
case notAccess | ||
case unknown | ||
} | ||
} | ||
|
||
extension AppError.Enums.HealthKit: AppErrorProtocol { | ||
public var title: String { | ||
switch self { | ||
case .deleteItem: return "Delete error" | ||
case .updateItem: return "Update error" | ||
case .savingItem: return "Saving error" | ||
case .fetchItems: return "Fetch error" | ||
case .notAccess: return "No access to the HealthKit" | ||
case .unknown: return "Unknown" | ||
} | ||
} | ||
|
||
public var subtitle: String? { | ||
switch self { | ||
case .notAccess: return "Please allow access to HealthKit in settings" | ||
default: return L10n.Error.tryAgainLater | ||
} | ||
} | ||
|
||
public var image: Image? { | ||
Image(.error) | ||
} | ||
|
||
public var icon: Image? { | ||
nil | ||
} | ||
} |