Documentation/Migration.md
Pointers for migration between major versions.
Demo video: Updating from R.swift 6 to Rswift 7
String(format:), even strings without arguments, make sure to escape any percentage signs (%) with %%R.string(preferredLanguages: ["fr"]).example.hello()If you're using Swift Package Manager:
R.generated.swift file is no longer needed in the project, delete the filerswift binarygithub.com/mac-cain13/R.swift.git packageRswiftLibrary to your targetsRswiftGenerateInternalResources or RswiftGeneratePublicResources (Screenshot)RswiftXcodeModifyPackages to modify your Xcode project so that the build tool plug-in will actually run during builds (this seems to fix a bug in Xcode?) (Screenshot)If you're using Mint or manual call rswift executable:
github.com/mac-cain13/R.swift.git packageRswiftLibrary to your targetsChanges to the commandline tool rswift (not relevant when using SPM):
accessLevel renamed to access-levelgenerateUITestFile removed, if you need a separate file with just ids, call rswift a second time with --generators idhostingBundle removed, bundle can be specified in code: _R(bundle: someBundle)bundleIdentifier, productModuleName, infoPlistFile, codeSignEntitlements, builtProductsDir, developerDir, platformDir, sdkRoot, sourceRoot. Use environment variables instead.Internal changes in the Rswift support library:
R.nib.XXX.secondView to .twentiethView has been removed, only .firstView remainsimport Rswift to import RswiftResourcesColorResourceType, FileResourceType, FontResourceType, IdentifierType, ImageResourceType, StoryboardViewControllerResourceType, StringResourceType, ValidatableStringResource1 up to StringResource9, for strings with parametersReuseIdentifierType to ReuseIdentifierContainerNibResourceType to NibReferenceContainerStoryboardResourceType to StoryboardReferenceStoryboardResourceWithInitialControllerType to InitialControllerContainerTypedStoryboardSegueInfo to TypedSegueStoryboardSegueIdentifier to SegueIdentifierWhen using a Swift Package Manager Plugin on a Continuous Integration (CI) server, you may see the following error:
The following build commands failed: Validate plug-in “RswiftGeneratePublicResources” in package “r.swift”
To allow the running of plugins, pass -skipPackagePluginValidation to xcbuildtool. See also this discussion on the Swift forums: https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305
For users of Fastlane, pass the extra argument like so:
build_app(
...
xcargs: "-skipPackagePluginValidation"
...
)
$TEMP_DIR/rswift-lastrun from the "Input Files" of the Build Phase$SRCROOT/[YOUR_PATH]/R.generated.swift in the "Output Files" of the Build Phase unchangedIf you are using the "New Build System":
"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/[YOUR_PATH]/R.generated.swift"$TEMP_DIR/rswift-lastrun to the "Input Files" of the Build Phase$SRCROOT/[YOUR_PATH]/R.generated.swift to the "Output Files" of the Build PhaseIf you are using the "Legacy Build System":
--disable-input-output-files-validation and do not add input/output files to the Build Phase.generate command, check the error R.swift outputs for upgrade instructionsR.color.* to R.clr.*R.image.settingsIcon changed to R.image.settingsIcon()R.file.someJson changed to R.file.someJson()R.storyboard.main.initialViewController changed to R.storyboard.main.initialViewController()R.storyboard.main.someViewController changed to R.storyboard.main.someViewController().initialize() to get the instance, a shorter function is available now:R.storyboard.main.initialize() changed to R.storyboard.main()R.nib.someView.initiate() changed to R.nib.someView()R.nib.someView.firstView(nil, options: nil) to R.nib.someView.firstView(owner: nil)segue.typedInfoWithIdentifier(R.segue.someViewController.someSegue) to R.segue.someViewController.someSegue(segue: segue)R.validate() now throws errors it encountersR.assertValid() asserts on errors and only performs action in a debug/non-optimized buildR.assertValid() is recommended