Minor UI improvements, state saving

This commit is contained in:
Arkadiusz Fal
2021-06-28 17:02:13 +02:00
parent b840974f08
commit f7d0e2131c
10 changed files with 52 additions and 60 deletions

View File

@@ -1,20 +0,0 @@
import AVFoundation
import Foundation
final class AppState: ObservableObject {
@Published var showingChannel = false
@Published var channelID: String = ""
@Published var channel: String = ""
func openChannel(from video: Video) {
channel = video.author
channelID = video.channelID
showingChannel = true
}
func closeChannel() {
showingChannel = false
channel = ""
channelID = ""
}
}

12
Model/Channel.swift Normal file
View File

@@ -0,0 +1,12 @@
import AVFoundation
import Defaults
import Foundation
struct Channel: Codable, Defaults.Serializable {
var id: String
var name: String
static func from(video: Video) -> Channel {
Channel(id: video.channelID, name: video.author)
}
}