Fix compiling for Catalyst and visionOS

This commit is contained in:
Shadowfacts 2025-02-07 12:00:24 -05:00
parent fc458fc5f3
commit 2e3891c468
3 changed files with 7 additions and 1 deletions

View File

@ -210,11 +210,15 @@ private class WrappedCollectionViewController: UIViewController {
return section return section
} }
let attachmentCell = UICollectionView.CellRegistration<HostingCollectionViewCell, DraftAttachment> { [unowned self] cell, indexPath, attachment in let attachmentCell = UICollectionView.CellRegistration<HostingCollectionViewCell, DraftAttachment> { [unowned self] cell, indexPath, attachment in
#if !os(visionOS)
cell.containingViewController = self cell.containingViewController = self
#endif
cell.setView(AttachmentCollectionViewCellView(attachment: attachment)) cell.setView(AttachmentCollectionViewCellView(attachment: attachment))
} }
let addButtonCell = UICollectionView.CellRegistration<HostingCollectionViewCell, Void> { [unowned self] cell, indexPath, item in let addButtonCell = UICollectionView.CellRegistration<HostingCollectionViewCell, Void> { [unowned self] cell, indexPath, item in
#if !os(visionOS)
cell.containingViewController = self cell.containingViewController = self
#endif
cell.setView(AddAttachmentButton(viewController: self)) cell.setView(AddAttachmentButton(viewController: self))
} }
let collectionView = IntrinsicContentSizeCollectionView(frame: .zero, collectionViewLayout: layout) let collectionView = IntrinsicContentSizeCollectionView(frame: .zero, collectionViewLayout: layout)

View File

@ -27,7 +27,7 @@ struct ComposeNavigationBarActions: ToolbarContent {
DraftsButton(isShowingDrafts: $isShowingDrafts) DraftsButton(isShowingDrafts: $isShowingDrafts)
} }
ToolbarItem(placement: .confirmationAction) { ToolbarItem(placement: .confirmationAction) {
PostButton(draft: draft, isPosting: isPosting) PostButton(draft: draft, isPosting: isPosting, postStatus: postStatus)
} }
#else #else
ToolbarItem(placement: .confirmationAction) { ToolbarItem(placement: .confirmationAction) {

View File

@ -137,7 +137,9 @@ private struct ComposeViewBody: View {
ScrollView { ScrollView {
scrollContent scrollContent
} }
#if !os(visionOS)
.scrollDismissesKeyboardInteractivelyIfAvailable() .scrollDismissesKeyboardInteractivelyIfAvailable()
#endif
#if !os(visionOS) && !targetEnvironment(macCatalyst) #if !os(visionOS) && !targetEnvironment(macCatalyst)
.modifier(ToolbarSafeAreaInsetModifier()) .modifier(ToolbarSafeAreaInsetModifier())
#endif #endif