// // ContentMainBannerView.swift // SodaLive // // Created by klaus on 2023/08/11. // import SwiftUI import Kingfisher struct ContentMainBannerView: View { let items: [GetAudioContentBannerResponse] @State private var currentIndex = 0 @State private var timer = Timer.publish(every: 3, on: .main, in: .common).autoconnect() var body: some View { VStack(spacing: 0) { TabView(selection: $currentIndex) { ForEach(0.. 0, let url = URL(string: link), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } } } .cornerRadius(4.7) } else { KFImage(URL(string: item.thumbnailImageUrl)) .resizable() .scaledToFill() .frame( width: screenSize().width - 26.7, height: (screenSize().width - 26.7) * 0.53 ) .onTapGesture { switch item.type { case .EVENT: AppState.shared.setAppStep(step: .eventDetail(event: item.eventItem!)) case .CREATOR: AppState.shared.setAppStep(step: .creatorDetail(userId: item.creatorId!)) case .LINK: if let link = item.link, link.trimmingCharacters(in: .whitespaces).count > 0, let url = URL(string: link), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } } } .cornerRadius(4.7) } } } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) .frame( width: screenSize().width - 26.7, height: (screenSize().width - 26.7) * 0.53 ) HStack(spacing: 4) { ForEach(0..