Short answer:
Your Package needs to be part of a Project (or Workspace) for a Playground inside of your Package to be able to find any public structs/classes that your Package provides.
Longer answer:
The Fruta demo that's mentioned in WWDC 10096 has the NutritionFacts Package added to the Fruta Project already. This means that the person who set up the Fruta Project dragged and dropped the NutritionFacts Package into the Fruta Project, causing Xcode to automagically set up a Target for the Package, and the dev then added the Package to all of the existing Targets in the Project (added NutritionFacts Package to "General -> Frameworks and Libraries [and Embedded Content]" for each existing Target).
You can test this yourself by creating a test Package on the command line/in Xcode, then dragging/dropping it from Finder into a test Project; Xcode will quietly and in the background create a new build target for the Package that you just imported, but you'll still need to add the Package by hand to the main Target in your test Project.
To run the NutritionFacts Playground that has been added to the Fruta Project, you will need to build the NutritionFacts Target (select NutritionFacts Target, then hit "Product -> Build" or "⌘-B") before you try to run the NutritionFacts Playground, or you will see errors about "cannot find NutritionFact in scope" when you first try to run the Playground.
A few extra things:
You may already have done this, but for people new to Swift/Packages/Playgrounds, the structs/classes in your Package that you want to use in a Project or Playground need to be marked public. This includes having a default public init() initializer for structs in your Package, because Xcode doesn't create these by default.
The Fruta project currently (July 2021) on Apple's website is for Xcode 13. You'll have to use some kind of mirror (perhaps "web dot archive dot org") to download older copies of the Fruta Project if you're still running Xcode 12. Going back to say November 2020 or so should get you the version of the Fruta Project for Xcode 12.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: