Quantcast
Channel: Questions in topic: "xcode"
Viewing all articles
Browse latest Browse all 1047

How to send a whole custom List-Object from unity to Swift/XCode via native plugin?

$
0
0
So recently I wanted to create PDFs on iOS Devices with Apps written in Unity. Long story short I used [this Tutorial][1] on how to use Apple's PDFKit to create PDFs in Swift. Next I learnt about native plugins and how to bridge between Unity and Swift with this [Tutorial][2]. And at a final step I combined the two projects with sending a few different strings from Unity UITextField to Swift and trigger the "CreatePDF" -function. I was happy as hell because of my little working prototype showing that it can be done haha :D But now I want to send a lot of data to Swift. Like a list of custom Data with strings, ints, floats, images and what not. Let me give you an example. Lets say I have a CarInventory-List and want to send that to Swift to create a PDF of the Inventory. Each car has an id, a price, a model name and a picture. See below. Any ideas how I put that into a format so that I can extract it in Swift after sending it? public class Car { public int id; public float price; public string model; public Image picture; public Car(int newId, float newPrice, string newModel, Image newPicture) { id = newId; price = newPrice; model = newModel; picture = newPicture; } } public List CarInventory = new List(); [1]: https://www.raywenderlich.com/4023941-creating-a-pdf-in-swift-with-pdfkit [2]: https://medium.com/@kevinhuyskens/implementing-swift-in-unity-53e0b668f895

Viewing all articles
Browse latest Browse all 1047

Trending Articles