R.swift
R.swift copied to clipboard
Add support for bundle folder
Hi,
please add support for items in Resources.bundle e.g.: Resources.bundle/images/[email protected]. Because when we use Resources.bundle, then there are not changes at pbxproj file for each change in this directory with using git
Thanks
I'm not sure how many people would benefit from supporting bundles, if you have a pure Swift project you can just use frameworks and generate a R.generated.swift
file within the project exposing the resources in there. A seperate bundle with resources sounds to me like a thing from the ObjC world with static linked frameworks that couldn't include resources.
Maybe I'm wrong, love to hear about the use cases, but I don't think this is a top priority.
We use bundle folders for easy collaboration with designers. They behave like referenced folders in Xcode, no change to the .pbxproj file for easy GIT. No need to handle .xcassets JSON structure, no slow drag-&-drop of resources in Xcode, no problems with resources renaming and moving. Designers just export PNGs into the bundle and push to GIT repository. No need to learn designers anything about the Xcode and GIT conflicts resolving.
Bundles have too many pluses to not to use them.
@martinflorek If your designers use sketch you may want to check these two plugins: https://github.com/iGenius-Srl/Seca https://github.com/iGenius-Srl/sketch-app-asset-export
The resources exported with these plugins generate also the json structure ( for ios only) and take care of the naming conventions
What we do:
We have a git repo where designers export using these plugins Then for both iOS and Android we have a python script that just copies the files in the project at build time.
Together with @tomlokhorst I looked into bundle support. Also relates to CocoaPods w/bundles as discussed in #295.
We think R.swift should detect the bundle by itself, since bundles are also mentioned in the Copy Resources build phase in Xcode. So we can detect them automatically and then put all resources found in that bundle under R.bundle.myBundle.*
.
This more robust than the proposed solution in PR #395 since this won't support having both resources in your project as well as in one or more bundles. Detecting bundles, picking out all resources and adding them in the R file should not be too hard to implement.
What about static frameworks? It's not contain resources
Static frameworks used for performance reason. We have about 200 pods in podfile.lock, and with dynamic frameworks app load about 15-30 sec dependent on iPhone model/iOS version. With static it takes about 3-5 sec.
Together with @tomlokhorst I looked into bundle support. Also relates to CocoaPods w/bundles as discussed in #295.
We think R.swift should detect the bundle by itself, since bundles are also mentioned in the Copy Resources build phase in Xcode. So we can detect them automatically and then put all resources found in that bundle under
R.bundle.myBundle.*
.This more robust than the proposed solution in PR #395 since this won't support having both resources in your project as well as in one or more bundles. Detecting bundles, picking out all resources and adding them in the R file should not be too hard to implement.
Hi. Has it (R.bundle.myBundle.*
) been already implemented?
Same question, how long will it take to implement this feature?
Seems this issue was opened in 2016. Was is the current status in 2022?
Our static framework must use the resource_bundles
to add our resources.
I saw a comment about support here: https://github.com/mac-cain13/R.swift/issues/295#issuecomment-617811400
Is this being considered for work or should I consider this workaround or removing R.swift entirely ?
Bundles are supported, see the example RswiftAppWithStaticFrameworks