I have a class that I've defined like this (as an example):
#include <swift/bridging>
#include <vector>
class MyClass {
public:
MyClass () {}
MyClass (const MyClass &) = delete; // non-copyable
static MyClass *create() { return new MyClass(); }
void addData(std::string str) { m_data.push_back(str); }
private:
std::vector<std::string> m_data;
} SWIFT_UNSAFE_REFERENCE;
From the Swift side, I can create it and use it like this:
let myClass = MyClass.create()!
myClass.addData(std.string("My String"))
However, how do I then delete the myClass instance after I'm done using it? Is that possible with SWIFT_UNSAFE_REFERENCE
?