Swanson becomes the Sky Blues' first signing of the summer.
"Danny is an exciting, technically gifted footballer who provides a real threat out wide and I'm delighted to get him in," said Coventry boss Steven Pressley.
"We were not the only club looking to sign him so to get a deal done that brings him here is great news.
"He's got great footballing intelligence, he has a great attitude and he's hungry for success which makes him a perfect fit for us."
Swanson started his professional career in Scotland with Berwick Rangers, making 44 appearances and scoring four goals before sealing a move to top-flight club Dundee United in 2008.
The attack-minded playmaker made 107 appearances and scored 12 goals for the Tangerines before being snapped up by Peterborough United in 2012.
The 27-year-old played 79 times, scoring five goals, for Posh during a two-year spell at London Road.