A Swedish activist who was detained in China on charges of damaging national security has been released and deported.