I'm pretty sure that SPM has the ability to fix this issue, but I am having a hard time finding it. I am quite sure that "I'm not holding it right."
I'm quite new to SPM, and am still struggling with its syntax and methodology.
Maybe all that needs to happen, is for someone to direct me to the appropriate PackageDescription docs (which I can't seem to find).
I am in the process of switching an app I developed over to use SPM for a few libraries that I also wrote. It has been using Carthage, and the libraries were added as simple source files (they are all single-source-file dependencies).
Everything works great...except that I get an App Store Upload rejection.
It does not like the bundle IDs for the embedded libraries. They have underscores in the project name, and I should replace those with dashes.
These libraries (this one, this one, and this one), are not really designed to be delivered as libraries. They are really single source files. It looks like SPM builds them into a library, but I don't really provide an Info.plist for the build.
Can anyone give me any guidance over how I can control the bundle IDs, while leaving the module names the same?
OK. I figured it out.
First, the docs for SPM...leave something to be desired. I had to find this out by trial-and-error (LOTS of error).
In the Package.swift file, I had this (for one of my dependencies):
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "RVS_Generic_Swift_Toolbox",
products: [
.library(
name: "RVS_Generic_Swift_Toolbox",
type: .dynamic,
targets: ["RVS_Generic_Swift_Toolbox"]),
],
targets: [
.target(
name: "RVS_Generic_Swift_Toolbox",
path: "./src")
]
)
Apparently, SPM uses the .library.name property as the BundleID. If I changed it, like so:
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "RVS_Generic_Swift_Toolbox",
products: [
.library(
name: "RVS-Generic-Swift-Toolbox",
type: .dynamic,
targets: ["RVS_Generic_Swift_Toolbox"]),
],
targets: [
.target(
name: "RVS_Generic_Swift_Toolbox",
path: "./src")
]
)
Then, it would allow the upload, and I would still be able to do the import RVS_Generic_Swift_Toolbox
.
Also, there's a bad cache issue. I had to delete EVERYTHING to make sure that the proper version was loaded.