// // TSCollectionViewVM+Ex.swift // AIRingtone // // Created by 100Years on 2025/2/28. // struct TSColVVMSizeConfig { var sectionInset: UIEdgeInsets var lineSpacing: CGFloat var itemSpacing: CGFloat var originalSize:CGSize //一行几个cell var cellRowNum:Int var cellSize:CGSize var cellClass: UICollectionViewCell.Type var headerViewSize:CGSize var headerView:UICollectionReusableView.Type var footerViewSize:CGSize var footerView:UICollectionReusableView.Type } //MARK: 主题引导 let themeGuideConfig:TSColVVMSizeConfig = { let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) let lineSpacing = 0.0 let itemSpacing = 0.0 let originalSize = CGSizeMake(343, 109) let cellRowNum = 1 let originalScale = originalSize.width/originalSize.height var w = k_ScreenWidth-sectionInset.left-sectionInset.right w = w - lineSpacing * CGFloat((cellRowNum-1)) w = w/CGFloat(cellRowNum) let h = w/originalScale let cellSize = CGSizeMake(w, h) let cellClass = TSThemeBannerCell.self let headerViewSize = CGSize.zero let headerView = TSColVVMSectionHeaderView.self let footerViewSize = CGSizeMake(k_ScreenWidth, 60) let footerView = UICollectionReusableView.self var config = TSColVVMSizeConfig( sectionInset: sectionInset, lineSpacing: lineSpacing, itemSpacing: itemSpacing, originalSize: originalSize, cellRowNum: cellRowNum, cellSize: cellSize, cellClass: cellClass, headerViewSize: headerViewSize, headerView: headerView, footerViewSize: footerViewSize, footerView: footerView ) return config }() //MARK: 主题内容 let themeContentConfig:TSColVVMSizeConfig = { let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) let lineSpacing = 16.0 let itemSpacing = 16.0 let originalSize = CGSizeMake(163.0, 353.0) let cellRowNum = 2 let originalScale = originalSize.width/originalSize.height var w = k_ScreenWidth-sectionInset.left-sectionInset.right w = w - lineSpacing * CGFloat((cellRowNum-1)) w = w/CGFloat(cellRowNum) let h = w/originalScale let cellSize = CGSizeMake(w, h) let cellClass = TSThemeContentCell.self let headerViewSize = CGSizeMake(k_ScreenWidth, 0) let headerView = TSColVVMSectionHeaderView.self let footerViewSize = CGSizeMake(k_ScreenWidth, 0) let footerView = UICollectionReusableView.self var config = TSColVVMSizeConfig( sectionInset: sectionInset, lineSpacing: lineSpacing, itemSpacing: itemSpacing, originalSize: originalSize, cellRowNum: cellRowNum, cellSize: cellSize, cellClass: cellClass, headerViewSize: headerViewSize, headerView: headerView, footerViewSize: footerViewSize, footerView: footerView ) return config }() //MARK: 海报内容 let posterHistoryConfig:TSColVVMSizeConfig = { let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) let lineSpacing = 8.0 let itemSpacing = 8.0 let originalSize = CGSizeMake(109.0, 194.0) let cellRowNum = 3 let originalScale = originalSize.width/originalSize.height var w = k_ScreenWidth-sectionInset.left-sectionInset.right w = w - lineSpacing * CGFloat((cellRowNum-1)) w = w/CGFloat(cellRowNum) let h = w/originalScale let cellSize = CGSizeMake(w, h) let cellClass = TSAIPhotoImageCell.self let headerViewSize = CGSizeMake(k_ScreenWidth, 0) let headerView = TSColVVMSectionHeaderView.self let footerViewSize = CGSizeMake(k_ScreenWidth, 0) let footerView = UICollectionReusableView.self var config = TSColVVMSizeConfig( sectionInset: sectionInset, lineSpacing: lineSpacing, itemSpacing: itemSpacing, originalSize: originalSize, cellRowNum: cellRowNum, cellSize: cellSize, cellClass: cellClass, headerViewSize: headerViewSize, headerView: headerView, footerViewSize: footerViewSize, footerView: footerView ) return config }() //MARK: 头像内容 let photoHistoryConfig:TSColVVMSizeConfig = { let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) let lineSpacing = 8.0 let itemSpacing = 8.0 let originalSize = CGSizeMake(109.0, 109.0) let cellRowNum = 3 let originalScale = originalSize.width/originalSize.height var w = k_ScreenWidth-sectionInset.left-sectionInset.right w = w - lineSpacing * CGFloat((cellRowNum-1)) w = w/CGFloat(cellRowNum) let h = w/originalScale let cellSize = CGSizeMake(w, h) let cellClass = TSAIPhotoImageCell.self let headerViewSize = CGSizeMake(k_ScreenWidth, 0) let headerView = TSColVVMSectionHeaderView.self let footerViewSize = CGSizeMake(k_ScreenWidth, 0) let footerView = UICollectionReusableView.self var config = TSColVVMSizeConfig( sectionInset: sectionInset, lineSpacing: lineSpacing, itemSpacing: itemSpacing, originalSize: originalSize, cellRowNum: cellRowNum, cellSize: cellSize, cellClass: cellClass, headerViewSize: headerViewSize, headerView: headerView, footerViewSize: footerViewSize, footerView: footerView ) return config }() //MARK: ring Categories 分类配置 let ringCategoriesConfig:TSColVVMSizeConfig = { let sectionInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16) let lineSpacing = 16.0 let itemSpacing = 16.0 let originalSize = CGSizeMake(104.0, 104.0) let cellRowNum = 3 let originalScale = originalSize.width/originalSize.height var w = k_ScreenWidth-sectionInset.left-sectionInset.right w = w - lineSpacing * CGFloat((cellRowNum-1)) w = w/CGFloat(cellRowNum) let h = w/originalScale let cellSize = CGSizeMake(w, h) let cellClass = TSDiscoverCell.self let headerViewSize = CGSizeMake(k_ScreenWidth, 0) let headerView = TSColVVMSectionHeaderView.self let footerViewSize = CGSizeMake(k_ScreenWidth, 0) let footerView = UICollectionReusableView.self var config = TSColVVMSizeConfig( sectionInset: sectionInset, lineSpacing: lineSpacing, itemSpacing: itemSpacing, originalSize: originalSize, cellRowNum: cellRowNum, cellSize: cellSize, cellClass: cellClass, headerViewSize: headerViewSize, headerView: headerView, footerViewSize: footerViewSize, footerView: footerView ) return config }() //MARK: ring list 配置 let ringListConfig:TSColVVMSizeConfig = { let sectionInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16) let lineSpacing = 13.0 let itemSpacing = 13.0 let originalSize = CGSizeMake(343.0, 72) let cellRowNum = 1 let originalScale = originalSize.width/originalSize.height var w = k_ScreenWidth-sectionInset.left-sectionInset.right w = w - lineSpacing * CGFloat((cellRowNum-1)) w = w/CGFloat(cellRowNum) let h = w/originalScale let cellSize = CGSizeMake(w, h) let cellClass = TSAIRintoneHistoryCell.self // TSDiscoverListCell.self let headerViewSize = CGSizeMake(k_ScreenWidth, 0) let headerView = TSColVVMSectionHeaderView.self let footerViewSize = CGSizeMake(k_ScreenWidth, 0) let footerView = UICollectionReusableView.self var config = TSColVVMSizeConfig( sectionInset: sectionInset, lineSpacing: lineSpacing, itemSpacing: itemSpacing, originalSize: originalSize, cellRowNum: cellRowNum, cellSize: cellSize, cellClass: cellClass, headerViewSize: headerViewSize, headerView: headerView, footerViewSize: footerViewSize, footerView: footerView ) return config }()