SwiftUI Catalyst App - GridView, Conditional Rendering

Опубликовано: 16 Февраль 2026
на канале: Lawrence Tsang
6
0

Experiments, no idea, zero, IS this, the correct approach?

This test, display Video Thumnail, Still Image Thumbnail or
Gif-widget-animated.


if !isLoading
{
ScrollView(.vertical, showsIndicators: true)
{
LazyVGrid(columns: columns)
{
ForEach(listOfItems)
{ item in

if ["mov", "m4v", "mp4"].contains( item.url.pathExtension )
{
VideoThumbnailView.init(tnUrl: item.url, delegate: self )
}
else if item.url.pathExtension != "gif"
{
ThumbnailViewObsWidget.init(tnUrl: item.url, delegate: nil, cvDelegate: cvDelegate)
}
else
{
GifWidget.init(tnUrl: item.url, delegate: self )
}
}
}.padding(16)

} // SV
.padding(.horizontal)
}

Sorry, limited text size, see the video for the code(S) hehehehe