Skip to content

Generates invalid code when you have 0 resources #827

@SpacyRicochet

Description

@SpacyRicochet

It looks like r.swift generates invalid code if you have 0 resources for it to parse. That will currently result in the following R.swift.generated file;

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

import Foundation
import RswiftResources

public let R = _R(bundle: Bundle.module)

public struct _R {
  public let bundle: Foundation.Bundle
  public init(bundle: Foundation.Bundle) {
    self.bundle = bundle
  }
  public func validate() throws {

  }
}

which causes the following build error;

Type 'Bundle' has no member 'module'

Adding a single Localizable.strings resource (for example) immediately solves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions