Contents

shaps80/swiftuibackports

Use modern SwiftUI APIs while still supporting older Apple platforms.

Usage

SwiftUIBackports mirrors Apple's SwiftUI APIs where practical, while keeping backported APIs easy to find and remove once your deployment target reaches the native API.

View modifiers are available from .backport:

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

Backported types are usually available from the Backport namespace:

Backport.LabeledContent("", value: 0)

If the compiler needs the fully-qualified namespace, use Backport<Any>:

Backport<Any>.LabeledContent("", value: 0)

Environment backports use a backport prefix:

@Environment(\.backportRequestReview) private var requestReview

Backports

The supported backports are indexed in:

skills/swiftui-backports/references/Backports.jsonl

The line-oriented index lists implemented backports, their kind, source location, and platform availability. Prefer this index over static README examples, which get stale quickly.

This repository also includes an agent skill:

skills/swiftui-backports/SKILL.md

Use that skill when working in an app that targets older Apple OS versions, or when a compiler availability error blocks use of a newer SwiftUI API. The skill tells agents to:

  • check the project deployment target
  • search the bundled backport index
  • prefer native SwiftUI when the deployment target is new enough
  • use .backport, Backport, or backport environment keys when a matching backport exists

Installation

You can install manually (by copying the files in the Sources directory) or using Swift Package Manager (preferred)

To install using Swift Package Manager, add this to the dependencies section of your Package.swift file:

.package(url: "https://github.com/shaps80/SwiftUIBackports.git", .upToNextMajor(from: "2.0.0"))

Package Metadata

Repository: shaps80/swiftuibackports

Default branch: main

README: README.md