Dyer had been without a club since the end of the 2019/2020 season when he played for the Swans.
He spent 11 years with the Welsh side and earned cult hero status at the club after scoring twice in the 2013 League Cup final when Swansea thrashed Bradford City 5-0 at Wembley.
Dyer also spent the 2015/2016 season on loan at Leicester City and made 12 Premier League appearances that season as the Foxes won the title under Claudio Ranieri.
"I just felt now was the right time to announce my retirement from football," Dyer told Sky Sports News.
"It's been a hard decision but I think with COVID hitting and a lot of other things going on in the world today, I just thought it was the right time.
"It's been about a year that I've thought about this decision, and it's not come lightly. I've been in football since the age of 17, so it was a hard decision but one that I made with my family and with a clear head."
"I'm so happy to look back and reflect on the career that I've had. I've come across managers, players and the success that I've had.
"I'm happy to look back and say that I have no regrets."