The chemical equations:
(a) Swarts reaction:
Alkyl chlorides (or bromides) are heated in presence of metallic fluorides such as AgF,CoF2,SbF3,Hg2F2.
CH3−Cl+AgF→CH3−F+AgCl
(b) Sandmeyers reaction:
The nitrogen of benzene diazonium chloride is replaced with −Cl, −Br or −CN groups using copper(I) salts.
Ph−N+2X− CuX / HX−−−−−−→Ph−X+N2↑
X=Cl,Br or CN