ios模塊組件化-殼工程創(chuàng)建

第一步:github或者gitlab創(chuàng)建殼工程倉庫


第二步:本地創(chuàng)建ios工程

1.cd?目錄

2.pod init?

3.pod install

4.生成忽略配置

touch .gitignore

5.打開.gitignore

vim?.gitignore

6.黏貼下面保存

# Xcode

#

# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings

xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)

*.xcscmblueprint

*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)

build/

DerivedData/

*.moved-aside

*.pbxuser

!default.pbxuser

*.mode1v3

!default.mode1v3

*.mode2v3

!default.mode2v3

*.perspectivev3

!default.perspectivev3

## Obj-C/Swift specific

*.hmap

## App packaging

*.ipa

*.dSYM.zip

*.dSYM

## Playgrounds

timeline.xctimeline

playground.xcworkspace

# Swift Package Manager

#

# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.

# Packages/

# Package.pins

# Package.resolved

# *.xcodeproj

#

# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata

# hence it is not needed unless you have added a package configuration file to your project

# .swiftpm

.build/

# CocoaPods

#

# We recommend against adding the Pods directory to your .gitignore. However

# you should judge for yourself, the pros and cons are mentioned at:

# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control

#

Pods/

#

# Add this line if you want to avoid checking in source code from the Xcode workspace

# *.xcworkspace

# Carthage

#

# Add this line if you want to avoid checking in source code from Carthage dependencies.

# Carthage/Checkouts

Carthage/Build/

# Accio dependency management

Dependencies/

.accio/

# fastlane

#

# It is recommended to not store the screenshots in the git repo.

# Instead, use fastlane to re-generate the screenshots whenever they are needed.

# For more information about the recommended setup visit:

# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml

fastlane/Preview.html

fastlane/screenshots/**/*.png

fastlane/test_output

# Code Injection

#

# After new code Injection tools there's a generated folder /iOSInjectionProject

# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

7.配置?README.MD

touch README.MD

8.打開README.MD

vim?README.MD

添加以下保存

```bash

git clone --recursive 殼工程倉庫git地址

cd 目錄

pod install

```

### 添加 submodule 方法

#### 手動導入

1. 執(zhí)行 `git submodule add [submodule url] submodules/[submodule dir name]` , >其中的`[submodule url]`不能為空的項目

2. 在 `Podfile` 中添加新的 submodule 的依賴

3. `pod install`

#### 腳本導入

1. 在 `ProjConfig.json` 文件中按照之前格式添加子模塊

2. 在 `Podfile` 中添加新的 submodule 的依賴

3. 安裝腳本工具`xyscript`,并執(zhí)行在工程路徑下執(zhí)行拉取子模塊命令`xyscript pullsubmodule`

// 子模塊配置文件

touch ProjConfig.json

打開 ProjConfig.json 文件添加

[

? {

? ? "module":"子模塊本地路徑",

? ? "branch":"子模塊分支名"

? }

]

9.git init?

10.git remote add origin?殼工程倉庫?git?地址?

11.git add .?

12.git commit -m "Initial commit"?

13.git push -u origin master(遠程分支名)

第三步:拉取殼工程

```bash

git clone --recursive ?殼工程倉庫?git?地址?

cd?目錄

pod install

```

###?添加?submodule?方法

####?手動導入

1.?執(zhí)行?`git submodule add?[submodule url]?submodules/[submodule dir name]`?, 其中的`[submodule url]`不能為空的項目

2.?在?`Podfile`?中添加新的?submodule?的依賴

3. `pod install`

####?腳本導入

1.?在?`ProjConfig.json`?文件中按照之前格式添加子模塊

2.?在?`Podfile`?中添加新的?submodule?的依賴

3.?安裝腳本工具`xyscript`,并執(zhí)行在工程路徑下執(zhí)行拉取子模塊命令`xyscript pullsubmodule`

//子模塊配置文件?touch ProjConfig.json

打開?ProjConfig.json?文件添加 [

{

"module":" 子模塊本地路徑",?

"branch":"子模塊分支名"

}

]

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容