فهرست منبع

Add docstring for helper function

Deniz Cengiz 1 سال پیش
والد
کامیت
0117093229
1فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 8 0
      Trio/Sources/Modules/Treatments/TreatmentsStateModel.swift

+ 8 - 0
Trio/Sources/Modules/Treatments/TreatmentsStateModel.swift

@@ -458,6 +458,14 @@ extension Treatments {
             }
         }
 
+        /// Returns a user-facing localized error message for a given authentication error.
+        ///
+        /// This function inspects the provided `Error` to determine whether it is an `LAError`,
+        /// and maps its error code to a human-readable, localized string describing the reason
+        /// for the failure. If the error is not an `LAError`, a generic fallback message is returned.
+        ///
+        /// - Parameter error: The `Error` returned from an authentication attempt (e.g., via `LAContext.evaluatePolicy`).
+        /// - Returns: A localized `String` describing the cause of the authentication failure.
         private func parseAuthenticationError(from error: Error) -> String {
             guard let laError = error as? LAError else {
                 return String(