To find the area of a rhombus in Swift, we need to know the length of the two diagonals. We can then use the following formula:
main.swift35 chars2 linesHere's how you can implement this formula in Swift:
main.swift302 chars11 linesNote that in this example, we're returning the area as a Double. Depending on your requirements, you may want to use a different data type.
gistlibby LogSnag