122 lines
3.2 KiB
Swift
122 lines
3.2 KiB
Swift
//
|
|
// ContentView.swift
|
|
// vrtnu
|
|
//
|
|
// Created by Jens Timmerman on 23/09/2020.
|
|
//
|
|
|
|
import SwiftUI
|
|
import AVKit
|
|
import AVFoundation
|
|
import Combine
|
|
|
|
|
|
struct ContentView: View {
|
|
var body: some View {
|
|
NavigationView(){
|
|
List(VRTNu().shows, id: \.self){ show in
|
|
NavigationLink(destination: ShowView(show: show)){
|
|
Text(show.title)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
struct ShowView: View {
|
|
var show: Show
|
|
var body: some View {
|
|
NavigationView(){
|
|
List(show.getSeasons(), id: \.self){ season in
|
|
NavigationLink(destination: SeasonView(season: season)){
|
|
Text(season.seasonName)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SeasonView: View {
|
|
var season: Season
|
|
var body: some View {
|
|
NavigationView(){
|
|
List(season.getEpisodes(), id:\.self){ episode in
|
|
NavigationLink(destination: VideoView(episode: episode)){
|
|
VStack{
|
|
Text(episode.name)
|
|
AsyncImage(url: episode.imageurl,placeholder: {
|
|
//Image(name: "loading")
|
|
Text("Loading...")
|
|
},image:{Image(uiImage:$0)})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct VideoView: View {
|
|
var episode: Episode
|
|
|
|
|
|
var body: some View {
|
|
let url = episode.getVideo().hlsUrl
|
|
let player = AVPlayer(url: url);
|
|
VideoPlayer(player: player).fixedSize()
|
|
};
|
|
|
|
|
|
}
|
|
struct ContentView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
//SeasonView(season: VRTNu().shows[0].getSeasons()[0])
|
|
ContentView()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/*struct OldContentView: View {
|
|
var body: some View {
|
|
NavigationView(){
|
|
VStack(alignment: .leading) {
|
|
ForEach(VRTNu().shows, id: \.self){ show in
|
|
VStack{
|
|
Text(show.title)
|
|
HStack{
|
|
|
|
ForEach(show.seasons, id:\.self){ season in
|
|
|
|
List(season.episodes, id:\.self){ episode in
|
|
NavigationLink(destination: VideoView(url: episode.video.hlsUrl)){
|
|
VStack{
|
|
Text(season.seasonName)
|
|
Text(episode.name)
|
|
AsyncImage(url: episode.imageurl,placeholder: {
|
|
//Image(name: "loading")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
Text("Loading...")
|
|
},image:{Image(uiImage:$0).resizable()})
|
|
}}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
|