Hi,
it depends on what you mean by "switch". I'll assume you're talking about IEEE 802.3, a.k.a. Ethernet.
Now, in ns-3 the coma module implements a very basic 802.3, as is the bus topology one. It's half duplex and a lot of devices can be connected to it.
It's functionally similar to a star topology with an hub.
In order to have a switch (which is far more complex), one should have:
1) a modified CSMA module (either half duplex or full duplex), and
2) a switch module, able to:
a) port / MAC address learning
b) internal frame buffering
c) memory management
Point 1 is easy to do. Point 2 is a bit more difficult.
As a consequence, I'd say that you can't have a switch in ns-3 out-of-the-box. However you can implement this functionality. With a bit o knowledge of course.
Cheers,
T.