From 74aaecb73823b623020a6c5d2e3f192bda0cf784 Mon Sep 17 00:00:00 2001 From: Felix Schlegel Date: Mon, 22 Apr 2024 12:06:02 +0200 Subject: [PATCH] Review supereg Modifications: * add links in DocC * remove superflous type `OnboardingIdentifiableView` --- .../OnboardingFlow/OnboardingStack.swift | 4 ++-- .../OnboardingIdentifiableViewModifier.swift | 21 +++++-------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Sources/SpeziOnboarding/OnboardingFlow/OnboardingStack.swift b/Sources/SpeziOnboarding/OnboardingFlow/OnboardingStack.swift index fcf82c2..121effc 100644 --- a/Sources/SpeziOnboarding/OnboardingFlow/OnboardingStack.swift +++ b/Sources/SpeziOnboarding/OnboardingFlow/OnboardingStack.swift @@ -52,7 +52,7 @@ import SwiftUI /// /// ### Identifying Onboarding Views /// -/// Apply the `onboardingIdentifier(_:)` modifier to clearly identify a view in the `OnboardingStack`. +/// Apply the ``SwiftUI/View/onboardingIdentifier(_:)`` modifier to clearly identify a view in the `OnboardingStack`. /// This is particularly useful in scenarios where multiple instances of the same view type might appear in the stack. /// /// ```swift @@ -69,7 +69,7 @@ import SwiftUI /// } /// ``` /// -/// - Note: When the `onboardingIdentifier(_:)` modifier is applied multiple times to the same view, the most recently applied identifier takes precedence. +/// - Note: When the ``SwiftUI/View/onboardingIdentifier(_:)`` modifier is applied multiple times to the same view, the outermost identifier takes precedence. public struct OnboardingStack: View { @State var onboardingNavigationPath: OnboardingNavigationPath private let collection: _OnboardingFlowViewCollection diff --git a/Sources/SpeziOnboarding/OnboardingIdentifiableViewModifier.swift b/Sources/SpeziOnboarding/OnboardingIdentifiableViewModifier.swift index 9dcfbd5..acd9d29 100644 --- a/Sources/SpeziOnboarding/OnboardingIdentifiableViewModifier.swift +++ b/Sources/SpeziOnboarding/OnboardingIdentifiableViewModifier.swift @@ -8,28 +8,17 @@ import SwiftUI -/// Wrap `Content` `View` in an `Identifiable` `View`. -private struct OnboardingIdentifiableView: View, Identifiable where Content: View, ID: Hashable { - /// Unique identifier of the wrapped `View`. - let id: ID - /// Wrapped `View`. - let body: Content -} - private struct OnboardingIdentifiableViewModifier: ViewModifier, Identifiable where ID: Hashable { let id: ID - func body(content: Content) -> some View { - OnboardingIdentifiableView( - id: self.id, - body: content - ) - } + func body(content: Content) -> some View { content } } extension View { - /// `ViewModifier` assigning an identifier to the `View` it is applied to. - /// When applying this modifier repeatedly, the outermost ``onboardingIdentifier(_:)`` counts. + /// Assign a unique identifier to a ``SwiftUI/View`` appearing in an ``OnboardingStack``. + /// + /// A `ViewModifier` assigning an identifier to the `View` it is applied to. + /// When applying this modifier repeatedly, the outermost ``SwiftUI/View/onboardingIdentifier(_:)`` counts. /// /// - Note: This `ViewModifier` should only be used to identify `View`s of the same type within an ``OnboardingStack``. ///