Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to use the NaivgationStackView to manage the back stack. #374

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Hymns.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
3B90969B245F7F14000229A2 /* HymnEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B90969A245F7F14000229A2 /* HymnEntity.swift */; };
3B9ED1BE2486272600BD004E /* BrowseResultsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9ED1BD2486272600BD004E /* BrowseResultsListView.swift */; };
3B9ED1C02486296000BD004E /* BrowseResultsListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9ED1BF2486296000BD004E /* BrowseResultsListViewModel.swift */; };
3B9EE5C424B1B5C900976DC6 /* NavigationStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9EE5C324B1B5C900976DC6 /* NavigationStack.swift */; };
3BA4612524771C460068F269 /* SongInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA4612424771C460068F269 /* SongInfoViewModel.swift */; };
3BA4612724771EAD0068F269 /* SongInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA4612624771EAD0068F269 /* SongInfoView.swift */; };
3BA4612B24772B250068F269 /* SongInfoDialogView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA4612A24772B250068F269 /* SongInfoDialogView.swift */; };
Expand Down Expand Up @@ -389,6 +390,7 @@
3B9AE08D245902920027C571 /* classic40.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = classic40.json; sourceTree = "<group>"; };
3B9ED1BD2486272600BD004E /* BrowseResultsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseResultsListView.swift; sourceTree = "<group>"; };
3B9ED1BF2486296000BD004E /* BrowseResultsListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseResultsListViewModel.swift; sourceTree = "<group>"; };
3B9EE5C324B1B5C900976DC6 /* NavigationStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStack.swift; sourceTree = "<group>"; };
3BA4612424771C460068F269 /* SongInfoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongInfoViewModel.swift; sourceTree = "<group>"; };
3BA4612624771EAD0068F269 /* SongInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongInfoView.swift; sourceTree = "<group>"; };
3BA4612A24772B250068F269 /* SongInfoDialogView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongInfoDialogView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -765,6 +767,7 @@
3B20368D248C0E8200D90DF5 /* ErrorView.swift */,
3B369CEB246D07580068A29C /* PDFViewer.swift */,
3B3DF63C24A280D100E60ED9 /* IconSizeConstants.swift */,
3B9EE5C324B1B5C900976DC6 /* NavigationStack.swift */,
3BB1DCB4244D55770011169D /* SearchBar.swift */,
B5A00F5E245277E300F7E3E1 /* ActivityIndicator.swift */,
3B369CEF246D0D570068A29C /* WebView.swift */,
Expand Down Expand Up @@ -1678,6 +1681,7 @@
3B04D2FE2489819A008C7E5E /* TagStore.swift in Sources */,
3B2E84B5246FA88800EA4329 /* SongResultEntity.swift in Sources */,
3B25C0EA24503B7E00C435E1 /* HistoryStore.swift in Sources */,
3B9EE5C424B1B5C900976DC6 /* NavigationStack.swift in Sources */,
3B5935A424357CA000E6993C /* HymnType.swift in Sources */,
3B203688248B864E00D90DF5 /* ScriptureResult.swift in Sources */,
3B9ED1C02486296000BD004E /* BrowseResultsListViewModel.swift in Sources */,
Expand Down
13 changes: 8 additions & 5 deletions Hymns/Browse/BrowseResultsListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ struct BrowseResultsListView: View {
var body: some View {
VStack {
HStack {
Button(action: {
self.presentationMode.wrappedValue.dismiss()
}, label: {
PopView {
Image(systemName: "chevron.left").accentColor(.primary)
}).padding()
}.padding()
// Button(action: {
// self.presentationMode.wrappedValue.dismiss()
// }, label: {
// Image(systemName: "chevron.left").accentColor(.primary)
// }).padding()
Text(viewModel.title).font(.body).fontWeight(.bold)
Spacer()
}
if viewModel.songResults.isEmpty {
ErrorView().maxSize()
} else {
List(viewModel.songResults) { songResult in
NavigationLink(destination: songResult.destinationView) {
PushView(destination: songResult.destinationView) {
SongResultView(viewModel: songResult)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Hymns/Browse/CategoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct CategoryView: View {
if isExpanded {
List {
ForEach(viewModel.subcategories, id: \.self) { subcategory in
NavigationLink(destination: BrowseResultsListView(viewModel: BrowseResultsListViewModel(category: self.viewModel.category, subcategory: subcategory.subcategory, hymnType: self.viewModel.hymnType))) {
PushView(destination: BrowseResultsListView(viewModel: BrowseResultsListViewModel(category: self.viewModel.category, subcategory: subcategory.subcategory, hymnType: self.viewModel.hymnType))) {
SubcategoryView(viewModel: subcategory)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Hymns/Browse/ScriptureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct ScriptureView: View {
}.foregroundColor(isExpanded ? .accentColor : .primary)
if isExpanded {
List(viewModel.scriptureSongs, id: \.self) { scriptureSong in
NavigationLink(destination: DisplayHymnView(viewModel: DisplayHymnViewModel(hymnToDisplay: scriptureSong.hymnIdentifier))) {
PushView(destination: DisplayHymnView(viewModel: DisplayHymnViewModel(hymnToDisplay: scriptureSong.hymnIdentifier))) {
ScriptureSongView(viewModel: scriptureSong)
}
}.frame(height: CGFloat(viewModel.scriptureSongs.count * 45))
Expand Down
2 changes: 1 addition & 1 deletion Hymns/Browse/TagListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct TagListView: View {
}.eraseToAnyView()
}
return List(tags, id: \.self) { tag in
NavigationLink(destination: BrowseResultsListView(viewModel: BrowseResultsListViewModel(tag: tag))) {
PushView(destination: BrowseResultsListView(viewModel: BrowseResultsListViewModel(tag: tag))) {
Text(tag.title).tagPill(backgroundColor: tag.color.background, foregroundColor: tag.color.foreground)
}
}.padding(.top).eraseToAnyView()
Expand Down
Loading