現在のプロジェクト名を取得する Swift メソッド

guard let info = Bundle.main.infoDictionary,
      let projectName = info["CFBundleExecutable"] as? String else { return }

let nameSpace = projectName.replacingOccurrences(of: "-", with: "_")
print(nameSpace)

おすすめ

転載: blog.csdn.net/qq_37269542/article/details/131643139