资源管理库R.swift
的使用
- 安装
pod 'R.swift'
- 脚本配置
- 工程中配置
"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/R.generated.swift"
- 在pod私有库中使用R.swift
需要配置*.podspec
脚本
r = <<-CMD
"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/../MyFramework/Classes/R.generated.swift"
CMD
spec.script_phase = [
{ :name => 'R.swift', :script => r, :shell_path => '/bin/sh', :execution_position => :before_compile}
]
- pod 安装
pod install
可以看到在对应target
中已经增加了Script Phase
,名字为:[CP-User]R.swift
cocoapods组件化(1)
cocoapods组件化(2)
网友评论