From 59fa3ed2cdc8350283c3e57a2e61d19b74b96502 Mon Sep 17 00:00:00 2001 From: Eddie Seay Date: Tue, 26 Nov 2024 09:51:06 -0500 Subject: [PATCH] 323: Update documentation comment Signed-off-by: Eddie Seay --- .../Connect/Public/Interfaces/ConnectError.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Libraries/Connect/Public/Interfaces/ConnectError.swift b/Libraries/Connect/Public/Interfaces/ConnectError.swift index c7f2af32..ae36b257 100644 --- a/Libraries/Connect/Public/Interfaces/ConnectError.swift +++ b/Libraries/Connect/Public/Interfaces/ConnectError.swift @@ -34,7 +34,20 @@ public struct ConnectError: Swift.Error, Sendable { /// Any decoding errors are ignored, and the detail will simply be omitted from the list. /// /// To access only the first error of a specific type: - /// `let unpackedError: MyError? = error.unpackedDetails().first` + /// + /// ``` + /// let unpackedErrors: [MyError] = error.unpackedDetails() + /// let unpackedError = unpackedErrors.first + /// // OR + /// let unpackedError = (error.unpackedDetails() as [MyError]).first + /// ``` + /// + /// When calling this function from Swift 5, the compiler will allow the following + /// alternative syntax: + /// + /// ``` + /// let unpackedError: MyError? = error.unpackedDetails().first + /// ``` /// /// - returns: The matching unpacked typed error details. public func unpackedDetails() -> [Output] {