dpearson2699/swift-ios-skills / skills/swiftui-uikit-interop
swiftui-uikit-interop
VerifiedBridges UIKit and SwiftUI with UIViewRepresentable, UIViewControllerRepresentable, UIHostingController, UIHostingConfiguration, coordinator delegates, and UIKit automatic observation tracking for shared @Observable state. Use when wrapping UIKit-only or third-party UIKit views/controllers in SwiftUI, embedding SwiftUI in UIKit, integrating mail/share/document/PDF/text-view surfaces, or migrating UIKit apps to SwiftUI incrementally.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 18.3 KB |
| evals/evals.json | config | 4.3 KB |
| references/hosting-migration.md | markdown | 18.1 KB |
| references/representable-recipes.md | markdown | 30.7 KB |
evals/evals.json
View on GitHub{
"skill_name": "swiftui-uikit-interop",
"evals": [
{
"id": 1,
"prompt": "Review this SwiftUI wrapper for a legacy search bar:\n\n```swift\nstruct SearchBar: UIViewRepresentable {\n @Binding var text: String\n var onSearch: (String) -> Void\n\n func makeCoordinator() -> Coordinator { Coordinator(self) }\n\n func makeUIView(context: Context) -> UISearchBar {\n let bar = UISearchBar()\n bar.delegate = context.coordinator\n return bar\n }\n\n func updateUIView(_ uiView: UISearchBar, context: Context) {\n if uiView.text != text { uiView.text = text }\n }\n\n final class Coordinator: NSObject, UISearchBarDelegate {\n var parent: SearchBar\n init(_ parent: SearchBar) { self.parent = parent }\n func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {\n parent.onSearch(parent.text)\n }\n }\n}\n```\n\nWhat should change for correctness under SwiftUI/UIKit interop?",
"expected_output": "A review that keeps delegate setup in makeUIView, adds an explicit coordinator parent refresh in updateUIView, preserves guarded state updates, and explains why copied closures or non-binding state can go stale.",
"files": [],
"assertions": [
"States that SwiftUI does not automatically update a coordinator's stored parent property and recommends assigning context.coordinator.parent = self in updateUIView.",
"Keeps UISearchBar delegate assignment in makeUIView instead of moving it to updateUIView.",
"Keeps or recommends a guard before writing uiView.text to avoid redundant update loops.",
"Explains that bindings remain connected but copied closures or non-binding values in the coordinator can become stale without refresh."
]
},
{
"id": 2,
"prompt": "I have a UIKit DashboardViewController inside a mixed UIKit/SwiftUI app. It reads an @Observable AppState and currently runs a Task loop with withObservationTracking and Task.sleep(for: .zero) to refresh labels. Rewrite the approach for an iOS 26-first app that still mentions the iOS 18 and iOS 15-16 fallback story.",
"expected_output": "A migration answer that replaces polling with UIKit automatic observation tracking, uses updateProperties or cell configuration update handlers, notes UIObservationTrackingEnabled for iOS 18 but not iOS 26, and keeps Combine as the old ObservableObject fallback.",
"files": [],
"assertions": [
"Rejects a polling or Task.sleep loop around withObservationTracking.",
"Uses UIKit automatic observation tracking through updateProperties, layoutSubviews, or configurationUpdateHandler for @Observable model reads.",
"States that UIObservationTrackingEnabled is required on iOS 18 and not required on iOS 26 and later.",
"Mentions Combine/objectWillChange as the fallback for iOS 15-16 or existing ObservableObject models."
]
},
{
"id": 3,
"prompt": "Which skill should handle this request: 'My SwiftUI screen needs a PDF viewer, a rich text editor, a web help center, and a legacy UIKit share/mail/message flow. I also need a collection view cell that hosts SwiftUI content with swipe actions.' Give the routing and the key interop guidance without turning it into a PDFKit, WebKit, or PhotoKit tutorial.",
"expected_output": "A boundary-aware answer that uses swiftui-uikit-interop for representable and hosting patterns, routes PDF details to pdfkit and WebKit details to swiftui-webkit, mentions modern native alternatives where appropriate, and correctly describes UIHostingConfiguration swipe action behavior.",
"files": [],
"assertions": [
"Routes general UIViewRepresentable, UIViewControllerRepresentable, UIHostingController, MessageUI wrappers, and UIHostingConfiguration guidance to swiftui-uikit-interop.",
"Routes PDFView, PDFDocument, PDF annotations, thumbnails, and PDF-specific behavior to pdfkit rather than expanding this skill into a PDFKit tutorial.",
"Routes native iOS 26 WebView/WebPage work to swiftui-webkit rather than recommending a WKWebView wrapper as the default.",
"States that UIHostingConfiguration can bridge SwiftUI swipeActions in list layouts, while UIKit swipe configuration remains appropriate when UIKit owns those actions."
]
}
]
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |