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

Fix for stand alone images not being listed as file resources. #497

Merged
merged 1 commit into from Mar 20, 2019

Conversation

Projects
None yet
2 participants
@CraigsOverItAll
Copy link
Contributor

commented Mar 18, 2019

Undocumented breaking change

Under the 4.x line R.generated.swift would contain both an entry in both image and file for stand alone image files. This was very useful as many of Apple's API's require an image URL or path rather than just a UIImage object.

e.g.

/// This `R.file` struct is generated, and contains static references to 18 files.
  struct file {
    /// Resource file `notification-alert1.png`.
    static let notificationAlert1Png = Rswift.FileResource(bundle: R.hostingBundle, name: "notification-alert1", pathExtension: "png")
    /// Resource file `notification-alert2.png`.
    static let notificationAlert2Png = Rswift.FileResource(bundle: R.hostingBundle, name: "notification-alert2", pathExtension: "png")

    and so on

So usage in places like this are common place:

UNNotificationAttachment.init(identifier: "",
                              url: R.file.notificationAlert1()!,
                              options: nil)

The change appeared in #451 with the commit 4fc7d55 - which was an optimisation to only iterate resource files once. The side effect was that images not in an asset catalogue only get added to R.image.

This PR contains a temporary fix we used to get the previous behaviour back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.