A Module
I have a module (A) that has two structs.
- One with a color initiated directly in code.
- One with a color loaded from the assets.
public struct CodeColor {
public init() { }
public let value = SwiftUI.Color(#colorLiteral(red: 0.8549019694, green: 0.250980407, blue: 0.4784313738, alpha: 1))
}
public struct AssetColor {
public init() { }
public let value = SwiftUI.Color("Legacy/Material/Gold", bundle: .module)
}
The preview is working like a charm:

B Module
The second module (B) should use the previous one (A) as a dependency to load colors from:
import A
public struct CodeColor {
public init() { }
public var value: SwiftUI.Color { A.CodeColor().value }
}
public struct AssetColor {
public init() { }
public var value: SwiftUI.Color { A.AssetColor().value }
}
But as soon as it touches the assets from module (A), the preview crashes:
The error:
Can not preview in this file. Failed to update preview.
RemoteHumanReadableError: Failed to update preview.
The preview process appears to have crashed.
Error encountered when sending 'previewInstances' message to agent.
==================================
| RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.)
|
| BSServiceConnectionErrorDomain (3):
| ==BSErrorCodeDescription: OperationFailed
So why is that?
Note: The stranger thing is that the exact B preview code is working if it is in an actual app (not another package)
