Repository: tauri
Issue: [bug] FFI Swift Memory Release Error
Labels: type: bug,status: upstream,platform: macOS

### Describe the bug

Integrating with https://github.com/Brendonovich/swift-rs, I'm able to pass bool and int values through a C bridge no issue. As soon as I try to pass an object from Swift (through a C bridge) to Tauri/Rust through a pointer, it causes a crash (stack trace below):

<img width="660" alt="Screenshot 2022-06-10 at 18 19 14" src="https://user-images.githubusercontent.com/15347255/173118506-04b184f4-c3f0-410f-9de9-f078f8d64f0a.png">
<img width="833" alt="Screenshot 2022-06-10 at 18 19 27" src="https://user-images.githubusercontent.com/15347255/173118530-30fcbb33-56b0-41cd-88cf-68b667e79dd4.png">


Example repo: https://github.com/lorenzolewis/swift-rust-test
Files of relevance: 
- Swift: https://github.com/lorenzolewis/swift-rust-test/blob/main/tauri-swift/Sources/tauri-swift/tauri_swift.swift
- Rust: https://github.com/lorenzolewis/swift-rust-test/blob/main/src-tauri/src/main.rs

Note: This same code works when I'm only using a clean Rust program without Tauri and successfully passes data with pointers with no crashes. swift-rs Also doesn't use Tauri's sidecar from my understanding.

### Reproduction

1. Create a Tauri app
2. Follow the steps at https://github.com/Brendonovich/swift-rs to setup a Swift package and link the binary to Rust
3. Run the app (in dev or release mode)
4. Click the "Test Bool" / "Test Int" buttons in the app and everything is fine
5. Click the "Test Struct" button and the application crashes

### Expected behavior

Application does not crash

### Platform and versions

```shell
Environment
  › OS: Mac OS 12.4.0 X64
  › Node.js: 18.2.0
  › npm: 8.9.0
  › pnpm: 7.1.6
  › yarn: 1.22.19
  › rustup: 1.24.3
  › rustc: 1.60.0
  › cargo: 1.60.0
  › Rust toolchain: stable-aarch64-apple-darwin 

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.13
  › @tauri-apps/api [NPM]: 1.0.0-rc.6
  › tauri [RUST]: 1.0.0-rc.14,
  › tauri-build [RUST]: 1.0.0-rc.12,
  › tao [RUST]: 0.9.1,
  › wry [RUST]: 0.17.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../build
  › devPath: http://localhost:3000/
  › framework: Svelte

App directory structure
  ├─ tauri-swift
  ├─ node_modules
  ├─ src-tauri
  ├─ .svelte-kit
  ├─ build
  ├─ .git
  ├─ .vscode
  └─ src
```


### Stack trace

```shell
Call Stack:

objc_release (@objc_release:7)
AutoreleasePoolPage::releaseUntil(objc_object**) (@AutoreleasePoolPage::releaseUntil(objc_object**):52)
objc_autoreleasePoolPop (@objc_autoreleasePoolPop:56)
WebKit::WebUserContentControllerProxy::didPostMessage(WTF::ObjectIdentifier<WebKit::WebPageProxyIdentifierType>, WebKit::FrameInfoData&&, unsigned long long, WTF::Span<unsigned char const, 18446744073709551615ul> const&, WTF::CompletionHandler<void (WTF::Span<unsigned char const, 18446744073709551615ul> const&, WTF::String const&)>&&) (@WebKit::WebUserContentControllerProxy::didPostMessage(WTF::ObjectIdentifier<WebKit::WebPageProxyIdentifierType>, WebKit::FrameInfoData&&, unsigned long long, WTF::Span<unsigned char const, 18446744073709551615ul> const&, WTF::CompletionHandler<void (WTF::Span<unsigned char const, 18446744073709551615ul> const&, WTF::String const&)>&&):186)
WebKit::WebUserContentControllerProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) (@WebKit::WebUserContentControllerProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&):531)
IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) (@IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&):115)
WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) (@WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&):13)
IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) (@IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >):70)
IPC::Connection::dispatchIncomingMessages() (@IPC::Connection::dispatchIncomingMessages():120)
WTF::RunLoop::performWork() (@WTF::RunLoop::performWork():53)
WTF::RunLoop::performWork(void*) (@WTF::RunLoop::performWork(void*):12)
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ (@__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__:10)
__CFRunLoopDoSource0 (@__CFRunLoopDoSource0:55)
__CFRunLoopDoSources0 (@__CFRunLoopDoSources0:70)
__CFRunLoopRun (@__CFRunLoopRun:210)
CFRunLoopRunSpecific (@CFRunLoopRunSpecific:153)
RunCurrentEventLoopInMode (@RunCurrentEventLoopInMode:76)
ReceiveNextEventCommon (@ReceiveNextEventCommon:144)
_BlockUntilNextEventMatchingListInModeWithFilter (@_BlockUntilNextEventMatchingListInModeWithFilter:21)
_DPSNextEvent (@_DPSNextEvent:218)
```


### Additional context

_No response_