I like the question.
The recommended way by Docker is to use
docker-compose up ... (i.e. not Swarm-based) for local development, and then
docker stack deploy ... (Swarm-based) for deployments in the CI \ CD pipeline.
I don’t like it and I have never followed it, as it breaks one of the core best practices of Continuous Delivery - use all environments in the same way, including Dev environment.
The differences between Dev and CI \ CD environments always cause the class of problems usually called “but it works on my machine”. People waste time on fixing those problems.
For instance docker compose format version 2 (compose) is very different from version 3 (Swarm).
I always developed with the Swarm mode straight-away.