Comments (4)
Since this is all generated code, there's no problem with duplication, so you can definitely do both: Namespacing and merging structs.
This solves the issue for when you have an ambiguous name.
For example, when you have an image and a segue both named "hello", you can do: R.storyboard.Main.hello
and R.assets.Main.hello
.
And for unambiguous names, you can still use R.Main.goodbye
.
However, you can't just leave out hello
from R.Main
, since that would be very annoying during development. I guess the best would be to create a dummy field of a different type, so a developer immediately knows what the issue is, e.g.: hello: AmbiguousFieldUseStoryboardOrAssets
from r.swift.
Or, you know, just include the full file name: R.Main.storyboard.hello
and R.Main.xcassets.hello
This also scales to directory hierarchies.
from r.swift.
Hmm, think I like the explicit versions better. You don't want to think you get an UIImage
by accessing R.main.hello
and accidentally call the string overload, because it's a segue identifier. Let's try that first and optimize towards shorthands if real life development shows that's needed.
from r.swift.
Just discovered with @tomlokhorst that duplicate image names are a no-go even when in different asset folder. So that makes R.images.[name]
possible.
from r.swift.
Related Issues (20)
- Add 7.4.0 to CocoaPods HOT 1
- 1 duplicate report for Sandbox: rswift(99044) deny(1) file-read-data /Users/*/Desktop/*/*/Pods/R.swift HOT 6
- When I tried to achieve, I encountered this error. "not loaded: @rpath/RswiftResources.framework/Versions/A/RswiftResources" HOT 6
- What will be the new way to use the deprecated code? HOT 2
- R.swift not work well with automatic grammar agreement (`^[..](inflect: true)`) HOT 3
- Fonts not generated HOT 1
- How can use `--generators` in swift plugin for SPM
- String catalogs from WWDC23 HOT 4
- Unable to build using XCode Cloud HOT 6
- [Xcode-15] Multiple commands produce fail HOT 2
- [feature request] Add support for JSON xcode projects
- I can't make a build using the RswiftModifyXcodePackages plugin HOT 2
- How to use SPM plugin and select generators? HOT 2
- Generated files too large
- Any support of Privacy Manifest? HOT 2
- Localization issue HOT 2
- Cannot call value of non-function type 'ImageResource' HOT 5
- Formatting only part of a string using R.string.localizable
- Xcode is giving me No such module 'Rswift' HOT 1
- Error instal SPM HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r.swift.