How to correctly create carthage cartfile?

后端 未结 3 1267
星月不相逢
星月不相逢 2021-01-30 08:41

I\'m looking into cartfile. Can\'t wait to \"simply create a cartfile\" like all the instructions say to do.

Only... how do you \"simply\" create a Cartfile?

I\'

相关标签:
3条回答
  • 2021-01-30 08:45

    From the command line, navigate to your project directory.

    touch Cartfile
    

    Now the Cartfile is created, make it executable with:

    chmod +x [YourDirectory/Cartfile]
    

    You can open it with any text editor. Then insert whatever library and source you want (Example: github "SwiftyJSON/SwiftyJSON" >= 2.1.2)

    0 讨论(0)
  • 2021-01-30 08:57

    Install by running below command if carthage is not installed.

    brew install carthage

    0 讨论(0)
  • 2021-01-30 09:10

    Carthage Tutorial: Getting Started is a must read. It explains things much better than the Carthage documentation does.

    Steps

    1. In a Terminal, cd to the root directory of the project that you want to add the framework to. This should be the same directory as your *.xcodeproj file.

      cd ~/Path/To/Your/Project/
      
    2. Create an empty file called Cartfile like this:

      touch Cartfile
      
    3. Open that file with Xcode:

      open -a Xcode Cartfile
      
    4. Paste the framework info that you need into the Cartfile. For example:

      github "stephencelis/SQLite.swift" ~> 0.10.1
      
    5. Close the file in Xcode and in Terminal run the following command to make Carthage update the dependencies in your project. (You should still be in the same directory as your Cartfile.)

      carthage update --platform iOS
      

    Notes

    • Using the method above, there is no need to change the execution permissions of the Cartfile.
    • You will still need to add the framework link to your project before you can use it. See the tutorial I linked to at the top for more information.
    0 讨论(0)
提交回复
热议问题