创建主程序:MainProject
目录结构:
sandbox设置成NO:否则Xcode15不能运行
创建子程序
创建Framework
创建多个子程序后的目录结构
在主程序的Podfile中添加代码
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
use_frameworks!workspace 'MainProject.xcworkspace' #工作台路径
project 'MainProject.xcodeproj'target 'MainProject' doproject 'MainProject.xcodeproj'pod 'Alamofire', '5.8.0' pod 'Toast-Swift', '5.0.1'
endtarget 'OneProject' doproject 'OneProject/OneProject.xcodeproj'
endtarget 'TwoProject' doproject 'TwoProject/TwoProject.xcodeproj'
endpost_install do |installer|installer.pods_project.targets.each do |target|target.build_configurations.each do |config|config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'endend
end
在MainProject目录下Pod install
在OneProject中创建Public 类
主程序中添加引用:TARGETS->Build Phases -> Link Binary With Libraries
在主程序中添加引用库即可