Hi! Sorry, I didn’t save the example project
This is so great. But how can I change the frame size of the preview?
This is so great. But how can I change the frame size of the preview?
@vulgur I'm not sure, but maybe u can use preferredContentSize for it? Currently, it's works only for subclasses of UIHostingViewController (https://openradar.appspot.com/FB7650894)
I am having a problem implementing this. While the preview works perfectly. During the animation effect the text that is long pressed has a white overlay. This same thing happens when I close the view. I wouldn't mind this but for the fact that I am using it inside of a list and it pretty much covers the entire item inside of the list for like a second when I close the preview. Any ideas on how I may be able to fix this?
@jalvini did you ever manage to resolve this?
@jalvini @acal11 It looks like the white overlay can be fixed by adding these to Coordinator
:
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
let parameters = UIPreviewParameters()
parameters.backgroundColor = .clear
return UITargetedPreview(view: interaction.view!, parameters: parameters)
}
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForDismissingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
let parameters = UIPreviewParameters()
parameters.backgroundColor = .clear
return UITargetedPreview(view: interaction.view!, parameters: parameters)
}
what if we have a button in the preview. how action should be triggered? cause now buttons are not working
what if we have a button in the preview. how action should be triggered? cause now buttons are not working
I did it only for previewing :) You could not interact with it at the moment, but if you know how to improve this solution, you're welcome!
The animation when long pressing does not appear but it is a good attempt and does not screw up my layout like other methods! Would appreciate an update to the code where the animation can appear just like Apple's implementation!
HI there, this looks cool. Did you have an example with the destination view and some menu options?