0
        let provider = NSItemProvider()

        if model.type == .rich {
            if let attr = NSAttributedString(
                with: model.data,
                type: model.pasteboardType
            ) {
                //return NSItemProvider(object: attr as NSString)
            }

            provider.registerDataRepresentation(
                forTypeIdentifier: model.pasteboardType.rawValue,
                visibility: .all,
            ) { completion in
                completion(model.data, nil)
                return nil
            }
        }


       .onDrop(
            of: [
                .text,
                .rtf,
                .rtfd,
                .fileURL,
                .png,
                .tiff,
                .data,
            ],
            isTargeted: $isDropTargeted,
        ) { providers in
            if chip.isSystem {
                return false
            }
            if vm.draggingItemId != nil {
                handleDrop(providers: providers)
                return true
            }
            return false
        }

How should I handle this? Also, there's another issue: when dragging within the app, why doesn't the preview image automatically shrink at the receiving end, but it works correctly when dragging outside the app?

New contributor
king crown is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.