Just checking what's possible what's not, and found:
enum Alfa {
case parent
case child
}
enum Beta {
case one(Alfa)
case two(Alfa)
}
var parametersA:[Beta] = [.one(.parent), .two(.child)]
not possible with Embedded Swift. I'm curious why?
Even this doesn't work:
enum Alfa {
case parent
case child
}
enum Beta: Hashable {
case one
case two
}
var parameters: [Beta:Alfa] = [.one:.parent, .two:.child]
In Xcode Playground with changed Toolchain I got an error (in both cases):
error: Couldn't look up symbols:
_playground_logger_initialize
Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler.
The error message makes me think playgrounds are not supported with embedded Swift. I say this because the missing function _playground_logger_initialize sounds like an internal function needed to run something in the playground, not something related to the code above.
I suppose someone more familiar with embedded Swift would know.
I don't really know for sure, but some time ago I discovered if code in Playground with Toolchain set for Development Snapshot and changed target doesn't show errors I can compile it for Embedded Swift in via Terminal. Maybe coincidence.
Unforunately, I think that Xcode Playgrounds is not going to work with Embedded Swift. The code snippets you posted above are both completely fine in Embedded Swift (it supports enums, arrays and dictionaries), and it'll compile okay in the terminal, or through a SwiftPM package. It's the Xcode Playgrounds integration that's not compatible with Embedded Swift.
If you want to keep developing using Xcode Playgrounds, I'd recommend using regular Swift in the playground, and then building the actual firmware binaries separately from the terminal (using Embedded Swift mode).
No, I'm NOT using Playgrounds to compile embedded swift. :)) I just observed I can set proper Toolchain in Xcode, paste problematic embedded code into Playground and find errors faster. I had some problems around enums, will look deeper what was wrong.