I'v wrote a simple swift project that wraps a C library.
├── Package.swift
├── Sources
│ ├── CMyClient
│ │ ├── module.modulemap
│ │ └── my_client.h
│ └── MyClient
│ └── MyClient.swift
└── Tests
└── MyClientTests
└── MyClientTests.swift
and the content of Package.swift
import PackageDescription
let package = Package(
name: "MyClient",
products: [
.library(
name: "MyClient",
targets: ["MyClient"]
),
],
targets: [
.systemLibrary(name: "CMyClient"),
.target(
name: "MyClient",
dependencies: ["CMyClient"]
)
.testTarget(
name: "MyClientTests",
dependencies: ["MyClient"]
)
]
)
when I test this project, I use the following (./Libs
dir is for .a static library file)
swift test -Xlinker -L./Libs
For the integration reason, I should be able to provide this library in a cocoapods package format.
But I am very new to swift and it's eco system, especially cocoapods..
I tried to use pod lib create
command to create a pod package project, but it generates too many things that confused me a lot, I don't event know where to put my code :(
I want to learn that if there is way to convert this to pod package with the minimum files and podspecs.
Thanks in advance.