4 years later, I found this and wanted to note it helped me. (Having a file open with "import SwiftUI.")
That said, it's the most unintuitive/asinine thing I've seen in a while. If I have a pinned preview, I can still see the canvas no matter what file is open. Then if I close the canvas, I can't open it again! But if I go to a file with "import SwiftUI," I can. And the pin is still there.
Apple should fix it so it's not gated at all. Or when I turn the Canvas on in an "invalid" file, say so