Implementation R.Swift in Swift 4



Hmm... 😂 you have problem to remember word, you often typo when writhing variables in coding. don't be a sad, it doesn't matter. you can use R.swift library. Like R in android, its get strong typed, autocompleted resources like images, font and Storyboard.

Recommended use Cocoapods of installation R.Swift library, cuz  this avoids including  any binary files into your project. Note on Carthage, R.swift is a tool used in a build step , it is not a dynamic library.

Step instalation :

- pod init 

- open podfile and add "pod 'R.swift"

- pod install

- open project in xcode 

- Click on your project in the file list, choose your target under TARGETS, click the Build Phases tab and add a New Run Script Phase by clicking the little plus icon in the top left

- Drag the new Run Script phase above the Compile Source phases and below Check Pods Manifest.lock, expand it and paste the following script :

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

-  Add $TEMP_DIR/rswift-lastrun to the "Input Files" and  $SRCROOT/R.generated.swift to the "Output Files" of the Build Phase.



- Build your project, in Finder you will now see a R.generated.swift in the $SRCROOT-folder  drag the R.generated.swift files into your project and uncheck Copy items if needed    

- If you want to add a new parameter or feature like color, font and other , please build it first before you can use it 

- Library Link : https://github.com/mac-cain13/R.swift 

 



 


Implementation R.Swift in Swift 4 Implementation R.Swift in Swift 4 Reviewed by sdiik on أكتوبر 12, 2020 Rating: 5

ليست هناك تعليقات:

يتم التشغيل بواسطة Blogger.