You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Class name ImageResource collides with Xcode generated ImageResource #813
In a KMP project, moko's ImageResource class name collides silently with Xcode generated ImageResource struct (from GeneratedAssetSymbols.swift).
The issue arises when trying to use an asset from the asset catalog in a SwiftUI component.
For example, let's say you have an asset named "record".
Xcode will generate this:
@available(iOS11.0,macOS10.7,tvOS11.0,*)extensionImageResource{/// The "record" asset catalog image resource.staticletrecord=ImageResource(name:"record",bundle:resourceBundle)}
But trying to access it in a SwiftUI component that accepts an "ImageResource", like Toggle(LocalizedStringKey, image: ImageResource, isOn: Binding<Bool>)
will first raise this error for the placeholders: Cannot convert value of type 'shared.ImageResource' to expected argument type 'DeveloperToolsSupport.ImageResource'
Then, trying to put the generated ImageResource as such: Toggle("some value", image: .record, isOn: .constant(true))
will fail with the error Type 'ImageResource' has no member 'record'.
Activity