// // ContentMainBannerView.swift // SodaLive // // Created by klaus on 2023/08/11. // import SwiftUI import Kingfisher struct ContentMainBannerView: View { @StateObject private var viewModel = ContentMainBannerViewModel() var body: some View { ZStack { if !viewModel.bannerList.isEmpty { VStack(spacing: 0) { TabView(selection: $viewModel.currentIndex) { ForEach(0.. 0, let url = URL(string: link), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } } } .onAppear { let urlString = item.thumbnailImageUrl.addingPercentEncoding( withAllowedCharacters: .urlQueryAllowed ) ?? item.thumbnailImageUrl boundURL = URL(string: urlString) } .onDisappear { boundURL = nil } } } struct ContentMainBannerView_Previews: PreviewProvider { static var previews: some View { ContentMainBannerView() } }