移动端模块化开发

本文详细介绍了如何在iOS中使用GitHub和Cocoapods管理库,Android通过JitPack发布和引用库,以及Flutter和ReactNative中创建和集成第三方库的过程。
摘要由CSDN通过智能技术生成

一、iOS

使用GitHub&Cocoapods;

cd /Users/kevin/Desktop
pod lib create WidgetCollection-Swift

执行完上述命令后,依次填写后面的问题;
完成问题后我们配置WidgetCollection-Swift.podspec文件;
去GitHub上创建一个新的库WidgetCollection-Swift
然后将本地的工程推送到GitHub上;
验证本地的podspec;

cd podspec所在文件目录
pod spec lint WidgetCollection-Swift.podspec

把自己的库与本地podspec repo关联;

pod repoName push WidgetCollection-Swift.podspec

重新验证使用;
Podfile添加路径。

pod 'WidgetCollection-Swift', :git => 'https://github.com/KevinSnoopy/WidgetCollection-Swift.git'

二、Android

使用GitHub&JitPack
首先使用Android Studio创建Module,选择Android Library进行配置;
将Library上传至GitHub,选择对应的Release或创建新的Release,填写完整信息后Publish release;
JitPack官网,通过仓库地址找到对应的仓库;
点击Get it进行编译,编译成功后就可以被其他工程引用。

allprojects {
    repositories {
        maven { url 'https://jitpack.io/' }
    }
}
dependencies {
        compile 'com.github.xxx:xxxLibrary:$version'
    }

三、Flutter

使用GitHub;

cd /Users/kevin/Desktop
flutter create --template=package xxx

将对应的库上传至GitHub;
在pubspec.yaml的dependencies:或dev_dependencies:目录下添加对应的库。

四、RN

项目根目录下执行;

npm install -g react-native-create-library 或 yarn add react-native-create-library

创建库文件;

react-native-create-library xxxx

按照iOS或Android的步骤。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kevin写代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值