I’m looking for the best and efficient way to pass a Nested Array [[String]], from my app to the same app on another iPhone.
If let say for example, I have this Array saved on my app:
let array = [[“John”, “27”, “First”, “Castle”],[“Tom”, “25”, “Second”, “Boat”]]
I want to add a Share Button on my App that will allow this array to be shared via Bluetooth/Airdrop/Any Convenient Way between 2 iPhones.
Ideally click share, via airdrop, other user click accepts and clicks open with the app. And data is loaded. What is the best approach In order to achieve this. I looked at Share Extension and UIActivityViewController but can’t see what are the differences about them and what is best for my case to simply send data and receive data from and to my app.
Based on what you have said,
You could just use the UIActivityViewController to export your data to AirDrop (or etc) and using the exported UTI, your app could open it once it detected.
for Sharing, you will have to use a custom data format (or file) and you can refer to this post, Sending custom data via UIActivityViewController
and for reading your custom file, here is a good tutorial of how to implement the Exported UTI https://www.raywenderlich.com/8413525-universal-type-identifiers-tutorial-for-ios-importing-and-exporting-app-data
Cheers, Kel