Issue #445

How to add SPM

// swift-tools-version:5.1

import PackageDescription

let package = Package(
    name: "Anchors",
    platforms: [
    products: [
            name: "Anchors",
            targets: ["Anchors"]),
    targets: [
            name: "Anchors",
            dependencies: [],
            path: "Sources"
            name: "AnchorsTests",
            dependencies: ["Anchors"]),
    swiftLanguageVersions: [.v5]

To test, swift test to test locally, this should validate Package.swift too

Support multiple platform

To support multiple platform, use platform check

#if canImport(UIKit)
import UIKit

Use sources in Target

If this property is nil, all valid source files in the target’s path will be included and specified paths are relative to the target path.

A path can be a path to a directory or an individual source file. In case of a directory, the Swift Package Manager searches for valid source files recursively inside it.

    name: "EasyClosureiOS",
    dependencies: [],
    path: "Sources",
    sources: ["Shared", "iOS"]


error: target ‘EasyClosuremacOS’ has sources overlapping sources

How to use

  • SPM packages are at DerivedData/MyApp/SourcePackages/checkouts
  • Delete DerivedData for Xcode to fetch new contents from GitHub
  • Clean build folder as Xcode often caches changes from frameworks

Read more