diffableDataSource: UITableViewDiffableDataSource<Section, FeedItemCore.State.ID>! diffableDataSource = .init(tableView: tableView) { [weak self] tableView, indexPath, identifier -> UITableViewCell in guard let self = self else { return UITableViewCell() } guard let itemState = ViewStore(self.store).items[id: identifier] else { return UITableViewCell() } let itemStore: Store<FeedItemCore.State, FeedItemCore.Action> = self.store.scope( state: { $0.items[id: identifier] ?? itemState }, action: { .item(id: identifier, action: $0) } ) switch itemState { case .article: let store: Store<ArticleCore.State, ArticleCore.Action> = itemStore.scope( state: { parentState in (/FeedItemCore.State.article).extract(from: parentState)! }, action: FeedItemCore.Action.article) let cell = tableView.dequeueReusableCell( withIdentifier: String(describing: HostingCell<ArticleView>.self), for: indexPath) as! HostingCell<ArticleView> cell.setView(rootView: ArticleView(store: store), parentController: self) return cell case .video: ... CasePathの仕組みで記事セルのStateを 抽出