Fableon/Fableon/Class/Home/V/FAHomeNewContentCell.swift
2025-10-16 11:39:38 +08:00

36 lines
980 B
Swift

//
// FAHomeNewContentCell.swift
// Fableon
//
// Created by 鸿 on 2025/9/16.
//
import UIKit
import SwiftUI
class FAHomeNewContentCell: UICollectionViewCell {
private var hostingVC: UIHostingController<FAHomeNewView>?
func configure(_ viewModel: FAHomeViewModel) {
// self.contentConfiguration = UIHostingConfiguration(content: {
// FAHomeNewView(viewModel: viewModel)
// })
// .margins(.all, 0)
let uiView = FAHomeNewView(viewModel: viewModel)
if let hostingVC = hostingVC {
hostingVC.rootView = uiView
} else {
let hostingVC = UIHostingController(rootView: uiView)
hostingVC.view.backgroundColor = .clear
contentView.addSubview(hostingVC.view)
hostingVC.view.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
self.hostingVC = hostingVC
}
}
}