A Spanish swimming champion who sacrificed his medal chance to pay tribute to the victims of the Barcelona terrorist attack has been hailed as a hero.