Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Delegate] implement additional context menu APIs #1

Open
jessesquires opened this issue Oct 25, 2019 · 6 comments
Open

[Delegate] implement additional context menu APIs #1

jessesquires opened this issue Oct 25, 2019 · 6 comments

Comments

@jessesquires
Copy link
Owner

jessesquires commented Oct 25, 2019

Docs: https://developer.apple.com/documentation/uikit/uicollectionviewdelegate#3580853

Already implemented

func collectionView(UICollectionView, contextMenuConfigurationForItemAt: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?

NOT implemented

func collectionView(UICollectionView, previewForDismissingContextMenuWithConfiguration: UIContextMenuConfiguration) -> UITargetedPreview?
func collectionView(UICollectionView, previewForHighlightingContextMenuWithConfiguration: UIContextMenuConfiguration) -> UITargetedPreview?

func collectionView(UICollectionView,  willDisplayContextMenu configuration: UIContextMenuConfiguration,  animator: UIContextMenuInteractionAnimating?)
func collectionView(UICollectionView, willEndContextMenuInteraction configuration: UIContextMenuConfiguration,  animator: UIContextMenuInteractionAnimating?)

func collectionView(UICollectionView, willPerformPreviewActionForMenuWith: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating)
@jessesquires
Copy link
Owner Author

jessesquires added a commit that referenced this issue Sep 13, 2021
add support in CellViewModel

#1
@jessesquires
Copy link
Owner Author

jessesquires commented Sep 13, 2021

currently, only implementing:

public func collectionView(
_ collectionView: UICollectionView, 
contextMenuConfigurationForItemAt 
indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?

jessesquires added a commit that referenced this issue Sep 13, 2021
delete works, favorite does not (yet)

#1
jessesquires added a commit that referenced this issue Sep 13, 2021
needed to implement a proper `==`, the default was comparing the full view model, which is not what we want

#1
@jessesquires jessesquires changed the title Implement context menus Implement additional context menu APIs Apr 1, 2024
@jessesquires jessesquires removed this from the 0.1.0 Initial Release milestone Apr 1, 2024
@jessesquires jessesquires changed the title Implement additional context menu APIs [Delegate] Implement additional context menu APIs May 24, 2024
@jessesquires jessesquires changed the title [Delegate] Implement additional context menu APIs [Delegate] implement additional context menu APIs May 24, 2024
@jessesquires jessesquires removed their assignment May 24, 2024
@ruddfawcett
Copy link
Collaborator

@jessesquires saw this from #129, are you happy for me to take this? Assuming we can forward on CollectionViewModel?

@jessesquires
Copy link
Owner Author

@ruddfawcett sure! 😄

Just be aware that I'll be working on some bigger changes next week: #129 (comment)

@nuomi1
Copy link
Collaborator

nuomi1 commented Dec 9, 2024

These three functions do not have an IndexPath parameter anytime, so we cannot find the SectionViewModel or the CellViewModel.

// iOS 13.2+
func collectionView(_ collectionView: UICollectionView, willDisplayContextMenu configuration: UIContextMenuConfiguration, animator: (any UIContextMenuInteractionAnimating)?)
// iOS 13.2+
func collectionView(_ collectionView: UICollectionView, willEndContextMenuInteraction configuration: UIContextMenuConfiguration, animator: (any UIContextMenuInteractionAnimating)?)
// iOS 13.0+
func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: any UIContextMenuInteractionCommitAnimating)

This function uses the [IndexPath] parameter starting from iOS 16, and multiple sections may be used. Also we cannot find the SectionViewModel or the CellViewModel.

// new iOS 16.0+
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemsAt indexPaths: [IndexPath], point: CGPoint) -> UIContextMenuConfiguration?
// old iOS 13.0-16.0
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?

These two functions did not have an IndexPath parameter before iOS 16, so we cannot find the SectionViewModel or the CellViewModel.

// new iOS 16.0+
func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, highlightPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview?
// old iOS 13.0-16.0
func collectionView(_ collectionView: UICollectionView, previewForDismissingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview?

// new iOS 16.0+
func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, dismissalPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview?
// old iOS 13.0-16.0
func collectionView(_ collectionView: UICollectionView, previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview?

@nuomi1
Copy link
Collaborator

nuomi1 commented Dec 9, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants