Hello ,
I would like to test creating FreeRTOS tasks in embedded swift.
I found the wrapper below that should run in Swift. However, String is not available in embedded swift.
Any help will be welcome.
you should still be able to pass in a string literal. Also, in the above example, I moved taskCode to the end, so you should be able to use trailing closure syntax, e.g.:
There's certainly multiple options how to design your wrapper, but if you want to, you can totally use a String argument to represent the task name. Strings allow conversion into a pointer for C API calls, but you want to make sure that the API is not going to stash the received pointer beyond the duration of the API call.
Alternatively, you can also only accept StaticString, if you want users of the wrapper to only ever use compile-time constant strings as task names.