跳到正文
FunCoding

swiftui-backports

Find SwiftUIBackports replacements for SwiftUI APIs unavailable on a project deployment target. Use for Swift/SwiftUI compiler availability errors, old iOS/tvOS/watchOS/macOS targets, or when implementing SwiftUI app features that may benefit from SwiftUIBackports.

Star
1,099
许可证
MIT
最近提交
2026年6月13日

skills/swiftui-backports/SKILL.md

在 GitHub 上查看

SwiftUI Backports

When SwiftUI API is newer than the deployment target, check the bundled backport index before hand-rolling compatibility code or raising the target.

Workflow

  1. Confirm the availability need.

    • Use this for compiler availability errors, planned use of modern SwiftUI APIs, or user requests to support older OS versions.
    • Find deployment target in Package.swift, .xcodeproj/project.pbxproj, .xcconfig, or target settings.
  2. Check whether SwiftUIBackports is available.

    • Search for SwiftUIBackports, SwiftBackports, or existing .backport usage.
    • If absent, suggest adding https://github.com/shaps80/SwiftUIBackports only when it fits the project. Do not add it unless asked.
  3. Search the index.

    • Use rg -i "<api-name>|<related-term>" references/Backports.jsonl first.
    • Read only matching JSONL records when possible; the first line is metadata, remaining lines are backport records.
    • Match by name first, then by kind and namespace.
    • If the project has an installed SwiftUIBackports checkout, you may confirm against its source when uncertain.
  4. Decide native vs backport.

    • If target platform is marked unavailable, do not suggest that backport.
    • If deployment target is lower than the entry's deprecated version, use or suggest the backport.
    • If deployment target is at or above deprecated, prefer native SwiftUI.
  5. Use the discovered API.

    • View modifiers: .backport.foo(...)
    • Types/views: usually Backport.Foo; use Backport<Any>.Foo if the compiler needs the fully qualified namespace.
    • Environment values: use the indexed environment key, such as @Environment(\.backportRequestReview).
  6. If no index match exists, say no backport was found and choose another compatibility path.

Do not implement new SwiftUIBackports APIs from this skill. This is for consuming the library.

Example

sheetContent
    .backport.presentationDetents([.medium, .large])

Backport.LabeledContent("", value: 0)

@Environment(\.backportRequestReview) private var requestReview

相似的 Skill

receiving-code-review

OBobra/superpowers298k近 7 天新增 2,631 个 star

requesting-code-review

OBobra/superpowers298k近 7 天新增 2,631 个 star

systematic-debugging

OBobra/superpowers298k近 7 天新增 2,631 个 star

code-review

MAmattpocock/skills288k近 7 天新增 10,178 个 star

codebase-design

MAmattpocock/skills288k近 7 天新增 10,178 个 star

scaffold-exercises

MAmattpocock/skills288k近 7 天新增 10,178 个 star