Pupils, staff, three former headteachers and the Deputy First Minister this week celebrated the official opening of the Waid Community Campus.
The building has been fully open since August, benefiting both students and local people.
As well as hosting the academy, the campus also has a library, sports and leisure facilities and a cafe.
Opening the building, Mr Swinney said: “Waid Academy has been at the heart of the East Neuk throughout its 150-year history and this new building has extended that role in new and exciting ways, hosting a wide range of community facilities all under one roof.”
Rector Iain Hughes added: “I’ve always been immensely proud of our young people who are a credit to their families and communities, and I’m so pleased that they have been given such an outstanding building to learn in.
“They are taking full advantage of the learning spaces, which are supporting the innovative teaching and learning provided by our staff.”
Fife Council and the Scottish Government invested £24.3 million in the new campus, with development done by East Central Scotland.