mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Change syntax to overcome compiler issue
This commit is contained in:
parent
5bac92fdbf
commit
f7b35925b4
@ -62,6 +62,10 @@ struct Channel: Identifiable, Hashable {
|
||||
return "person.3"
|
||||
}
|
||||
}
|
||||
|
||||
var alwaysAvailable: Bool {
|
||||
self == .videos || self == .playlists
|
||||
}
|
||||
}
|
||||
|
||||
struct Tab: Identifiable, Hashable {
|
||||
|
@ -322,7 +322,7 @@ struct ChannelVideosView: View {
|
||||
Picker("Content type", selection: $contentType) {
|
||||
if let channel = presentedChannel {
|
||||
ForEach(Channel.ContentType.allCases, id: \.self) { type in
|
||||
if type == .videos || type == .playlists || channel.hasData(for: type) {
|
||||
if typeAvailable(type) {
|
||||
Label(type.description, systemImage: type.systemImage).tag(type)
|
||||
}
|
||||
}
|
||||
@ -330,6 +330,10 @@ struct ChannelVideosView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func typeAvailable(_ type: Channel.ContentType) -> Bool {
|
||||
type.alwaysAvailable || (presentedChannel?.hasData(for: type) ?? false)
|
||||
}
|
||||
|
||||
private var resource: Resource? {
|
||||
guard let channel = presentedChannel else { return nil }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user