Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R.swift Fails to Generate Resources for Folders (Xcode 16 default project structure) #913

Closed
tlacan opened this issue Sep 26, 2024 · 6 comments

Comments

@tlacan
Copy link

tlacan commented Sep 26, 2024

Environment:

•	Xcode Version: 16.0
•	macOS Version: Sequoia 15.0
•	R.swift Version: 7.6.1

Description:

We are experiencing issues with R.swift failing to generate the expected enum values for resources when creating new projects in Xcode 16.0 on macOS Sequoia 15.0. This problem affects multiple users, including myself and others who are being trained in a similar setup.

In new projects made with Xcode 16.0 where we add images, fonts, or strings, the R.generated.swift file does not include the resource-specific enum values. Instead, it remains in a basic template state as shown below:

//
// This is a generated file, do not edit!
// Generated by R.swift, see https://github.com/mac-cain13/R.swift
//

import Foundation
import RswiftResources

private class BundleFinder {}
let R = _R(bundle: Bundle(for: BundleFinder.self))

struct _R {
  let bundle: Foundation.Bundle
  func validate() throws {

  }

  struct project {
    let developmentRegion = "en"
  }
}

(Checked from derived data result)

Behavior:
• New Projects: The issue occurs when creating new projects in Xcode 16.0.
• Existing Projects: Interestingly, the issue does not occur when opening and using projects that were created in earlier versions of Xcode.R.swift works as expected and generates all resources enums without issues.

Attempted Workarounds:
• Verified that the resources (images, fonts, and strings) are properly added to the project.
• Cleaned and rebuilt the project.
• Removed the Derived Data folder, but no relevant changes are reflected in R.generated.swift.

Additional Notes:
• We are unable to test this configuration on Xcode 15.4, as it is not compatible with macOS Sequoia 15.0.

Expected Behavior:
R.swift should generate the necessary enum values for resources such as images, fonts, and strings in new projects created in Xcode 16.0, just as it does for projects created in earlier versions.

Steps to Reproduce:

1.	Create a new project in Xcode 16.0 on macOS Sequoia 15.0.
2.	Add resources (images, fonts, strings) to the project.
3.	Run the R.swift build phase.
4.	Check the R.generated.swift file in the Derived Data directory.

Request:

Is this a known issue with Xcode 16.0 or Sequoia 15.0 compatibility? Are there any suggested workarounds or updates to R.swift that might resolve this?

@tlacan
Copy link
Author

tlacan commented Sep 26, 2024

Additional Notes:
I have checked the projects build settings,
they are the same between Xcode 16 projects and Xcode 15 projects could not find an option which was causing the issue.

@tlacan
Copy link
Author

tlacan commented Sep 26, 2024

We were expecting the last release to include PR #886.

In the latest Xcode projects, .xcstrings files have become the new standard, while .strings files are now considered legacy. It would be great to have support for this updated format in R.swift.

@tomlokhorst
Copy link
Collaborator

tomlokhorst commented Sep 26, 2024 via email

@tlacan
Copy link
Author

tlacan commented Sep 26, 2024

@tomlokhorst

Thank you for the prompt reply and clarification.
I hadn’t noticed this change, but after converting the folders to groups, everything works as expected.

I’m looking forward to the future version of R.swift that supports both folders and .xcstrings files.

@tlacan tlacan changed the title R.swift Fails to Generate Enum Values for Resources in New Xcode 16.0 Projects on Sequoia 15.0 R.swift Fails to Generate Resources for Folders (Xcode 16 default project structure) Sep 26, 2024
@tomlokhorst
Copy link
Collaborator

I've created an issue explaining the situation and the workaround: #914.

Closing this one, in favour of the other one.

@julesfakhouri1
Copy link

Hello,

I have followed the previous discussion regarding the error we are encountering. However, I still have the following error: Value of type '_R' has no member 'string' on line :
I converted the folder to group

Text(R.string.localizable.textSampleSimple)

xcode_02

xcode

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants