Works with DirectInputServer https://github.com/freecodecampster/DirectInputServer or Vicreo Listener https://jeffreydavidsz.github.io/VICREO-Listener/
You can either use this Swift Playgroundbook which has live view edge to edge enabled or create a blank Swift Playground and copy in the Swift code from Template.swift or any of the Swift files in the example folder.