How do I use Swift Package Manager with an existing macOS project?

后端 未结 4 1829
北海茫月
北海茫月 2021-01-03 20:30

I\'ve been using Cocoapods to manage dependencies for my Swift project. I came across this package which is not listed at Cocoapods. Instead it suggests using Swift Package

4条回答
  •  失恋的感觉
    2021-01-03 20:50

    Until the time of this writing answer, Swift Package Manager do not support the iOS, tvOS, and watchOS. Instead, you will have to add the files from the package directly to your project.

    I would suggest you creating a Dependencies group in your project and a group below that with the package name, like this answer:

    So, first you will add the files dependency that you want to import into your project to the name of the package name that included in Dependencies group that we make before.

    After you add the files then you can access the code as you usually would when you write it yourself like the image below. No need imports. You can see more details in here. hope it helps.

提交回复
热议问题