You are dividing two integers. When the computer divides two integers, it removes the remainder. That is why you get 12.0 when you divide 25 by 2 instead of 12.5.
Convert the integers to Double before doing the division to get the correct value when dividing. See the following Stack Overflow question to learn how to convert an integer to a Double:
https://stackoverflow.com/questions/27467888/convert-int-to-double-in-swift
I don't see any code in your calculate function where you do any calculations so I can't tell you where to put the code to convert to Double. Where do you perform the division?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: