I didn't need to pay for a visa since I am a Swedish citizen, but this might change due to Brexit. The cost of living in Edinburgh is generally a bit less expensive than Stockholm. I received the Erasmus grant from KI which covered some of my costs during the beginning of my stay (excluding rent).
Phone
I had a giffgaff sim card that I ordered from their website. It was the cheapest option. https://www.giffgaff.com/ You can easily find free wifi around the central city. My accommodation and the university also provided free wifi.
Food
Many restaurants offer student discounts in central Edinburgh, but cooking at home is more convenient and saves some money. Lidl, Sainsbury, Tesco, and other local stores were near my place, and I would say that Lidl is the cheapest amongst all of them. There were also several halal local stores and restaurants that cooked halal food. I believe I spent around £250 per month on food.
Gym
I recommend buying the gym membership at Pleasance because of the facilities they provide. They had good offers for certain hours of the day. I decided not to pay the membership since there was a gym in my student accommodation. https://www.ed.ac.uk/sport-exercise/sports-centre
Transportation
The campus was approximately 10 mins away from my accommodation; thus I didn't use the buses frequently. I was lucky to live in central Edinburgh since many buses operated near my accommodation. I used the m-tickets app to buy all sorts of transportation tickets. https://edinburghtrams.com/tickets/mobile-ticketing
National Rail Enquiries app is also very convenient when you want to travel to another city by train like Glasgow which costs around £13 for students.