generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifications: * identify `OnboardingStack` views through `id: any Hashable` instead of `id: String` * rename `.id(_:)` view modifier to `.onboardingIdentifier(_:)` to disambiguate from SwiftUI's own `.id(_:)` view modifier * refactor `OnboardingStepIdentifier` to store a custom hash of the given view / view id * add `extension ModifiedContent` to conditionally make it `Identifiable` * adjust UITest to verify that the `.onboardingIdentifier(_:)` works * add `.onboardingIdentifier(_:)` example in `OnboardingStack` DocC documentation * make sure to only expose API that has to be exposed
- Loading branch information
1 parent
8edfc57
commit 167f639
Showing
8 changed files
with
150 additions
and
41 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
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
41 changes: 41 additions & 0 deletions
41
Tests/UITests/TestApp/Views/OnboardingTestViewNotIdentifiable.swift
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,41 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open-source project | ||
// | ||
// SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import SpeziOnboarding | ||
import SwiftUI | ||
|
||
struct OnboardingTestViewNotIdentifiable: View { | ||
var text: String | ||
|
||
@Environment(OnboardingNavigationPath.self) private var path | ||
|
||
|
||
var body: some View { | ||
VStack(spacing: 12) { | ||
Text(self.text) | ||
|
||
Button { | ||
path.nextStep() | ||
} label: { | ||
Text("Next") | ||
} | ||
} | ||
} | ||
} | ||
|
||
#if DEBUG | ||
struct OnboardingTestViewNotIdentifiable_Previews: PreviewProvider { | ||
static var previews: some View { | ||
OnboardingStack(startAtStep: OnboardingTestViewNotIdentifiable.self) { | ||
for onboardingView in OnboardingFlow.previewSimulatorViews { | ||
onboardingView | ||
} | ||
} | ||
} | ||
} | ||
#endif |
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