Required environment variables
How you set this may vary depending on your distribution, in NixOS I did set these in a global way. But this, surprisingly to me wasn't enough to make them apply all the way through to systemd user services.
So I had to add the following to command to run before I log into sway:
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
It may be fine to start it after sway is launched as well, it probably just has to be executed before you attempt to do any screen sharing.
Don't worry if they don't run at this point. They should be started by socket activation when you start sharing your screen.
Update: A recent update to sway 1.6 in nixpkgs broke screen sharing
Reported issue here https://github.com/NixOS/nixpkgs/issues/119445.
Currently screen sharing works if you have the following lines in your sway config to import the right things to the right places:
exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP exec dbus-update-activation-environment WAYLAND_DISPLAY