Listing styles

This commit is contained in:
Arkadiusz Fal
2022-12-12 01:18:29 +01:00
parent c2d16774f7
commit 25da312966
19 changed files with 305 additions and 45 deletions

View File

@@ -9,6 +9,8 @@ struct TrendingView: View {
@Default(.trendingCategory) private var category
@Default(.trendingCountry) private var country
@Default(.trendingListingStyle) private var trendingListingStyle
@State private var presentingCountrySelection = false
@State private var favoriteItem: FavoriteItem?
@@ -46,6 +48,7 @@ struct TrendingView: View {
.environment(\.scrollViewBottomPadding, 70)
#endif
}
.environment(\.listingStyle, trendingListingStyle)
}
.toolbar {
@@ -119,10 +122,16 @@ struct TrendingView: View {
}
}
#endif
#if !os(macOS)
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
resource.loadIfNeeded()
#if os(macOS)
.toolbar {
ToolbarItem {
ListingStyleButtons(listingStyle: $trendingListingStyle)
}
}
#else
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
resource.loadIfNeeded()
}
#endif
}
@@ -163,6 +172,8 @@ struct TrendingView: View {
categoryButton
}
ListingStyleButtons(listingStyle: $trendingListingStyle)
Section {
SettingsButtons()
}