Noob needs help transferring an array from iPhone to an Apple Watch

Viewed 24

I am a SUPER noob, so forgive me in advance.

I full understand how to get watchcommectivity to work, sending messages back and forth. I have it working on a single data point with ease. If I need the results of a variable, send it over and use it on the watch. Bam. Easy.

I’m now trying to send an array that is stored in CoreData over.

Specifically the app is a random generator. It generates a random string from the CoreData entity using .randomElement.

So my goal is to send that array from CoreData to the Watch, then do the same randomElement modifier on it on the watch, just like I did on the phone.

The problem is I don’t know how to get the array from the phone to the Watch. It seems to give an error every time. From my research, if I am understanding, you can’t send an array through WatchConnectivity.

I found some talks about encoding it, sending, and decoding it, but that just goes so far over my head, I can’t figure it out to save my life.

What is the best course of action to take to get that array over to the Watch? Any and all information helps immensely! Thank you!

0 Answers
Related