我得到了他的表视图 nil 致命错误:在隐式展开可选值时意外发现 nil。
final class SculpturesARViewController: UIViewController {
private func presentSheetView() {
let sheetViewController = SculpturesSheetViewController()
if let sheet = sheetViewController.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.selectedDetentIdentifier = .medium
sheet.preferredCornerRadius = 20
sheet.prefersGrabberVisible = true
}
present(sheetViewController, animated: true)
}
}
final class SculpturesSheetViewController: UIViewController {
@IBOutlet private weak var sculpturesTableView: UITableView!
typealias DataSource = UITableViewDiffableDataSource<SculpturesSections, SculpturesRows>
typealias Snapshot = NSDiffableDataSourceSnapshot<SculpturesSections, SculpturesRows>
override func viewDidLoad() {
super.viewDidLoad()
setUp()
viewModel = SculpturesSheetViewModel(sculpturesSheetService: SculpturesNetworkService(),
params: SculpturesParameters(languageId: "en"))
}
private func setUp() {
configureTableView()
cellFactory = SculpturesCellFactory(tableView: sculpturesTableView,
sculpturesViewController: self)
}
private func configureTableView() {
sculpturesTableView.dataSource = dataSource
let sections: [Any] = [SummaryTableViewCell.self, Video.self, ARFeatures.self]
sections.forEach { section in
let nibSection = UINib(nibName: String(describing: section), bundle: Bundle(for: type(of: self)))
sculpturesTableView.register(nibSection, forCellReuseIdentifier: "\(section)")
}
}
已尝试删除插座并再次连接它,添加委托,以不同的方式实例化为:letsheetViewController = SculpturesSheetViewController(nibName:“SculpturesSheetViewController”,bundle:nil) 但是当我这样做时,我收到错误:线程 1:“无法在捆绑包中加载 NIB:'NSBundle (已加载)',名称为 'SculpturesSheetViewController'”
怎么了? 没有任何效果