This paper presents a technique to design electromagnetic devices by a combination of evolutionary algorithm and electromagnetic (EM) simulation. This technique, named simulation-driven particle swarm optimization (SDPSO), exploits particle swarm optimization (PSO) to design a microwave component matched to user's requirements. To justify the need for such SDPSO, a performance comparison is made between the presented method and built-in PSO in CST Microwave Studio by designing three spatial phase shifters (45°, 90° and 135°) at 9 GHz. Optimization results show that the SDPSO outperforms the available built-in PSO.