Code style changes

This commit is contained in:
Arkadiusz Fal
2023-04-22 15:08:33 +02:00
parent afa0049333
commit a9e9fa3a6d
31 changed files with 52 additions and 46 deletions

View File

@@ -327,7 +327,7 @@ struct ChannelVideosView: View {
private var contentTypePicker: some View {
Picker("Content type", selection: $contentType) {
if let channel = presentedChannel {
if presentedChannel != nil {
ForEach(Channel.ContentType.allCases, id: \.self) { type in
if typeAvailable(type) {
Label(type.description, systemImage: type.systemImage).tag(type)
@@ -432,18 +432,20 @@ struct ChannelVideosView: View {
}
func load() {
resource?.load().onSuccess { response in
if let page: ChannelPage = response.typedContent() {
if let channel = page.channel {
ChannelsCacheModel.shared.store(channel)
resource?
.load()
.onSuccess { response in
if let page: ChannelPage = response.typedContent() {
if let channel = page.channel {
ChannelsCacheModel.shared.store(channel)
}
self.page = page
self.contentTypeItems.replace(page.results)
}
self.page = page
self.contentTypeItems.replace(page.results)
}
}
.onFailure { error in
navigation.presentAlert(title: "Could not load channel data", message: error.userMessage)
}
.onFailure { error in
navigation.presentAlert(title: "Could not load channel data", message: error.userMessage)
}
}
func loadNextPage() {