Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a cocoapod with .swift?

I know how to work with cocoapods in a new swift project?
But how can i create my own cocoapod using swift?

pod lib lint produces this error:

- NOTE  | [xcodebuild]  warning: no rule to process file '/Pod/Classes/SomeClass.swift' of type text for architecture armv7

Edit: Just found this swift branch: https://github.com/CocoaPods/CocoaPods/tree/swift

like image 233
fabian Avatar asked Jul 27 '14 19:07

fabian


People also ask

How to create an icecreamshop using CocoaPods?

Open the project folder using Finder and you’ll see CocoaPods created a new IceCreamShop.xcworkspace file and a Pods folder to store all the project’s dependencies. Note: From now on, as the command line warning mentioned, you must always open the project with the .xcworkspace file and not the .xcodeproj.

How do I add a podspec to CocoaPods?

You first need to add your Podspec to a private specs repo; this lets CocoaPods find the pod when you try to install it. Fortunately, you’ve already created a Git repo for this, so this final step is relatively straightforward.

What is CocoaPods or pods?

Somewhere along your iOS development journey you will come across the term cocoapods or pods. What is it and what does it do? Cocoapods is an application level dependency manager that runs on objective-c, swift, and any other programming languages that run on Objective-C.

What is CocoaPods in Xcode?

Cocoapods is an application level dependency manager that runs on objective-c, swift, and any other programming languages that run on Objective-C. It focuses on source-based distribution of third party code and allows automatic integration to your Xcode projects.


2 Answers

Cocoapods now supports swift : Pod-Authors-Guide-to-CocoaPods-Frameworks

like image 122
anasaitali Avatar answered Oct 16 '22 16:10

anasaitali


Although Swift is officially supported, there are no official templates available for Swift and documentation is still slim. Here's a step-by-step tutorial for creating CocoaPods in Swift that may help though.

Essentially the steps are:

  1. Create a git repo
  2. Create your Xcode workspace
  3. Add an iOS/OSX example project
  4. Add Swift framework and make it as a dependency to your example project
  5. Create your pod spec file, here's an example for a Swift pod:

    Pod::Spec.new do |s|
    
        s.name         = "MySwiftPod"
        s.version      = "0.1"
        s.summary      = "This is my amazing Swift CocoaPod!"
    
        s.description  = <<-DESC
                         This is my long description here... yada, yada.
                         DESC
    
        s.homepage     = "http://basememara.com/how-to-create-a-cocoapod-with-swift/"
        s.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
        s.license      = { :type => "MIT", :file => "LICENSE" }
        s.author             = { "Basem Emara" => "[email protected]" }
        s.social_media_url   = "https://twitter.com/basememara"
        s.platform     = :ios, "8.0"
        s.source       = { :git => "https://github.com/basememara/cocoapods-swift-sample.git", :tag => s.version }
        s.source_files  = "MySwiftPod/MySwiftPod/*.swift"
    
    end
    
like image 21
Basem Avatar answered Oct 16 '22 18:10

Basem