Hello! Thank you for your question and I'm glad you found a solution. A legend or "layers list" is something that we will be implementing in the Swift Toolkit at some point, but there's no firm release date yet.
In the meantime, you solution looks good! You can also take a look at the v100.15 Toolkit's LegendViewController, and the actual code.
There are a few things in that code that may be of interest, depending on your requirements:
- Including base maps in the layers list
- Ensuring the Map and Layers are loaded prior to displaying the list
- Displaying symbol swatches for layers
- Hiding/showing scale-dependent layers depending on map scale (applicable primarily for Legends).
Nice work! If you have any more questions, please reach out!
Mark