diff --git a/Documentation/QandA.md b/Documentation/QandA.md index 6cfaa99f..7010618c 100644 --- a/Documentation/QandA.md +++ b/Documentation/QandA.md @@ -27,6 +27,12 @@ The reason this happens is because of the availability of the var `R.image.setti If you get errors like `Use of undeclared type 'SomeType'` in the `R.generated.swift` file most of the time this can be fixed by [explicitly stating the module in your xib or storyboard](Images/ExplicitCustomModule.png). This will make R.swift recognize that an import is necessary. +## Can I use R.swift in a library? + +Yes, just add R.swift as a buildstep in your library project and it will work just like normal. If you want to expose the resources to users of your library you have to make the generated code public, you can do this by adding `--accessLevel public` to the call to R.swift. + +For example Cocoapods users would change their build step to: `"$SRCROOT/rswift" --accessLevel public "$SRCROOT"` + ## How does R.swift work? During installation you add R.swift as a Build phase to your target, basically this means that: diff --git a/Readme.md b/Readme.md index b5dec086..ab53209d 100644 --- a/Readme.md +++ b/Readme.md @@ -65,6 +65,7 @@ Runtime validation with [`R.validate()`](Documentation/Examples.md#runtime-valid - [What are the requirements to run R.swift?](Documentation/QandA.md#what-are-the-requirements-to-run-rswift) - [How to use methods with a `Void` argument?](Documentation/QandA.md#how-to-use-methods-with-a-void-argument) - [How to fix missing imports in the generated file?](Documentation/QandA.md#how-to-fix-missing-imports-in-the-generated-file) +- [Can I use R.swift in a library?](Documentation/QandA.md#can-i-use-rswift-in-a-library) - [How does R.swift work?](Documentation/QandA.md#how-does-rswift-work) - [How to upgrade to a new major version?](Documentation/Migration.md)