// // SectionEventBannerView.swift // SodaLive // // Created by klaus on 2023/08/09. // import SwiftUI import Kingfisher struct SectionEventBannerView: View { @State private var currentIndex = -1 @State private var timer = Timer.publish(every: 3, on: .main, in: .common).autoconnect() let items: [EventItem] var body: some View { GeometryReader { proxy in VStack(spacing: 13.3) { TabView(selection: $currentIndex) { ForEach(0.. 0, let url = URL(string: link), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } } } else { KFImage(URL(string: item.thumbnailImageUrl)) .resizable() .frame(width: proxy.size.width, height: proxy.size.height, alignment: .center) .tag(index) .onTapGesture { if let _ = item.detailImageUrl { AppState.shared.setAppStep(step: .eventDetail(event: item)) } else if let link = item.link, link.trimmingCharacters(in: .whitespaces).count > 0, let url = URL(string: link), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } } } } } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) .frame( width: proxy.size.width, height: proxy.size.height, alignment: .center ) HStack(spacing: 4) { ForEach(0..