Created
October 24, 2025 00:35
-
-
Save bannzai/74a93c291d53bbd67c02cd5da3310572 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| struct SnapshotUITest<T: PreviewProvider>: View { | |
| var navigationBarIsHidden = false | |
| var body: some View { | |
| VStack(alignment: .leading, spacing: 16) { | |
| Text(verbatim: "\(T.self)") | |
| .font(.title3) | |
| VStack(alignment: .leading) { | |
| ForEach(T._allPreviews.indices, id: \.self) { index in | |
| let preview = T._allPreviews[index] | |
| NavigationLink { | |
| if navigationBarIsHidden { | |
| preview.content | |
| .navigationBarBackButtonHidden() | |
| } else { | |
| preview.content | |
| } | |
| } label: { | |
| Text(verbatim: "\(T.self)_\(index)") | |
| .accessibilityLabel(Text(verbatim: "\(T.self)_\(index)")) | |
| .font(.body) | |
| .foregroundStyle(Color.accentColor) | |
| } | |
| .buttonStyle(.plain) | |
| } | |
| Divider() | |
| } | |
| .frame(maxWidth: .infinity) | |
| } | |
| .padding() | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用例