Catalyst App
Clips:
1st, demo the old Storyboard, TabViewController (ltsMediaPlayer)
2nd, demo the A,B,C. SwiftUI (ltsSuiTabView)
3rd, UWP style, ltsMediaViewer2
Released to Public Domain
(Template only)
ltsSuiTabView
https://1drv.ms/u/s!ApN1U-GH6AeIoBMza...
ltsSuiTabView, 3 versions:
A: MyTabViewWidget, single widget, out-going widget will be disposed.
B: MyTabViewWidget2, multiple widget(s), simultaneously, existed and active.
C: Using Picker, per Sean Allen, • SwiftUI Segmented Control Tutorial | iOS 1...
(set testCase = 3)
______
A
______
@Binding var selectedIndex: Int
var body: some View
{
GeometryReader
{ g in
ZStack
{
if selectedIndex == 0
{
LogoView
.animation(.easeInOut(duration: 1.0))
.transition(.slide)
}
else if selectedIndex == 1
{
ImageView()
.animation(.easeInOut(duration: 1.0))
.transition(.slide)
}
else if selectedIndex == 2
{
AudioWidget()
.animation(.easeInOut(duration: 1.0))
.transition(.slide)
}
else if selectedIndex == 3
{
VideoPlayerView()
.animation(.easeInOut(duration: 1.0))
.transition(.slide)
}
else if selectedIndex == 4
{
SnapshotView()
.animation(.easeInOut(duration: 1.0))
.transition(.slide)
}
else if selectedIndex == 5
{
GifVidGenView()
.animation(.easeInOut(duration: 1.0))
.transition(.slide)
}
}
.frame(width: g.size.width, height: g.size.height )
}
}
_________
B
_________
@Binding var selectedIndex: Int
var body: some View
{
GeometryReader
{ g in
ZStack
{
LogoView
.opacity(selectedIndex == 0 ? 1.0 : 0.0)
.animation(.easeInOut(duration: 1.0))
ImageView()
.opacity(selectedIndex == 1 ? 1.0 : 0.0)
.animation(.easeInOut(duration: 1.0))
AudioWidget()
.opacity(selectedIndex == 2 ? 1.0 : 0.0)
.animation(.easeInOut(duration: 1.0))
VideoPlayerView()
.opacity(selectedIndex == 3 ? 1.0 : 0.0)
.animation(.easeInOut(duration: 1.0))
SnapshotView()
.opacity(selectedIndex == 4 ? 1.0 : 0.0)
.animation(.easeInOut(duration: 1.0))
GifVidGenView()
.opacity(selectedIndex == 5 ? 1.0 : 0.0)
.animation(.easeInOut(duration: 1.0))
}
.frame(width: g.size.width, height: g.size.height )
}
}
_________________
ContentView
_________________
struct ContentView: View
{
@State private var mainViewWidth : CGFloat = 100
@State private var mainViewHeight : CGFloat = 100
@State private var mainViewPadding : EdgeInsets = EdgeInsets.init(top: 6, leading: 6, bottom: 6, trailing: 6)
@State private var currentTab : Int = 0
let testCase : Int = 1 // 1,2,3
@State private var currentPivorItem : MyPivotItem = .logo
var body: some View
{
GeometryReader
{ g in
ZStack
{ // Sizing
Color.init(0x111111,0.77)
.preference(key: RenderBoxSizeKey.self, value: g.size)
ZStack
{
// ++++++++++++++++++++++++ M A I N U I +++++++++++++++++++++++++++++++
if testCase == 1
{
MyTabViewWidget.init(selectedIndex: $currentTab )
.frame(width: mainViewWidth, height: mainViewHeight)
.padding(mainViewPadding)
}
else if testCase == 2
..... too long, sorry, Download the source please.
Resouces:
XCODE 12.4
MacOS 11.1
Test.mp3 (removed from Upload)