mac-cain13 / R.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects
MIT License
9.49k stars 760 forks source link

Project with R.swift as Pod #483

Closed EvsenevDev closed 5 years ago

EvsenevDev commented 5 years ago

Hi, we have project which using R.swift for xibs, strings, assets. We are going to use this project as Pod. In Podspec we added dependency R.swift

s.source_files  = "APPNAME/**/*.{swift}"
s.exclude_files = "APPNAME/AppDelegate.swift"
s.resource_bundles = { "APPNAME" => ["APPNAME/**/*.{png,jpeg,jpg,xcassets,pdf,stringsdict,strings,storyboard,xib}"] }

Issue: Our generated R file in .gitignore and R.swift should generate file from Xcode project which not included into Podspec. Included just resources and swift files.

Question: How we can avoid commit R.swift.generated and generate it after pod install our project (with R.swift) as dependency?

mac-cain13 commented 5 years ago

You could add R.swift as a dependency of your own pod and then run R.swift on install if you really want this. But in general I think libraries should be as simple as possible and just pull in source without generating stuff on the fly.

So I would at least for releases of your Pod include the R.generated.swift file or maybe just commit it always. Shouldn't be too hard to work with since the file is sorted, so conflicts shouldn't occur often and if they do you can just rerun R.swift to fix things for you.