The 23-year-old former Hearts player joins Robbie Neilson's side ahead of this evening's Betfred Cup opener at Tynecastle.
King had loan spells with Crewe, Southend, Mansfield and Peterborough during his time at Swansea but now returns to the SPFL after five years away.