Performing a sum with Swift
Both solutions are correct. Some advantages of the "functional" approach
with reduce():


Concise code.
Returns a constant. It is clear to the reader that
total is assigned to exactly once, and the compiler may use this
information for optimizing code.
The type annotation on the result value is not needed:

let total = session.courses.reduce(0) { $0 + $1.totalPrice() }


because that can be inferred from the compiler automatically.
This will continue to compile without changes if the type of
totalPrice() is changed, e.g. from Double to Float.


To increase legibility, you can use named closure parameters instead
of the $n shortcuts:

let total = session.courses.reduce(0) { (partialSum, dish) in
    partialSum + dish.totalPrice()
}