Emmanuel Macron has been sworn in as France's new president and immediately pledged to do everything necessary to fight terrorism.