-1

I would like to upload multiple files at once to cloud storage. I have an open panel already. I use that to select the files and with the selected files I have an upload file. I thought a ForEach() would work but it either doesn't work or I'm doing something wrong. I also tried Completion Handlers and closures but I don't understand those yet. Please, any help would be greatly appreciated.

mathew
  • 29
  • 5
  • 1
    Please have a look at Help Center's [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) – mag_zbc Mar 06 '20 at 14:08
  • and see... [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – Jay Mar 08 '20 at 14:01

1 Answers1

0

Figured it out!

Had to make an escaping closure to loop the amount of files you're trying to upload. ex:

//define
func Upload(closure:(int)->Bool,numbers:[int]){
for num in numbers{
 if closure(num){
   //urls[index/num/whatever you call it]
  //upload info with the index (it'll loop that many times)
}
}
}

using: self.UploadTest(file: { (num) -> Bool in return num <= urlArray.count}, urls: [0,1])

mathew
  • 29
  • 5