rescomputer / res-ios

Res is real computer speech, talk with an AI that listens and can hold a conversation with you.
https://res.computer
38 stars 1 forks source link

Add previews for all the views #49

Closed mikejonas closed 3 months ago

mikejonas commented 3 months ago

Previews are useful so you can iterate on a view, without building the whole app over and over again. You can create different previews for each view, with different states.

Previews weren't working. What I found to fix it was to add ResTests and ResUITests folders and files, and then adding those to the target > (resTests / resUITests) > Build Phases > Compiled sources.

The resTests and resUITests files are the default generated files that are created with a new xcode project. Not sure if there was a reason, but ours didn't have that.

For new views, you can add a macro at the bottom like this to create a preview

#Preview {
    MainView(isAppSettingsViewShowing: .constant(false), isModalStepTwoEnabled: .constant(false))
}

If previews still aren't working, build the project, or file > packages > resolve package versions (or build packages), then build the project.

Screenshot 2024-05-08 at 2 42 03 PM Screenshot 2024-05-08 at 2 42 26 PM Screenshot 2024-05-08 at 2 42 37 PM Screenshot 2024-05-08 at 2 42 48 PM