Swift doesn’t mention the stack or the heap which is fine coming from Python and JS and inconceivable coming from C/C++.

The Swift compiler will try and store structs, classes and actors on the stack as an optimization unless based on the usage of the object the compiler can determine function in which it was created.

Additional non semantic rules like size can promote an object to the heap. 

Some examples would be singletons, and classes or closures that get referenced and passed around your code base.