Skip to content

MeshGradient+Codable.swift forces an iOS 18 floor on every consumer of the core ThemeKit target #17

Description

@rozd

Problem

Sources/ThemeKit/MeshGradient+Codable.swift extends Apple's MeshGradient (confirmed via Apple's docs: available iOS 18.0+ / macOS 15.0+ / tvOS 18.0+ / watchOS 11.0+) unconditionally, with no #if/availability gate, inside the core ThemeKit runtime target — the one every consumer links against regardless of whether they ever declare a meshGradients category in theme.json.

Because SPM compiles a target as one unit and enforces the package's declared platforms: floor on every dependent, this single file forces the whole package (and therefore every consumer's minimum deployment target) to iOS 18, even for projects that only use plain colors/gradients/shadows.

Suggested fix

Move mesh-gradient support out of the core target — either:

  • a separate optional target/product (e.g. ThemeKitMeshGradients) that consumers only add if they actually use the meshGradients category, or
  • gate MeshGradient+Codable.swift behind #if canImport(SwiftUI) && compiler(...)/availability so the base ThemeKit target itself doesn't require iOS 18.

One caveat worth flagging for planning purposes

Splitting this out would not bring the floor all the way down to iOS 13. I checked ThemeAdaptiveStyle+ShapeStyle.swift and Shadow.swift — both implement ShapeStyle.resolve(in:), and per Apple's docs that specific requirement is iOS 17.0+ / macOS 14.0+ (the base ShapeStyle protocol itself is iOS 13+, but resolve(in:) was added later, in the same OS generation as Color.Resolved). So the realistic floor after splitting out MeshGradient is iOS 17, not iOS 13 — still a meaningful improvement (18 → 17), just want to set accurate expectations rather than imply this change alone unlocks iOS 13.

Happy to help with either the target split or the availability gating if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions