Finding the most common section from the visible cells in a collection view
Re 1: You can take advantage of reduce(into:_:) which was introduced in Swift 4 precisely for this purpose:

This method is preferred over reduce(_:_:) for efficiency when the result is a copy-on-write type, for example an Array or a Dictionary.

See also SE-0171 Reduce with inout:

Motivation
The current version of reduce needs to make copies of the result type for each element in the sequence. The proposed version can eliminate the need to make copies (when the inout is optimized away).

In your case:
 let counted = visible.reduce(into: [Int: Int]()) { (result, path) in
    result[path.section, default: 0] += 1
}

The compiler can also infer the type of the initial accumulator automatically if the closure consists only of a single statement:
let counted = visible.reduce(into: [:]) { (result, path) in
    result[path.section, default: 0] += 1
}

Re 2: A dictionary is a collection of key/value pairs, therefore it can be sorted directly, without mapping each key to a tuple first:
let section = counted.sorted(by: { $0.value &gt; $1.value }).first?.key

Even better, use max(by:) to find the dictionary entry with the maximal value:
let section = counted.max(by: { $0.value &lt; $1.value })?.key

This is shorter and eliminates the intermediate arrays and the dictionary lookup. It is more efficient than sorting an array because only a single traversal of the collection is done. And even if the forced unwrapping is safe in your case, it is nice not to have it.

One could also make this a generic method for sequences
extension Sequence {
    func mostFrequent&lt;T: Hashable&gt;(by map: (Element) -&gt; T) -&gt; T? {
        let counted = reduce(into: [:]) { (result, elem) in
            result[map(elem), default: 0] += 1
        }
        return counted.max(by: { $0.value &lt; $1.value })?.key
    }
}

which is then used as
let section = collectionView.indexPathsForVisibleItems.mostFrequent(by: { $0.section })