如何使用.swift创建一个CocoaPod?

6
我知道如何在一个新的Swift项目中使用CocoaPods?但是我如何使用Swift创建自己的CocoaPod呢? pod lib lint 命令会产生以下错误:
- NOTE  | [xcodebuild]  warning: no rule to process file '/Pod/Classes/SomeClass.swift' of type text for architecture armv7

编辑: 刚发现这个 Swift 分支: https://github.com/CocoaPods/CocoaPods/tree/swift

2个回答

3

1
尽管 Swift 得到了官方支持,但是目前还没有官方的 Swift 模板可用,而且文档也比较匮乏。不过,这里有一个逐步指南,可以帮助你创建 CocoaPods。no official templates available for Swift step-by-step tutorial 基本步骤如下:
  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" => "some@example.com" }
        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
    

我在另一个SO线程中发布了这个答案。如果那边有进展,这里是供参考的链接:http://stackoverflow.com/questions/29376297/create-cocoapod-for-swift-framework/30103652 - Basem
嘿,我读了你的逐步指南,发现它非常有帮助 - 我能够创建一个原型 pod,可以通过“pod install”命令安装。不过,我遇到了麻烦,无法弄清楚如何制作依赖于另一个 pod 的 pod。例如,我想创建的库使用 SnapKit。我知道必须在 podspec 文件中列出依赖项,但是如何将预先存在的 cocoapods 合并到你在教程中介绍的项目结构中呢? - dMurdZ

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接