向数组添加承诺并防止它们自动解析

Adding promises to an array and preventing them from getting resolved automatically

我希望向数组中添加任意数量的承诺,并让它们在某个时刻一个接一个地依次解析。快速伪 swift 代码将是(不沉迷于如何按顺序调用承诺):

var someArray: [Promise<Bool>] = [first, second, third, fourth, ...]
...
someArray.append(contentsOf: getMorePromises())

...

firstly {
   ...
}.then { 
  // use someArray here and compose a single Promise 
  // that links to the next element in the array using .then
}

我遇到的问题是 someArray 中的所有承诺甚至在我到达 firstly 之前就开始自动(可以理解)解决。我怎样才能防止这种情况发生,以便我在数组中保留承诺,并且只有在 then 部分之一内时才让它们解析?

我明白了。在将这些承诺添加到数组之前将其包装在闭包中,然后在将它们从数组中拉出以触发它们时解开闭包。