axiom-transferable-ref
БесплатноБез исполняемых скриптовНе проверенUse when implementing drag and drop, copy/paste, ShareLink, or ANY content sharing between apps or views - covers Transferable protocol…
от ComeOnOliver★ 67 звёзд на GitHubОб этом скилле
Transferable & Content Sharing Reference
Comprehensive guide to the CoreTransferable framework and SwiftUI sharing surfaces: drag and drop, copy/paste, and ShareLink.
When to Use This Skill
- Implementing drag and drop (
.draggable,.dropDestination) - Adding copy/paste support (
.copyable,.pasteDestination,PasteButton) - Sharing content via
ShareLink - Making custom types transferable
- Declaring custom UTTypes for app-specific formats
- Bridging
Transferabletypes with UIKit'sNSItemProvider - Choosing between
CodableRepresentation,DataRepresentation,FileRepresentation, andProxyRepresentation
Example Prompts
"How do I make my model draggable in SwiftUI?" "ShareLink isn't showing my custom preview" "How do I accept dropped files in my view?" "What's the difference between DataRepresentation and FileRepresentation?" "How do I add copy/paste support for my custom type?" "My drag and drop works within the app but not across apps" "How do I declare a custom UTType?"
Part 1: Quick Reference
Decision Tree: Which TransferRepresentation?
Your model type...
├─ Conforms to Codable + no specific binary format needed?
│ → CodableRepresentation
├─ Has custom binary format (Data in memory)?
│ → DataRepresentation (exporting/importing closures)
├─ Lives on disk (large files, videos, documents)?
│ → FileRepresentation (passes file URLs, not bytes)
├─ Need a fallback for receivers that don't understand your type?
│ → Add ProxyRepresentation (e.g., export as String or URL)
└─ Need to conditionally hide a representation?
→ Apply .exportingCondition to any representation
Common Errors
| Error / Symptom | Cause | Fix |
|---|---|---|
| "Type does not conform to Transferable" | Missing transferRepresentation |
Add static var transferRepresentation: some TransferRepresentation |
| Drop works in-app but not across apps | Custom UTType not declared in Info.plist | Add UTExportedTypeDeclarations entry |
| Receiver always gets plain text instead of rich type | ProxyRepresentation listed before CodableRepresentation | Reorder: richest representation first |
| FileRepresentation crashes with "file not found" | Receiver didn't copy file before sandbox extension expired | Copy to app storage in the importing closure |
| PasteButton always disabled | Pasteboard doesn't contain matching Transferable type | Check UTType conformance; verify the pasted data matches |
| ShareLink shows generic preview | No SharePreview provided or image isn't Transferable |
Supply explicit SharePreview with title and image |
.dropDestination closure never fires |
Wrong payload type or view has zero hit-test area | Verify for: type matches dragged content; add .frame() or .contentShape() |
Built-in Transferable Types
These work with zero additional code — no conformance needed:
String, Data, URL, AttributedString, Image, Color
Part 2: Making Types Transferable
The Transferable protocol has one requirement: a static transferRepresentation property.
CodableRepresentation
Best for: models already conforming to Codable. Uses JSON by default.
import UniformTypeIdentifiers
extension UTType {
static var todo: UTType = UTType(exportedAs: "com.example.todo")
}
struct Todo: Codable, Transferable {
var text: String
var isDone: Bool
static var transferRepresentation: some TransferRepresentation {
CodableRepresentation(contentType: .todo)
}
}
Custom encoder/decoder (e.g., PropertyList instead of JSON):
CodableRepresentation(
contentType: .todo,
encoder: PropertyListEncoder(),
decoder: PropertyListDecoder()
)
Requirement: Custom UTTypes need matching UTExportedTypeDeclarations in Info.plist (see Part 4).
DataRepresentation
Best for: custom binary formats where data is in memory and you control serialization.
struct ProfilesArchive: Transferable {
var profiles: [Profile]
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(contentType: .commaSeparatedText) { archive in
try archive.toCSV()
} importing: { data in
try ProfilesArchive(csvData: data)
}
}
}
Import-only or export-only variants:
// Import only
DataRepresentation(importedContentType: .png) { data in
try MyImage(pngData: data)
}
// Export only
DataRepresentation(exportedContentType: .png) { image in
try image.pngData()
}
Avoid using UTType.data as the content type — use a specific type like .png, .pdf, .commaSeparatedText.
FileRepresentation
Best for: large payloads on disk (videos, documents, archives). Passes file URLs instead of loading bytes into memory.
struct Video: Transferable {
let file: URL
static var transferRepresentation: some TransferRepresentation {
FileRepresentation(contentType: .mpeg4Movie
Установить axiom-transferable-ref в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл axiom-transferable-ref?
Use when implementing drag and drop, copy/paste, ShareLink, or ANY content sharing between apps or views - covers Transferable protocol, TransferRepresentation types, UTType declarations, SwiftUI surfaces, and NSItemProvider bridging
Как установить скилл axiom-transferable-ref?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл axiom-transferable-ref запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic