King Charles was joined by John Swinney and Deputy First Minister Kate Forbes at the event in Edinburgh.