Salutations,
Allow me to preface this that my search queries may have probably been incorrectly worded as I am certain others have tried to do, yet, I am not able to find it. I have looked into different ways, but none really worked.
So my current code is as follows:
while true {
currentPicture += 1; //Yes I know that ; is not needed, i come from Java so I find it comforting.
showPico(); //function which shows an image from my array of images, this function handles out of bounds by reseting currentPic to 0 or 4.
sleep(2);
}
Now my problem is that once I hit my auto button which is where my code above is located, my app of course freezes. This is normal as it is my understanding that sleep() calls upon the main thread and simply suspends everything until it is done sleeping. However, I do not see it update the picture at all. Therefore, what is the best way to go about create a sort of slide show.
The array of pictures is defined as follows, for those wondering:
var pictureArray = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg"]; //I know, highly original names.
Side note: My knowledge of swift/iOS is now a grand total of 4 days.