问题
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:
- Create a git repo
- Create your Xcode workspace
- Add an iOS/OSX example project
- Add Swift framework and make it as a dependency to your example project
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