yattee/Apple TV/VideosCellsView.swift

32 lines
758 B
Swift
Raw Normal View History

import Defaults
2021-06-23 22:19:58 +00:00
import SwiftUI
struct VideosCellsView: View {
@Default(.tabSelection) var tabSelection
2021-06-23 22:19:58 +00:00
@State private var columns: Int
init(videos: [Video], columns: Int = 3) {
self.videos = videos
self.columns = columns
}
var videos = [Video]()
var body: some View {
2021-06-26 09:39:35 +00:00
ScrollView(.vertical, showsIndicators: false) {
2021-06-23 22:19:58 +00:00
LazyVGrid(columns: items, spacing: 10) {
ForEach(videos) { video in
VideoCellView(video: video)
.contextMenu { VideoContextMenuView(video: video) }
2021-06-23 22:19:58 +00:00
}
}
.padding()
}
}
var items: [GridItem] {
Array(repeating: .init(.fixed(600)), count: columns)
}
}