I’ve managed to make my current app read from a locally packaged JSON file and store its contents in CoreData. Additionally, I have a working Unsplash class that gets 1 random image. What I’d like to be able to do now is, during the iteration of the local JSON entries,
- call the Unsplash function,
- generate a random photo
- assign said photo to the current AphorismEntity record, along with its URL, User and Username
Unfortunately, although the project compiles without any errors, when I run the application in the simulator, all I can see is the fallback local image
wave assigned to all entries.
As far as I could see when debugging, the
photo constant on line 56 in
Here’s the packaged project (I’ve removed the Unplash API token, sorry).
Could someone please have a look and tell me what I’m doing wrong?
Alternatively, I’m open to suggestions how to accomplish the same in a better way (instead of generating a random image at each iteration). I was considering an additional function in
Unsplash to get a number of random images that equals the number of JSON objects. However, because I intend to have ~300 entries when I complete the app, I thought getting 300 images all at once might take too long… I don’t know, I’m new to app development, be merciful, please.