シェンタの日記

swift,python,ubuntu等の記事を緩く書いていきます😜

Swiftでライブラリを公開する際のメモ(PodSpecとかLICENSE)

まずLICENSEを取得する

  • LICENSEはGitHubのレポジトリを作る際にMITで取得できるのでそれで取得する
  • 取得し忘れた場合はhttps://qiita.com/shibukk/items/67ad0a5eda5a94e5c032

PodSpecファイルを設定する

ここはPodのversionによって書き方が変わるかも(ちなみに自分は1.4.0)

  • pod spec create https://githubのurl でpodSpecファイルを作成する
  • pod Specファイルはこんな感じでかく

  •     Pod::Spec.new do |s|
        s.name         = "RippleButton"
        s.version      = "1.0.0"
        s.summary      = " This Library is PopButton Animation "
        s.description  = <<-DESC
                   - Like a wave Button animation is given
                       - Animation which has never existed
                         DESC
        s.homepage     = "https://github.com/OkumuraShintarou/RippleButton"
        s.license      = { :type => "MIT", :file => "LICENSE" }
        s.author       = { "Shinta" => "flekystyley@gmail.com" }
        s.platform     = :ios, "8.0"
        s.requires_arc = true
        s.source       = { :git => "https://github.com/OkumuraShintarou/RippleButton.git", :tag => s.version }
        s.source_files = "Classes/*.swift"
        s.swift_version = "4.0"
      end
    
  • pod lib lintでValidationチェックをする

  • pod trunk push hoge.podspec で公開