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

#Preview macros not compiler. #6222

Open
MRSorokinMaxim opened this issue Apr 22, 2024 · 2 comments
Open

#Preview macros not compiler. #6222

MRSorokinMaxim opened this issue Apr 22, 2024 · 2 comments
Labels
type:need/problem Report needs or problems you came across that are not bugs

Comments

@MRSorokinMaxim
Copy link

What problem or need do you have?

When I connect my module as a Product.framework I have no problems with the #Preview macro, but when I use Product.staticFramework at the compilation stage I get an error external macro implementation type 'PreviewsMacros.SwiftUIView' could not be found for macro 'Preview(_:body:)' why does this happen?

public static func module(
    _ name: String,
    folder: String = "newModules/",
    type: Product = .moduleDefault,
    deploymentTarget: ProjectDescription.DeploymentTargets = .default,
    noSource: Bool = false,
    @DependeciesBuilder dependecies: () -> [ProjectDescription.TargetDependency] = { [] }
  ) -> Target {
    Target.target(
      name: name,
      destinations: .iPhone,
      product: type,
      bundleId: "com.fbs.\(name)",
      deploymentTargets: deploymentTarget,
      infoPlist: nil,
      sources: noSource ? nil : "\(folder)\(name)/Sources/**",
      resources: ["\(folder)\(name)/**/Resources/**"],
      headers: .headers(public: ["\(folder)\(name)/*.h"]),
      dependencies: dependecies(),
      settings: .settings(base: [
        "INFOPLIST_KEY_CFBundleDisplayName" : name.value,
        "PRODUCT_NAME" : name.value,
        "GENERATE_INFOPLIST_FILE" : "YES",
      ])
    )
  }
  
public extension ProjectDescription.DeploymentTargets {
  static let `default`: Self = .iOS("15.0")
}

public extension Destinations {
  static let iPhone: Self = [.iPhone]
}

extension Product {
  public static var moduleDefault: Product {
    isCI ? .staticFramework: .framework
  }
}

Potential solution

No response

macOS version

14.2.1

Tuist version

4.9.0

Xcode version

15.3

@MRSorokinMaxim MRSorokinMaxim added the type:need/problem Report needs or problems you came across that are not bugs label Apr 22, 2024
@MRSorokinMaxim
Copy link
Author

Package.swift

// swift-tools-version: 5.9
import PackageDescription

let package = Package(
  name: "PackageName",
  platforms: [.iOS(.v15)],
  dependencies: [
    .....
  ]
)

#if TUIST
  import ProjectDescription
  import ProjectDescriptionHelpers

  let packageSettings = PackageSettings(
    baseSettings: .settings(base: [
      "IPHONEOS_DEPLOYMENT_TARGET" : "15.0",
      "EXPANDED_CODE_SIGN_IDENTITY" : "",
      "CODE_SIGNING_REQUIRED" : "NO",
      "CODE_SIGNING_ALLOWED" : "NO",
      "SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD" : "NO"
    ]),
    targetSettings: ["Sentry": ["USE_HEADERMAP": "YES"]]
  )
#endif

@pepicrft
Copy link
Contributor

@MRSorokinMaxim would you mind including a small project where we can reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:need/problem Report needs or problems you came across that are not bugs
Projects
None yet
Development

No branches or pull requests

2 participants