美文网首页
R.swift 详细配置

R.swift 详细配置

作者: pingxhcn | 来源:发表于2021-07-05 18:52 被阅读0次

1、Target --> Build phrase , 点击 + 选择添加 New Run Script Phase
2、将 Run Script 移动到 [CP]Check Pods Manifest.lock 之上
如果没有移动位置操作,可能会出现以下错误:

Cycle inside Test_02; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle details:
→ Target 'Test_02': CodeSign /Users/eric.zhou/Library/Developer/Xcode/DerivedData/Test_02-hhjbdwsoixlxutgpiefubiseactl/Build/Products/Debug-iphonesimulator/Test_02.app
○ That command depends on command in Target 'Test_02': script phase “Run Script”
○ Target 'Test_02': Ditto /Users/eric.zhou/Library/Developer/Xcode/DerivedData/Test_02-hhjbdwsoixlxutgpiefubiseactl/Build/Intermediates.noindex/Test_02.build/Debug-iphonesimulator/Test_02.build/DerivedSources/Test_02-Swift.h /Users/eric.zhou/Library/Developer/Xcode/DerivedData/Test_02-hhjbdwsoixlxutgpiefubiseactl/Build/Intermediates.noindex/Test_02.build/Debug-iphonesimulator/Test_02.build/Objects-normal/x86_64/Test_02-Swift.h
○ Target 'Test_02' has compile command for Swift source files

3、在 Run Script 中添加

$PODS_ROOT/R.swift/rswift generate $SRCROOT/R.generated.swift

Input Files:

$TEMP_DIR/rswift-lastrun

Output Files

$SRCROOT/R.generated.swift

4、Command + B 编译项目,会在工程目录下自动生成 R.generated.swift文件,添加到项目目录即可。

使用:

let image = R.image.loginImage()

相关文章

网友评论

      本文标题:R.swift 详细配置

      本文链接:https://www.haomeiwen.com/subject/wauiultx.html