How to create a cocoapod with .swift?

点点圈 提交于 2019-12-10 13:29:13

问题


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


回答1:


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




回答2:


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" => "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
    



回答3:


Using the latest version of Cocoapods (0.37.1) you're now able to use pod lib create to create Swift libraries. The first question you're asked if whether or not the library should be Objective-C or Swift.

Also documented here: http://guides.cocoapods.org/making/using-pod-lib-create.html



来源:https://stackoverflow.com/questions/24984627/how-to-create-a-cocoapod-with-swift

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!