Git Submodule Alternative for Cocoa.

Overview

CocoaSeeds

Gem Build Status

Git Submodule Alternative for Cocoa. Inspired by CocoaPods.

Why?

  • iOS 7 projects do not support the use of Swift libraries from CocoaPods or Carthage.

    ld: warning: embedded dylibs/frameworks only run on iOS 8 or later

  • CocoaSeeds just downloads the source code and add it to your Xcode project. No static libraries, no dynamic frameworks.

  • Git Submodule sucks.

  • It can be used with CocoaPods and Carthage.

Installation

You can get CocoaSeeds from RubyGems.

$ [sudo] gem install cocoaseeds

How to Use CocoaSeeds

1. Write a Seedfile

A Seedfile is a ruby script that manifests the dependencies of your project. You can manage third party libraries by simply specifying them in the Seedfile. Currently, CocoaSeeds supports only GitHub and BitBucket repositories. However, we are planning to support other version control systems.

Let's make an empty file named Seedfile in the directory where your Xcode project file is located. Here is a sample Seedfile:

Seedfile

github "Alamofire/Alamofire", "1.2.1", :files => "Source/*.{swift,h}"
github "devxoul/JLToast", "1.2.5", :files => "JLToast/*.{swift,h}"
github "devxoul/SwipeBack", "1.0.4"
github "SnapKit/SnapKit", :commit => "62e7645", :files => "Source/*.{swift,h}"

git "https://gitlab.com/MyCompany/CompanyLibrary.git", "1.1.0"
local "PrivateLibrary", "../libs/PrivateLibrary", :files => "Source/*.{swift,h}"

target :MyAppTest do
  github "Quick/Quick", "v0.3.1", :files => "Quick/**.{swift,h}"
  github "Quick/Nimble", "v0.4.2", :files => "Nimble/**.{swift,h}"
end

Can you guess what each line does? It has basic information about the third party libraries.

Each line in a Seedfile consists of three parts: source, tag, and files. Let's look at the second line of the previous sample.

github "devxoul/JLToast", "1.2.5", :files => "JLToast/*.{swift,h}"
~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       (Source)          (Version)             (Files)
Parts Example Required Default
Source github "devxoul/SwipeBack" Required -
Version Tag: "1.0.4"
Branch: "swift-2.0"
Commit: :commit => "SHA1"
Required -
Files :files => "JLToast/*.{swift,h}" Optional */**.{h,m,mm,swift}

Tip: You can pass an array to :files for multiple file patterns:

:files => ["/path1/*.swift", "/path2/*.swift"]

Want to use branch names instead of tags? See the Branch support section.

Specifying targets

Third party libraries can be included as a specific target by creating a target block. For example, if you want to add some testing libraries such as Quick and Nimble into test target, you can specify them like this:

target :MyAppTest do
  github "Quick/Quick", "v0.3.1", :files => "Quick/**.{swift,h}"
  github "Quick/Nimble", "v0.4.2", :files => "Nimble/**.{swift,h}"
end

Specifying Xcode project file path

If the .xcodeproj file is located in other location, you can specify the path in Seedfile.

xcodeproj "path/to/Project.xcodeproj"

target :MyApp do
    github "devxoul/JLToast", "1.2.5", :files => "JLToast/*.{swift,h}"
end

2. Install dependencies

After you are done with your Seedfile, it's time to load those libraries into your project. This is pretty simple. Just open the terminal, cd to your project directory and execute seed install command.

$ seed install

Then, all the source files will be automatically downloaded and added to a group named 'Seeds'.

Seeds-in-Xcode

3. Enjoy

Build your project and enjoy coding!

Tips and Tricks

Using branches

You can specify a branch name instead of the tag. What you need to do is just replacing the tag with the branch name.

github 'devxoul/SwiftyImage', 'swift-2.0', :files => 'SwiftyImage/SwiftyImage.swift'

Excluding files

Use exclude_files to exclude files from files pattern.

github 'devxoul/Carte', '0.2.2', :files => 'Carte/*', :exclude_files => "Carte/Carte.h"

Using resources

If the resource files are sprecified in files, they will be added to Copy Bundle Resource build phase instead of Compile Source build phase.

github 'author/Repository', 'x.y.z', :files => ['Source/*', 'Images/*']

Resolving filename conflicts

Since CocoaSeeds tries to include source files directly rather than linking dynamic frameworks, it is important to make sure that all sources have different names. CocoaSeeds provides a way to do this:

Seedfile

swift_seedname_prefix!  # add this line

github "thoughtbot/Argo", "v1.0.3", :files => "Argo/*/*.swift"
github "thoughtbot/Runes", "v2.0.0", :files => "Source/*.swift"

Then all of source files installed via CocoasSeeds will have names with the seed names as prefix.

Before (filename) After (seedname_filename)
Seeds/Alamofire/Alamofire.swift Seeds/Alamofire/Alamofire_Alamofire.swift
Seeds/Argo/Operators/Operators.swift Seeds/Argo/Operators/Argo_Operators.swift
Seeds/Runes/Operators.swift Seeds/Runes/Runes_Operators.swift

FAQ

  • Are you using this in real-world projects? (Does Apple allow apps to use CocoaSeeds?)

    • Of course I am. I'm developing a social media service that has about 2 million users. The app is on AppStore without any complaints from Apple.
  • Can I ignore Seeds folder in VCS (version control system)?

    • Yes, you can ignore the Seeds folder (by adding it to .gitignore if you use Git).

License

CocoaSeeds is under MIT license. See the LICENSE file for more info.

Comments
  • Cannot install local library

    Cannot install local library

    Seedfile...

    local "Listen", "~/Conway\ Corp/Projects/Listen/", :files => "Listen/*.{swift,h}"
    

    "Listen" (where the source files are) and "ListenCocoaSeed" are directories that are right beside each other in the Projects directory

    sudo seed install gives me...

    Anaylizing dependencies
    Installing local seed: Listen
    /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/core.rb:539:in `mkdir': No such file or directory @ dir_s_mkdir - /Users/<username>/Conway\ Corp/Projects/ListenCocoaSeed/Seeds/Listen (Errno::ENOENT)
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/core.rb:539:in `install_local_seed'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/core.rb:416:in `block in install_seeds'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/core.rb:413:in `each'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/core.rb:413:in `install_seeds'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/core.rb:106:in `install'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/lib/cocoaseeds/command.rb:11:in `run'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cocoaseeds-0.8.0/bin/seed:5:in `<top (required)>'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/bin/seed:23:in `load'
        from /Users/<username>/.rvm/rubies/ruby-2.2.2/bin/seed:23:in `<main>'
        from /Users/<username>/.rvm/gems/ruby-2.2.2@global/bin/ruby_executable_hooks:15:in `eval'
        from /Users/<username>/.rvm/gems/ruby-2.2.2@global/bin/ruby_executable_hooks:15:in `<main>'
    

    Any idea what i'm doing wrong? Thanks.

    opened by AndrewGene 10
  • Source files added to all targets, duplicate references

    Source files added to all targets, duplicate references

    Seedfile:

    github "Alamofire/Alamofire", "swift-2.0", :files => "Source/*.swift"
    github "thoughtbot/Argo", "td-swift-2", :files => "Argo/*/*.swift"
    github "thoughtbot/Runes", "swift-2.0", :files => "Source/*.swift"
    

    I'm attempting to integrate the Swift 2 versions of several libraries and a few issues have cropped up. First and foremost, it seems like at least some of the source files are included more than once, so I get this error: error: filename "Operators.swift" used twice: '/Users/jshier/Desktop/project/Seeds/Runes/Source/Operators.swift' and '/Users/jshier/Desktop/project/Seeds/Runes/Source/Operators.swift'

    Second, it looks like all of the source files are included in all of my targets. Is there any way to have them included in only my actual app target?

    Also, is that the proper syntax for targeting a branch instead of a tag? It seems to work but I wasn't sure.

    bug question 
    opened by jshier 8
  • Specify xcodeproj path

    Specify xcodeproj path

    Is it possible to set a specific path for the xcodeproj? That could be useful when the xcodeproj isn't in the main directory of the project (by using workspace...)

    opened by tbaranes 7
  • comparison of array with array failed ...

    comparison of array with array failed ...

    This is my Seedfile:

         github "Alamofire/Alamofire", "1.2.1", :files => "Source/*.{swift,h}"
         github "devxoul/JLToast", "1.2.2", :files => "JLToast/*.{swift,h}"
         github "SwiftyJSON", "2.2", :files => "Source/SwiftyJSON.swift"
    

    I run "seed install", and I get this:

    Anaylizing dependencies /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.0.7/lib/cocoaseeds/core.rb:239:in sort': comparison of Array with Array failed (ArgumentError) from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.0.7/lib/cocoaseeds/core.rb:239:ininstall_seeds' from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.0.7/lib/cocoaseeds/core.rb:100:in install' from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.0.7/lib/cocoaseeds/command.rb:7:inrun' from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.0.7/bin/seed:5:in <top (required)>' from /usr/bin/seed:23:inload' from /usr/bin/seed:23:in `

    '

    opened by germanger 5
  • Support custom source and local source

    Support custom source and local source

    Custom source:

    git "[email protected]:xxxx/yyyy.git", "master", :files => ["*.swift"] 
    

    Local source:

    local "xxxx", "../xxxx",:files => ["*.swift"] 
    
    opened by veightz 4
  • Do you support remove unused files in seed folder?

    Do you support remove unused files in seed folder?

    [Seed/xxxx/.] folder found there are many unused files below, and the presence .git folder inside the file, causing Git project can not add [Seed/xxxx/.] track. I just want to keep [: files => ". Source / * {swift, h}"] referenced files saved at the Seed folder.

    001 002
    opened by kimsungwhee 4
  • When using :commit, :exclude_files will be ignored.

    When using :commit, :exclude_files will be ignored.

    Seedfile:

    github 'PavelKatunin/DownloadButton', :commit=>'ff7e3f7', :files=>'Pod/Classes/*.{h,m}', :exclude_files=>'Pod/Classes/*.{h,m}'
    

    I expect Cocoa Seeds import nothing into the XCode project. Instead, the :exclude_files is silently ignored.

    opened by kennytm 4
  • Make 'tag' optional, or allow 'HEAD' or specific revision

    Make 'tag' optional, or allow 'HEAD' or specific revision

    There are authors on GitHub who don't like to tag their code releases. That makes it quite cumbersome to use their code from CocoaSeeds.

    Can we get a little more flexible with the "tag" required, e.g. allowing for "HEAD", or a specific commit hash would be awesome.

    Thanks for considering.

    opened by iljaiwas 4
  • Unable to install seeds

    Unable to install seeds

    I'm not able to install seeds, when I run seed install, I get the following error :

    % seed install                                                                                                                                                   
    Anaylizing dependencies
    /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.6.0/lib/cocoaseeds/core.rb:315:in `eval': undefined local variable or method `“master”' for #<Seeds::Core:0x007fa2ebc20f98> (NameError)
        from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.6.0/lib/cocoaseeds/core.rb:315:in `eval'
        from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.6.0/lib/cocoaseeds/core.rb:315:in `execute_seedfile'
        from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.6.0/lib/cocoaseeds/core.rb:104:in `install'
        from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.6.0/lib/cocoaseeds/command.rb:11:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/cocoaseeds-0.6.0/bin/seed:5:in `<top (required)>'
        from /usr/local/bin/seed:23:in `load'
        from /usr/local/bin/seed:23:in `<main>'
     %
    
    opened by vincedev 3
  • Supporting several source of files

    Supporting several source of files

    In my case, I can't use the useful syntax src/*.{swift,m,h}, but I need to specify two different path of files. Is it Possible an option such as:

    :files => "path1/*{h,m},path2/*{h,m}"
    
    opened by tbaranes 3
  • Add support for

    Add support for "exclude_files" pattern

    There are complex projects out there, like Typhoon. In order to easily use this projects with CocoaSeeds, it would be helpful to have an "exclude_files" pattern, that removes specific files from the project that have been previously matched by the "files" pattern.

    For instance, if you take a look at the Typhoon pod spec (https://github.com/CocoaPods/Specs/blob/master/Specs/Typhoon/3.3.3/Typhoon.podspec.json), you'll see that when building for iOS, they exclude the OS X directory and vice versa. I guess that's rather hard to do in Typhoon at the moment.

    opened by iljaiwas 3
  • Is it possible to swift_seedname_prefix individually for each seed?

    Is it possible to swift_seedname_prefix individually for each seed?

    This will allow to edit the source code of the project and make a pull request from your own project. (When using swift_seedname_prefix the names of the files are changed and pull request from the project is not possible, I think)

    Thanks!

    opened by acecilia 3
  • Disable warnings for library added

    Disable warnings for library added

    As the arc featured, a warnings handler featured would be awesome. Once again, I'm using SKMediaTap library which has some warnings, useless for the project. A way to disable warnings for a seed, or all of them would be great!

    In action, just add the -w flag to the library concerned.

    opened by tbaranes 2
  • Specify arc flags

    Specify arc flags

    Another key features which could be useful is to add (or not) arc flags if the library doesn't handle but the project does. I think mainly of SKMediaTap, a useful library for OSX which doesn't use arc.

    In action, just add the -fno-objc-arc flags to the library concerned.

    opened by tbaranes 1
  • Dependencies

    Dependencies

    Hi there,

    do you have any ideas, how to handle dependencies? Given I want to add github "thoughtbot/Argo", "2.1", :files => "Argo/*/*.swift" it does not compile, because it has imports like import Runes and the compiler says No such module: Runes.

    opened by hffmnn 6
Releases(0.8.3)
Owner
Suyeol Jeon
A lazy developer 😴 I write many code to write less code.
Suyeol Jeon
The Cocoa Dependency Manager.

CocoaPods: The Cocoa dependency manager CocoaPods manages dependencies for your Xcode projects. You specify the dependencies for your project in a sim

null 13.9k Jan 8, 2023
Model framework for Cocoa and Cocoa Touch

Mantle Mantle makes it easy to write a simple model layer for your Cocoa or Cocoa Touch application. The Typical Model Object What's wrong with the wa

null 11.3k Dec 31, 2022
Adding ruby style each iterator to Cocoa/Cocoa touch Swift Array and Range classes, And Int.times{} to Int class

Collection-Each Adding ruby style each iterator to Cocoa/Cocoa touch Swift Array, Dictionary and Range classes, and Int.times ###Why? Array/Dictionary

Omar Abdelhafith 65 Jun 9, 2018
macOS status bar app to automatically fetch Git repositories.

Fetcher About macOS status bar app to automatically fetch Git repositories. License Project is released under the terms of the MIT License. Repository

JD Gadina 5 Jan 3, 2023
Ejercicio de git

testdam Ejercicio git Creo un nuevo repositorio GitHub Invito al compañero al repositorio También entro yo al repositorio que ha creado el compañero d

ArturViaderdev 0 Nov 4, 2021
A git plugin for real-world xcode versioning workflow.

git-xcp The most simplest, safe, and fully automatic git plugin for versioning workflow of real-world xcode projects. Current working or draft content

gitmerge 11 Dec 29, 2019
Awesome-gitignore-templates - A curated collection of useful gitignore templates for different programming languages while pushing your code to git. 😊 📝

Awesome Gitignore Templates A curated collection of useful gitignore templates for different programming languages while pushing your code to git. ??

Aashish Tamsya 19 Jun 11, 2022
The Git interface you've been missing all your life has finally arrived.

GitUp Work quickly, safely, and without headaches. The Git interface you've been missing all your life has finally arrived. Git recently celebrated it

GitUp 10.6k Jan 4, 2023
A command launcher designed for git users!

Bosswift - A command launcher for git users Bosswift work along with git worktree to give you power everyday. System Requirement: macOS 11.0+ A troubl

null 5 Sep 23, 2022
A Version Control Kit that allows Aurora Editor to do everything git related.

Version Control Kit AuroraEditor Version Control Kit allows us to perform actions like commiting, pulling, pushing and fetching history of whole files

Aurora Editor 6 Dec 15, 2022
A simple, decentralized dependency manager for Cocoa

Carthage Carthage is intended to be the simplest way to add frameworks to your Cocoa application. Carthage builds your dependencies and provides you w

Carthage 14.7k Jan 7, 2023
The Cocoa Dependency Manager.

CocoaPods: The Cocoa dependency manager CocoaPods manages dependencies for your Xcode projects. You specify the dependencies for your project in a sim

null 13.9k Jan 8, 2023
Typhoon Powerful dependency injection for Cocoa and CocoaTouch.

Typhoon Powerful dependency injection for Cocoa and CocoaTouch. Lightweight, yet full-featured and super-easy to use. Pilgrim is a pure Swift successo

AppsQuick.ly 2.7k Dec 14, 2022
Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift.

ReactiveSwift offers composable, declarative and flexible primitives that are built around the grand concept of streams of values over time. These primitives can be used to uniformly represent common Cocoa and generic programming patterns that are fundamentally an act of observation.

null 20k Jan 3, 2023
Sugar is a sweetener for your Cocoa implementations.

Sugar is a sweetener for your Cocoa implementations. Table of Contents iOS Application Screen Simulator Keyboard Observer iOS Extensions UIView

HyperRedink 1.1k Dec 29, 2022
Demonstration of how to integrate AppleScript/Cocoa scripting into a Catalyst app

CatalystAppleScript Trivial demonstration showing how to build support for AppleScript into a Catalyst app. Showcases multiple commands and variables

Steven Troughton-Smith 47 Aug 11, 2022
A Cocoa NSFormatter subclass to convert dates to and from ISO-8601-formatted strings. Supports calendar, week, and ordinal formats.

ISO 8601: The only date format worth using Obligatory relevant xkcd: How to use this code in your program Add the source files to your project. Parsin

Peter Hosey 601 Sep 4, 2022
A "time ago", "time since", "relative date", or "fuzzy date" category for NSDate and iOS, Objective-C, Cocoa Touch, iPhone, iPad

Migration 2014.04.12 NSDate+TimeAgo has merged with DateTools. DateTools is the parent project and Matthew York is the project head. This project is n

Kevin Lawler 1.8k Dec 2, 2022
A Cocoa / Objective-C wrapper around SQLite

FMDB v2.7 This is an Objective-C wrapper around SQLite. The FMDB Mailing List: https://groups.google.com/group/fmdb Read the SQLite FAQ: https://www.s

August 13.7k Dec 28, 2022
Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift. ⚠️ Looking for the Objective-C API? ?? Migrating from RAC 4.x? ?? Release Road

null 20k Jan 8, 2023