Cookademy 9 - Favorite Recipes

Hello coders!

I find a problem when trying to favourite a recipe by default as shown in the last section of Cookademy 9 - Favorite Recipes. In RecipesListView.swift, when you try to compare the viewStyle case to .favorites, the compiler throws the following compiling error:

I am really stuck with this code and tried to find solutions on Stackoverflow and the Apple forums about how to compare this enum case, but sadly I can’t find any solution for the compiler to accept it.

Any suggestion? How did you folks do it?

Thanks in advance!

Eventually I found a solution for this issue. Moving the logic to inside the Button code instructions will remove the compiling errors:

image