iOS用CocoaPods创建私有库

标签: 编程学习 iOS学习
CocoaPods是干嘛的?

以前的文章介绍过CocoaPodes的安装与使用,当我们从 gem 安装 CocoaPods 成功之后,在本地的 ~/.cocoapods/repo 路径下会创建一个 master 文件夹,里面存放的是远程仓库的所有索引,也就是 spec 文件。 CocoaPods 为了合理的对数以万计的三方库索引,将三方库的名字进行了 MD5 计算然后取前三个字母作为这个第三方库的前三个索引,这样每个目录下存放的库就不会太多,从而减少查找时间。而里面的文件夹里存放对应库的版本号,每个版本号下存放着对应版本的描述。

内容如下

{
  "authors": "Google, Inc.",
  "changelog": "https://dl.google.com/dl/cpdc/1c27a020313febc7/GoogleMaps-6.0.1-CHANGELOG.md",
  "default_subspecs": [
    "Maps"
  ],
  "description": "Use the Google Maps SDK for iOS to enrich your app with interactive maps, immersive Street View panoramas, and detailed information from Google's Places database.",
  "homepage": "https://developers.google.com/maps/documentation/ios/",
  "license": {
    "text": "Copyright 2021 Google",
    "type": "Copyright"
  },
  "name": "GoogleMaps",
  "platforms": {
    "ios": "12.0"
  },
  "preserve_paths": [
    "Example/GoogleMapsDemos.xcodeproj/project.pbxproj",
    "Example/GoogleMapsDemos/DemoAppDelegate.h",
    "Example/GoogleMapsDemos/DemoAppDelegate.m",
    "Example/GoogleMapsDemos/Info.plist",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Contents.json",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_120.png",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_152.png",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_167.png",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_180.png",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_76.png",
    "Example/GoogleMapsDemos/MapsDemoAssets.xcassets/Contents.json",
    "Example/GoogleMapsDemos/MasterViewController.h",
    "Example/GoogleMapsDemos/MasterViewController.m",
    "Example/GoogleMapsDemos/Resources/LaunchScreen.storyboard",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/h1.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/h1@2x.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/spitfire.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/spitfire@2x.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/voyager.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/voyager@2x.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/x29.png",
    "Example/GoogleMapsDemos/Resources/Museum-Icons/x29@2x.png",
    "Example/GoogleMapsDemos/Resources/aeroplane.png",
    "Example/GoogleMapsDemos/Resources/aeroplane@2x.png",
    "Example/GoogleMapsDemos/Resources/ar.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/argentina-large.png",
    "Example/GoogleMapsDemos/Resources/argentina.png",
    "Example/GoogleMapsDemos/Resources/arrow.png",
    "Example/GoogleMapsDemos/Resources/arrow@2x.png",
    "Example/GoogleMapsDemos/Resources/australia-large.png",
    "Example/GoogleMapsDemos/Resources/australia-large@2x.png",
    "Example/GoogleMapsDemos/Resources/australia.png",
    "Example/GoogleMapsDemos/Resources/boat.png",
    "Example/GoogleMapsDemos/Resources/boat@2x.png",
    "Example/GoogleMapsDemos/Resources/botswana-large.png",
    "Example/GoogleMapsDemos/Resources/botswana.png",
    "Example/GoogleMapsDemos/Resources/bulgaria-large.png",
    "Example/GoogleMapsDemos/Resources/bulgaria.png",
    "Example/GoogleMapsDemos/Resources/ca.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/cs.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/da.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/de.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/el.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/en.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/en_GB.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/es.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/fi.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/fr.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/glow-marker.png",
    "Example/GoogleMapsDemos/Resources/glow-marker@2x.png",
    "Example/GoogleMapsDemos/Resources/he.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/hr.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/hu.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/id.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/it.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/ja.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/ko.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/mapstyle-night.json",
    "Example/GoogleMapsDemos/Resources/mapstyle-retro.json",
    "Example/GoogleMapsDemos/Resources/mapstyle-silver.json",
    "Example/GoogleMapsDemos/Resources/ms.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/museum-exhibits.json",
    "Example/GoogleMapsDemos/Resources/nb.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/newark_nj_1922.jpg",
    "Example/GoogleMapsDemos/Resources/nl.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/pl.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/popup_santa.png",
    "Example/GoogleMapsDemos/Resources/popup_santa@2x.png",
    "Example/GoogleMapsDemos/Resources/pt.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/pt_PT.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/ro.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/ru.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/sk.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/step1.png",
    "Example/GoogleMapsDemos/Resources/step1@2x.png",
    "Example/GoogleMapsDemos/Resources/step2.png",
    "Example/GoogleMapsDemos/Resources/step2@2x.png",
    "Example/GoogleMapsDemos/Resources/step3.png",
    "Example/GoogleMapsDemos/Resources/step3@2x.png",
    "Example/GoogleMapsDemos/Resources/step4.png",
    "Example/GoogleMapsDemos/Resources/step4@2x.png",
    "Example/GoogleMapsDemos/Resources/step5.png",
    "Example/GoogleMapsDemos/Resources/step5@2x.png",
    "Example/GoogleMapsDemos/Resources/step6.png",
    "Example/GoogleMapsDemos/Resources/step6@2x.png",
    "Example/GoogleMapsDemos/Resources/step7.png",
    "Example/GoogleMapsDemos/Resources/step7@2x.png",
    "Example/GoogleMapsDemos/Resources/step8.png",
    "Example/GoogleMapsDemos/Resources/step8@2x.png",
    "Example/GoogleMapsDemos/Resources/sv.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/th.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/tr.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/track.json",
    "Example/GoogleMapsDemos/Resources/uk.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/vi.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/zh_CN.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/Resources/zh_TW.lproj/InfoPlist.strings",
    "Example/GoogleMapsDemos/SDKDemoAPIKey.h",
    "Example/GoogleMapsDemos/Samples/AnimatedCurrentLocationViewController.h",
    "Example/GoogleMapsDemos/Samples/AnimatedCurrentLocationViewController.m",
    "Example/GoogleMapsDemos/Samples/AnimatedUIViewMarkerViewController.h",
    "Example/GoogleMapsDemos/Samples/AnimatedUIViewMarkerViewController.m",
    "Example/GoogleMapsDemos/Samples/BasicMapViewController.h",
    "Example/GoogleMapsDemos/Samples/BasicMapViewController.m",
    "Example/GoogleMapsDemos/Samples/CameraViewController.h",
    "Example/GoogleMapsDemos/Samples/CameraViewController.m",
    "Example/GoogleMapsDemos/Samples/CustomIndoorViewController.h",
    "Example/GoogleMapsDemos/Samples/CustomIndoorViewController.m",
    "Example/GoogleMapsDemos/Samples/CustomMarkersViewController.h",
    "Example/GoogleMapsDemos/Samples/CustomMarkersViewController.m",
    "Example/GoogleMapsDemos/Samples/DoubleMapViewController.h",
    "Example/GoogleMapsDemos/Samples/DoubleMapViewController.m",
    "Example/GoogleMapsDemos/Samples/FitBoundsViewController.h",
    "Example/GoogleMapsDemos/Samples/FitBoundsViewController.m",
    "Example/GoogleMapsDemos/Samples/FixedPanoramaViewController.h",
    "Example/GoogleMapsDemos/Samples/FixedPanoramaViewController.m",
    "Example/GoogleMapsDemos/Samples/FrameRateViewController.h",
    "Example/GoogleMapsDemos/Samples/FrameRateViewController.m",
    "Example/GoogleMapsDemos/Samples/GeocoderViewController.h",
    "Example/GoogleMapsDemos/Samples/GeocoderViewController.m",
    "Example/GoogleMapsDemos/Samples/GestureControlViewController.h",
    "Example/GoogleMapsDemos/Samples/GestureControlViewController.m",
    "Example/GoogleMapsDemos/Samples/GradientPolylinesViewController.h",
    "Example/GoogleMapsDemos/Samples/GradientPolylinesViewController.m",
    "Example/GoogleMapsDemos/Samples/GroundOverlayViewController.h",
    "Example/GoogleMapsDemos/Samples/GroundOverlayViewController.m",
    "Example/GoogleMapsDemos/Samples/IndoorMuseumNavigationViewController.h",
    "Example/GoogleMapsDemos/Samples/IndoorMuseumNavigationViewController.m",
    "Example/GoogleMapsDemos/Samples/IndoorViewController.h",
    "Example/GoogleMapsDemos/Samples/IndoorViewController.m",
    "Example/GoogleMapsDemos/Samples/MapLayerViewController.h",
    "Example/GoogleMapsDemos/Samples/MapLayerViewController.m",
    "Example/GoogleMapsDemos/Samples/MapTypesViewController.h",
    "Example/GoogleMapsDemos/Samples/MapTypesViewController.m",
    "Example/GoogleMapsDemos/Samples/MapZoomViewController.h",
    "Example/GoogleMapsDemos/Samples/MapZoomViewController.m",
    "Example/GoogleMapsDemos/Samples/MarkerEventsViewController.h",
    "Example/GoogleMapsDemos/Samples/MarkerEventsViewController.m",
    "Example/GoogleMapsDemos/Samples/MarkerInfoWindowViewController.h",
    "Example/GoogleMapsDemos/Samples/MarkerInfoWindowViewController.m",
    "Example/GoogleMapsDemos/Samples/MarkerLayerViewController.h",
    "Example/GoogleMapsDemos/Samples/MarkerLayerViewController.m",
    "Example/GoogleMapsDemos/Samples/MarkersViewController.h",
    "Example/GoogleMapsDemos/Samples/MarkersViewController.m",
    "Example/GoogleMapsDemos/Samples/MyLocationViewController.h",
    "Example/GoogleMapsDemos/Samples/MyLocationViewController.m",
    "Example/GoogleMapsDemos/Samples/PaddingBehaviorViewController.h",
    "Example/GoogleMapsDemos/Samples/PaddingBehaviorViewController.m",
    "Example/GoogleMapsDemos/Samples/PanoramaViewController.h",
    "Example/GoogleMapsDemos/Samples/PanoramaViewController.m",
    "Example/GoogleMapsDemos/Samples/PolygonsViewController.h",
    "Example/GoogleMapsDemos/Samples/PolygonsViewController.m",
    "Example/GoogleMapsDemos/Samples/PolylinesViewController.h",
    "Example/GoogleMapsDemos/Samples/PolylinesViewController.m",
    "Example/GoogleMapsDemos/Samples/Samples.h",
    "Example/GoogleMapsDemos/Samples/Samples.m",
    "Example/GoogleMapsDemos/Samples/SnapshotReadyViewController.h",
    "Example/GoogleMapsDemos/Samples/SnapshotReadyViewController.m",
    "Example/GoogleMapsDemos/Samples/StampedPolylinesViewController.h",
    "Example/GoogleMapsDemos/Samples/StampedPolylinesViewController.m",
    "Example/GoogleMapsDemos/Samples/StructuredGeocoderViewController.h",
    "Example/GoogleMapsDemos/Samples/StructuredGeocoderViewController.m",
    "Example/GoogleMapsDemos/Samples/StyledMapViewController.h",
    "Example/GoogleMapsDemos/Samples/StyledMapViewController.m",
    "Example/GoogleMapsDemos/Samples/TileLayerViewController.h",
    "Example/GoogleMapsDemos/Samples/TileLayerViewController.m",
    "Example/GoogleMapsDemos/Samples/TrafficMapViewController.h",
    "Example/GoogleMapsDemos/Samples/TrafficMapViewController.m",
    "Example/GoogleMapsDemos/Samples/VisibleRegionViewController.h",
    "Example/GoogleMapsDemos/Samples/VisibleRegionViewController.m",
    "Example/GoogleMapsDemos/UIViewController+GMSToastMessages.h",
    "Example/GoogleMapsDemos/UIViewController+GMSToastMessages.m",
    "Example/GoogleMapsDemos/main.m",
    "Example/README.GoogleMapsDemos",
    "SwiftExample/GoogleMapsSwiftDemos.xcodeproj/project.pbxproj",
    "SwiftExample/GoogleMapsSwiftDemos/Info.plist",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Contents.json",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_120.png",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_152.png",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_167.png",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_180.png",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/AppIcon.appiconset/Maps-SDK-Demo-App_76.png",
    "SwiftExample/GoogleMapsSwiftDemos/MapsDemoAssets.xcassets/Contents.json",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/LaunchScreen.storyboard",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/h1.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/h1@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/spitfire.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/spitfire@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/voyager.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/voyager@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/x29.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/Museum-Icons/x29@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/aeroplane.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/aeroplane@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ar.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/argentina-large.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/argentina.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/arrow.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/arrow@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/australia-large.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/australia-large@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/australia.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/boat.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/boat@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/botswana-large.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/botswana.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/bulgaria-large.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/bulgaria.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ca.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/cs.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/da.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/de.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/el.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/en.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/en_GB.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/es.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/fi.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/fr.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/glow-marker.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/glow-marker@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/he.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/hr.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/hu.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/id.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/it.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ja.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ko.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/mapstyle-night.json",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/mapstyle-retro.json",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/mapstyle-silver.json",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ms.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/museum-exhibits.json",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/nb.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/newark_nj_1922.jpg",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/nl.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/pl.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/popup_santa.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/popup_santa@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/pt.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/pt_PT.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ro.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/ru.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/sk.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step1.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step1@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step2.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step2@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step3.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step3@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step4.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step4@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step5.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step5@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step6.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step6@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step7.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step7@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step8.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/step8@2x.png",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/sv.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/th.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/tr.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/track.json",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/uk.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/vi.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/zh_CN.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Resources/zh_TW.lproj/InfoPlist.strings",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/AppDelegate.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/SDKConstants.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/SampleListViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/AnimatedCurrentLocationViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/AnimatedUIViewMarkerViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/BasicMapViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/CameraViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/CustomIndoorViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/CustomMarkersViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/DoubleMapViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/FitBoundsViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/FixedPanoramaViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/FrameRateViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/GMSMapStyle+Bundle.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/GeocoderViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/GestureControlViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/GradientPolylinesViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/GroundOverlayViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/IndoorMuseumNavigationViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/IndoorViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MapLayerViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MapTypesViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MapZoomViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MarkerEventsViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MarkerInfoWindowViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MarkerLayerViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MarkersViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/MyLocationViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/PaddingBehaviorViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/PanoramaViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/PolygonsViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/PolylinesViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/SampleLevel.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/SampleMapStyle.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/Samples.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/SnapshotReadyViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/StructuredGeocoderViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/StyledMapViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/TileLayerViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/TrafficMapViewController.swift",
    "SwiftExample/GoogleMapsSwiftDemos/Swift/Samples/VisibleRegionViewController.swift",
    "CHANGELOG.md",
    "README.md",
    "Example/Podfile",
    "SwiftExample/Podfile"
  ],
  "readme": "https://dl.google.com/dl/cpdc/1c27a020313febc7/GoogleMaps-6.0.1-README.md",
  "source": {
    "http": "https://dl.google.com/dl/cpdc/1c27a020313febc7/GoogleMaps-6.0.1.tar.gz"
  },
  "summary": "Google Maps SDK for iOS.",
  "version": "6.0.1",
  "subspecs": [
    {
      "frameworks": [
        "CoreData",
        "CoreGraphics",
        "CoreLocation",
        "CoreTelephony",
        "QuartzCore",
        "SystemConfiguration",
        "UIKit"
      ],
      "libraries": [
        "c++",
        "z"
      ],
      "name": "Base",
      "vendored_frameworks": [
        "Base/Frameworks/GoogleMapsBase.framework"
      ]
    },
    {
      "dependencies": {
        "GoogleMaps/Base": [

        ]
      },
      "frameworks": [
        "Accelerate",
        "CoreImage",
        "CoreText",
        "GLKit",
        "ImageIO",
        "Metal",
        "OpenGLES",
        "QuartzCore"
      ],
      "name": "Maps",
      "resources": [
        "Maps/Frameworks/GoogleMaps.framework/Resources/GoogleMaps.bundle"
      ],
      "vendored_frameworks": [
        "Maps/Frameworks/GoogleMaps.framework",
        "Maps/Frameworks/GoogleMapsCore.framework"
      ]
    },
    {
      "dependencies": {
        "GoogleMaps/Maps": [

        ]
      },
      "name": "M4B",
      "vendored_frameworks": [
        "M4B/Frameworks/GoogleMapsM4B.framework"
      ]
    }
  ]
}

当我们使用 pod install 的时候会根据这些配置去 clone 我们需要的仓库,并创建一个工作空间,自动添加依赖。

创建私有仓库

我这里使用的是 Gitee,习惯了,创建了两个仓库,一个是 BaseSpec,用来存放配置,所有的配置按照包名、版本号分门别类的存放在这个仓库,这个仓库只用来存放.Podspec文件,不存放代码。另一个是 BaseCode 代码仓库,用来存放我们的测试库代码。

  • 创建两个仓库

创建 BaseSpec 的时候记得使用 README 初始化仓库,不然在后面推的时候会报错

warning: Could not find remote branch 0.1.0 to clone.
fatal: Remote branch 0.1.0 not found in upstream origin

创建好之后在本地添加源

pod repo add BaseCodeSpec https://gitee.com/zcb1603999/base-spec.git

添加成功之后就可以在 repos 文件夹下看到源目录 BaseCodeSpec

  • 创建本地代码库

用 shell 切换到桌面,直接使用命令创建一个名叫 BaseCode 的 lib

cd Desktop #切换到桌面
pod lib create BaseCode  #创建一个pod组件

此时会出现一些配置选项,按自己的需要选择就行

# 选择平台
What platform do you want to use?? [ iOS / macOS ] 
 > iOS

# 选择编程语言
What language do you want to use?? [ Swift / ObjC ] 
 > ObjC

# 是否需要一个例子工程
Would you like to include a demo application with your library? [ Yes / No ] 
 > Yes

# 选择一个测试框架
Which testing frameworks will you use? [ Specta / Kiwi / None ] 
 > None

# 是否要做 UI 测试
Would you like to do view based testing? [ Yes / No ] 
 > Yes

# 定义类前缀
What is your class prefix?  
 > DC

不出意外已经在桌面自动创建出了一个 BaseCode 的文件夹,而且会自动生成一个 Xcode 项目,并且自动打开了。

使用命令切换到生成的文件夹中,这里已经自动生成了git配置,我们直接把远程的仓库地址添加上

git remote add origin https://gitee.com/zcb1603999/base-code.git

修改 BaseCode.podspec

Pod::Spec.new do |s|
  s.name             = 'BaseCode'
  s.version          = '0.1.0'
  s.summary          = '测试仓库'

# 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
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://gitee.com/zcb1603999/base-code.git'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'zcb1603999' => '313707304@qq.com' }
  s.source           = { :git => 'https://gitee.com/zcb1603999/base-code.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '9.0'

  s.source_files = 'BaseCode/Classes/**/*'

  # s.resource_bundles = {
  #   'BaseCode' => ['BaseCode/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end

修改完直接提交

git add .
git commit -m "首次添加"
git push --set-upstream origin master

这里我们直接打一个 tag,因为后面源仓库需要使用tag确定版本号

git tag -m "first release" 0.1.0
git push --tags

检测 podspec 文件的有效性,只有检测通过才能推到远端源仓库

pod lib lint
pod lib lint 
# 如果有警告,会导致无法通过,需要添加--allow-warnings,允许警告
# 如果使用了c函数或静态库,需要添加--use-libraries
# 如果同时依赖了公有库和私有库,你必须指定源才行,因为默认只会去公有源中查找对应的依赖,需要添加库的源--sources='https://xxxx'

校验通过就可以推到源仓库了

pod repo push BaseCodeSpec BaseCode.podspec

  • 使用

修改需要使用本库的项目的 Podfile

source 'https://github.com/CocoaPods/Specs.git'
source 'https://gitee.com/zcb1603999/base-spec.git'

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'Base' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Base
  pod 'BaseCode', '~> 0.1.0'

end

执行 pod install 就能看到引用到该库了

  • 升级

给库添加一个类,用来测试,注意一定要放在 Classes 文件夹下,因为配置文件中的路径是在这个文件夹下

添加测试代码

@interface BaseCodeTest : NSObject

+ (void)helloWorld;

@end

@implementation BaseCodeTest

+ (void)helloWorld {
    NSLog(@"Hello World!");
}

@end

修改配置中的版本号

Pod::Spec.new do |s|
  s.name             = 'BaseCode'
  s.version          = '0.3.0'
  s.summary          = '测试仓库'

# 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
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://gitee.com/zcb1603999/base-code.git'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'zcb1603999' => '313707304@qq.com' }
  s.source           = { :git => 'https://gitee.com/zcb1603999/base-code.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '9.0'

  s.source_files = 'BaseCode/Classes/**/*'

  # s.resource_bundles = {
  #   'BaseCode' => ['BaseCode/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end

使用以下命令提交

git add .
git commit -m "第二次提交"
git push
git push -f -u origin master
git tag -m "second release" 0.3.0
git push --tags
pod lib lint
pod repo push BaseCodeSpec BaseCode.podspec

然后我们就可以在项目中修改版本号,执行 pod install 之后就能看到依赖的仓库升级了,直接就能在项目中使用了

#import "BaseCodeTest.h"

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [BaseCodeTest helloWorld];
}
@end

以上就是私有仓库的创建使用和升级了,有机会的话再看一下非开源仓库的创建。