How R.swift can save your project’s time

Photo by Djim Loic on Unsplash

Original post

iOS swift project gives you a dozen of ways to share your color, fonts, configs. I started my iOS career a few years ago and as an average programmer, I want to share some global data and I wrote my custom stuff for this.

It is not a problem, to create a custom manager for sharing global data, but it needs additional setup, and it has some disadvantages.

And this is time for R.swift library. You can easily download this pod to your project. The installation you can find in GitHub repo. R.swift automatically generates resources for all added images, texts in Localizable files, fonts, nib files, some resource files like JSON files, storyboards, and cells.

So you can simply add fonts to some folder and add data to info.plist about them, and that’s all. (Or add colors and images to Assets.xcassets folder. This data will be available in globally generated R struct. You can use these data like below:

For more convenient use, you can add typealias for more shorthand form.

I recommend using R.swift in your iOS projects, it will save your time, and gives you the ability to avoid creating some custom managers for fonts, colors, images, etc. Leave this routine work for this awesome tool.

R.swift library

iOS Software Developer