最新方法制作自己的cocoapods开源框架的详细步骤

本文详细介绍如何使用CocoaPods提交iOS项目至官方仓库,包括GitHub仓库搭建、podspec文件编写、验证及推送流程。
1、在GitHub上新建一个仓库,选公开仓库,选MIT的license,新建README.md文件;


2、克隆到本地,把你要上传的库放在仓库文件夹里,这里我用的是界面化git工具sourceTree,当然你也可以用指令


3、用终端cd到你的仓库目录,之后输指令 pod spec create yourSpecName,执行这个指令之后,仓库目录下会多一个yourSpecName.podspec文件


4、还在仓库目录下,用终端输入 vim yourSpecName.podspec,之后按i进行编辑,请按照如下例子进行修改(#开头的语句是被注释掉的语句)

<span style="font-size:14px;">#
#  Be sure to run `pod spec lint WYNavigationBarManager.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

  # ―――  Spec Metadata  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  These will help people to find your library, and whilst it
  #  can feel like a chore to fill in it's definitely to your advantage. The
  #  summary should be tweet-length, and the description more in depth.
  #

  s.name         = "WYNavigationBarManager"
  s.version      = "0.0.1"
  s.summary      = "WYNavigationBarManager is a manager to config your navigationBar gradual change ."

  # This description is used to generate tags and improve search results.
  #   * Think: What does it do? Why did you write it? What is the focus?
  #   * Try to keep it short, snappy and to the point.
  #   * Write the description between the DESC delimiters below.
  #   * Finally, don't worry about the indent, CocoaPods strips it!
  s.description  = <<-DESC
                   it is a manager use to change your navigation bar gradualful
                   DESC

  s.homepage     = "https://github.com/ivysboy/WYNavigationBarManager"
  # s.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"


  # ―――  Spec License  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Licensing your code is important. See http://choosealicense.com for more info.
  #  CocoaPods will detect a license file if there is a named LICENSE*
  #  Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
  #

  s.license      = 'MIT'
  # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }


  # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the authors of the library, with email addresses. Email addresses
  #  of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  #  accepts just a name if you'd rather not provide an email address.
  #
  #  Specify a social_media_url where others can refer to, for example a twitter
  #  profile URL.
  #

  s.author             = { "Wuyuan" => "359696929@qq.com" }
  # Or just: s.author    = "Wuyuan"
  # s.authors            = { "Wuyuan" => "359696929@qq.com" }
  # s.social_media_url   = "http://twitter.com/徐悟源"

  # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If this Pod runs only on iOS or OS X, then specify the platform and
  #  the deployment target. You can optionally include the target after the platform.
  #

  s.platform     = :ios, "7.0"
  # s.platform     = :ios, "5.0"

  #  When using multiple platforms
  # s.ios.deployment_target = "5.0"
  # s.osx.deployment_target = "10.7"
  # s.watchos.deployment_target = "2.0"
  # s.tvos.deployment_target = "9.0"


  # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the location from where the source should be retrieved.
  #  Supports git, hg, bzr, svn and HTTP.
  #

  s.source       = { :git => "https://github.com/ivysboy/WYNavigationBarManager.git", :tag => "#{s.version}" }


  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  CocoaPods is smart about how it includes source code. For source files
  #  giving a folder will include any swift, h, m, mm, c & cpp files.
  #  For header files it will include any header in the folder.
  #  Not including the public_header_files will make all headers public.
  #

  s.source_files  = "WYNavigationBarManager/WYNavigationBarManager/*"
  #  s.exclude_files = "Classes/Exclude"

  # s.public_header_files = "Classes/**/*.h"


  # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  A list of resources included with the Pod. These are copied into the
  #  target bundle with a build phase script. Anything else will be cleaned.
  #  You can preserve files from being cleaned, please don't preserve
  #  non-essential files like tests, examples and documentation.
  #

  # s.resource  = "icon.png"
  # s.resources = "Resources/*.png"

  # s.preserve_paths = "FilesToSave", "MoreFilesToSave"


  # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Link your library with frameworks, or libraries. Libraries do not include
  #  the lib prefix of their name.
  #

  s.framework  = "Foundation","UIKit"
  # s.frameworks = "SomeFramework", "AnotherFramework"

  # s.library   = "iconv"
  # s.libraries = "iconv", "xml2"


  # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If your library depends on compiler flags you can set them in the xcconfig hash
  #  where they will only apply to your library. If you depend on other Podspecs
  #  you can include multiple dependencies to ensure it works.

  # s.requires_arc = true

  # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  # s.dependency "JSONKit", "~> 1.4"

end
</span>

需要注意的是,在编写podspec文件时,

s.license一定要有,不然无法成功上传到cocoa pods。



还要s.platform = ios : "7.0" 注意对应的iOS版本号。



还有要设置好你希望作为框架的文件的路径s.source_files = ‘WYNavigationBarManager/WYNavigationBarManager/*’,这就表示其他人用pod安装你的框架时,会把你当前仓库目录下,这个WYNavigationBarManager/WYNavigationBarManager/*目录下的所有文件安装到他们的工程中。


还有远程仓库的路径也一定要写好。

5、写完pod spec文件之后,记得推送到你的远程仓库,之后要进行pods验证。
执行如下两条命令:
set the new version to 0.0.1
set the new tag to 0.0.1
上面这两句是为你的pod添加版本号,并打上tag。
然后执行pod验证指令:
pod lib lint
如果一切正常,会出下面的信息
WYNavigationBarManager(0.0.1)

WYNavigationBarManager passed validation
(如果上面这一步执行出现了警告,请用pod lib lint —allow-warnings,就不用管警告了)
之后再推送一下到远程仓库。

6、到这里我们才刚刚准备好可以向cocoapods的github官方仓库推送我们自己的框架
由于在2016年cocoa pods改变了提交机制,我们不能再像以前一样,把cocoapods在github上的spec克隆下来,在里面添加自己的podspec文件了。现在cocoa pods,要求我们以一种新的方式去推送自己的框架。

根据cocoa pods官网上的指引,首先我们要cd到我们已经建好podspec文件的仓库目录下,
输以下指令,之后注册本台电脑到cocoapods,要邮箱验证
pod trunk register yourmail@haha.com ‘your name’ —description=‘your mac name'


点击邮箱的验证连接,会出现


当邮箱验证成功之后,你就可以在这个目录下直接执行
pod trunk push
推送你的podspec文件到cocoa pods的官方仓库了
执行成功之后,你就可以用
pod search yourSpecName
去看一下你的框架了


在人工智能与机器学习的研究中,数据预处理构成了关键性基础环节,尤其针对遥感影像数据如Landsat8的处理更为显著。Landsat8作为美国陆地卫星计划所提供的高精度地球观测资源,在生态监测、作物评估、城市发展研究等众多科学领域具有广泛应用价值。本项实践聚焦于对Landsat8影像实施系统化批量预处理,为后续深入解析与算法训练奠定数据基础。 数据预处理作为提升数据质量与模型效能的核心流程,涵盖数据净化、空缺值填补、异常数据识别及格式转换等操作。针对Landsat8数据集,需执行云层遮蔽消除、辐射量校准、大气效应修正等专业处理,以排除干扰地表反射率准确性的环境因素。 特征构建是从初始数据中衍生优化特征的重要过程。Landsat8每景影像包含多个独立光谱波段,分别记录不同电磁波谱区间的信息。特征工程可能涉及波段数学组合(如构建归一化植被指数NDVI、水体指数NDWI)、实施主成分降维分析、计算各类光谱指标等,从而提炼出更具地学解释价值的环境特征参数。 在技术实现层面,Python凭借其完善的生态库成为首选工具。专业库rasterio可用于栅格数据读写与操作,geopandas处理地理空间信息,numpy与pandas进行数值运算与表结构管理,scikit-image则提供专业图像处理能力。面对海量数据,批处理机制通过自动化脚本遍历文件系统,结合并行计算模块实现处理效率的显著提升。 标准预处理流程遵循严谨的技术路线:原始影像载入→云掩膜处理→辐射与大气校正→特征衍生→数据标准化→结果存储。各环节均需根据具体研究目标与数据特性进行参数优化。处理成果通常以GeoTIFF格式保存,确保空间参考系与元数据的完整保留。 预处理过程中的质量验证依赖于可视化技术,通过matplotlib等工具生成波段直方图与空间分布图,辅助评估数据转换效果。经规范处理的Landsat8数据可有效支持土地利用分类、植被动态监测、灾害评估、气候变迁研究等应用方向,为随机森林、支持向量机及深度神经网络等预测模型提供优质输入,最终提升模型推理精度与泛化性能。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值