Skip to content

Add Swift Package Manager support #100

@b4kup

Description

@b4kup

Request

Add a Package.swift manifest to the iOS plugin so it can be consumed via Flutter's Swift Package Manager mode (flutter config --enable-swift-package-manager).

Currently ios/cleverpush_flutter.podspec is the only iOS package manifest, which forces CocoaPods even in projects otherwise fully migrated to SPM.

Why

Flutter 3.24+ supports SPM as an alternative to CocoaPods. Migrating drops a build dependency (Ruby + CocoaPods toolchain) and speeds up CI cold builds. A single Pod-only plugin currently blocks migration for our app.

Should be straightforward

The underlying native SDK already supports SPM — CleverPush/CleverPush-iOS-SDK ships a Package.swift and .swiftpm/ directory. The Flutter wrapper just needs to expose it:

// ios/cleverpush_flutter/Package.swift
// swift-tools-version: 5.9
import PackageDescription

let package = Package(
    name: "cleverpush_flutter",
    platforms: [.iOS("12.0")],
    products: [
        .library(name: "cleverpush-flutter", targets: ["cleverpush_flutter"]),
    ],
    dependencies: [
        .package(url: "https://github.com/CleverPush/CleverPush-iOS-SDK.git", exact: "1.34.43"),
    ],
    targets: [
        .target(
            name: "cleverpush_flutter",
            dependencies: [.product(name: "CleverPush", package: "CleverPush-iOS-SDK")],
            path: "Classes"
        ),
    ]
)

Plus moving Classes/ into ios/cleverpush_flutter/Sources/cleverpush_flutter/ per Flutter SPM plugin layout (see Flutter docs).

The .podspec can stay alongside Package.swift so existing CocoaPods consumers aren't broken.

Context

We maintain a multi-publication Flutter news app. CleverPush is one of the last two plugins in our dep graph still requiring CocoaPods. Happy to test against a pre-release branch.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions