Skip to content

Generate png with #Preview #246

@sereytraing

Description

@sereytraing

Hello everyone,

I’m using version 0.10.24.
I have a question about the String I need to put inside #Preview().
It seems like I absolutely need to have a space in that string for the .png to be generated.
If I use "MyView", "My-View", or "My_View", it doesn’t work. But if I use "My View", the .png is correctly generated.
Is it normal that I need to include a space in the string for it to work ?

// Doesn't work
#Preview("MyView") {
    MyView()
}

// Doesn't work
#Preview("My-View") {
    MyView()
}

// Doesn't work
#Preview("My_View") {
    MyView()
}

// work
#Preview("My View") {
    MyView()
}

Here are the files I end up with.
ViewPresentationMyView_0_2A5AE00C-CBF3-423F-A0D2-1B8EDA562CA3.swift/164_My-View
ViewPresentationMyView_0_45651A9C-E647-44CC-AD4A-D65B44F62665.swift/159_MyView
ViewPresentationMyView_0_C0444324-CC1F-44AA-964D-29678FA69750.swift/169_My_View
ViewPresentationMyView.swift174_My View_0_7D55E1B3-E153-4E22-9D0A-0B81DAF7D83F.png

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions