Xcode does not like this either, complaining that "Function declares an opaque return type 'some View', but the return statements in its body do not have matching underlying types"

Next attempt:

let functions = [make2Rows, make3Rows, ...]
for (idx, function) in functions.enumerated()
{
let (view, nbr) = function(start: idx + 2)
}

Again a failure:

Xcode:
"Cannot convert value of type 'Any' to specified type '(_, _)'"
"Extraneous argument labels 'start:' in call"

That one relates on how you use ForEach inside the function, not to the function signature itself. As @ibex10 pointed out, SwiftUI related questions are better to discuss on Apple forums. Or in this case you can reach for the documentation on the ForEach to see how it is intended to be used by design.

That one seems like a new thing to you, so I suggest get familiar with opaque types in Swift: Documentation.

but Xcode tells me: "Non-constant range: argument must be an integer literal"
That one relates on how you use ForEach inside the function, not to the function signature itself. As @ibex10 pointed out, SwiftUI related questions are better to discuss on Apple forums. Or in this case you can reach for the documentation on the ForEach to see how it is intended to be used by design.

I did study the documentation on ForEach, but did not find the very clever trick of @ibex10. This either means that the documentation could be improved or that I am especially stupid.

That one seems like a new thing to you, so I suggest get familiar with opaque types in Swift: Documentation.

I am right now doing this.

Just out of curiosity:

How does one declare and use an array of functions?
On the internet I did find only examples of functions without argument-labels returning Any or Void.

Use ForEach to provide views based on a RandomAccessCollection of some data type. Either the collectionâ€™s elements must conform to Identifiable or you need to provide an id parameter to the ForEach initializer.

Of course documentation won't give immediate solutions, it is about understanding how to use it in general. See that you need either have Identifiable or id provided, @ibex10 did use the first one. You could've used id parameter, if you didn't want. That's the power docs give you.

Note that this does not imply your fault, nor documentation one (at least in this case, yet it can be confusing sometimes), but that just some practice will help you get more from the docs in the first take. Believe me, I have struggled reading documentation a lot (and still do sometimes).

In function type Swift doesn't allow labels (don't remember why btw, but probably not to be too restrictive what function you can pass as arg labels part of the signature), so you have to use underscore as primary label, but still provide secondary (you can omit labels at all, I just don't particularly like that variant):

// Using array of functions...
@main
enum Temp {
static func main () {
func bar (u: Int) -> String {
"\(#function): \(u)"
}
struct S {
let dc: Int
static func foo (u: Int) -> String {
"\(type (of: Self.self)) \(#function): \(u))"
}
func add (u: Int, v: Int) -> Int {
u + v + dc
}
}
do {
// Case 1 - Using global and S.Type functions
typealias Proc = (Int) -> String
let procs: [Proc] = [bar, S.foo(u:)]
for proc in procs {
let v = proc (1024)
print (v, proc)
}
}
print ()
do {
// Case 2 - Using instance functions of S
typealias Proc = (S) -> ((Int, Int) -> Int)
let s1 = S (dc: 5)
let s2 = S (dc: -5)
let procs: [(S, Proc)] = [(s1, S.add), (s2, S.add)]
for proc in procs {
let u = 3
let v = 5
let r = proc.1 (proc.0) (u, v)
// := let r = (proc.1 (proc.0)) (u, v)
print (r, proc.1, proc.1 (proc.0))
}
}
print ()
do {
// Case 3 - Using partially applied instance functions of S
typealias Proc = (Int, Int) -> Int
let s1 = S (dc: 5)
let s2 = S (dc: -5)
let procs: [Proc] = [s1.add, s2.add]
for proc in procs {
let u = 3
let v = 5
let r = proc (u, v)
print (r, proc)
}
}
print ()
do {
// Case 4 - Mix case 1 and case 3
func add (u: Int, v: Int) -> Int {
u + v
}
typealias Proc = (Int, Int) -> Int
let s1 = S (dc: 5)
let s2 = S (dc: -5)
let procs: [Proc] = [s1.add, s2.add, add]
for proc in procs {
let u = 3
let v = 5
let r = proc (u, v)
print (r, proc)
}
}
}
}