Just a bit of self-documentation here as the answer wasn’t obvious from a Google search. However, a look at the man page for UFW reveals the syntax for allowing access to a UFW service (e.g. ssh, samba) from a subnet.
sudo ufw allow from <IPv4 or IPv6 subnet>/48 to any app samba