This macOS Swift playground is designed to explain some of the processes around Elliptic Curve Integrated Encryption Scheme (ECIES) encryption on Apple platforms and potential cross-platform portability of both keys and ciphertext.
It contains examples for both encrypting and decrypting using ECIES in Apple's security framework as well as a whole bunch of commentary and explanation around key formats, PEM serialisation and other concepts.
Hopefully it is helpful to anyone wanting to implement or learn more about how this encryption scheme works.
I've also written a little more about this topic here - Cross Platform ECIES encryption with Swift & Apple's Secure Enclave.
It can be used alongside this ECIES Go Example code to learn how to encrypt and decrypt data in a cross-platform implementation compatible with Apple platforms.
Feel free to reach out or create an issue on GitHub.
This code is CC0 licenced and is dedicated to the public domain.