A Swift library providing strongly typed, autocompleted access to resources like images, fonts, and segues in iOS/macOS projects.
R.swift is a Swift library and build tool that generates a strongly typed `R` struct to access app resources like images, fonts, colors, and localized strings. It solves the problem of using error-prone string literals for resource access by providing compile-time checked, autocompleted code that prevents runtime crashes from typos.
iOS and macOS developers working in Swift who want to eliminate stringly-typed resource access and improve code safety and developer experience in Xcode.
Developers choose R.swift because it turns runtime errors into compile-time errors, provides full IDE autocompletion for resources, and integrates seamlessly into the Xcode build process, making resource access intuitive and robust.
Strong typed, autocompleted resources like images, fonts and segues in Swift projects
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Catches typos in resource names at compile time instead of runtime, preventing crashes from incorrect strings, as shown in the demo where renaming an image triggers a compile error.
Provides autocompletion for images, fonts, strings, and other resources in Xcode, reducing guesswork and speeding up development, demonstrated in the autocompleted images GIF.
Supports a wide range of resources including images, fonts, colors, localized strings, storyboards, and nibs, as listed in the features section with dedicated examples.
Optional R.validate() function checks for missing images, fonts, or storyboard resources at launch, ensuring all referenced assets are available, as explained in the runtime validation documentation.
Setup requires adding build tool plugins or run script phases, and on CI servers like Xcode Cloud, extra steps to disable plugin validation add overhead, as noted in the installation instructions.
The R.generated.swift file must be manually added to the project and excluded from git to avoid conflicts, introducing version control complexity, as mentioned in the tip to add *.generated.swift to .gitignore.
Limited to Swift projects; mixed Objective-C/Swift codebases or pure Objective-C projects cannot benefit from R.swift's type safety, which is a inherent limitation of the tool.