Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
42 views

Calling NSApplication from Rust using objc

I am trying to learn by doing a project of allowing AppKit certain functions , related with App and Window creation to be called from Rust using objc. extern crate objc; use objc::runtime::{Class,...
user655941's user avatar
0 votes
0 answers
36 views

When need to call the Objective C nsautoreleasepool() on Rust side?

I use the objc2 library and their AppKit bindings in my project. Everything is good but I am not an Objective C developer and a little confused by the Rust implementation of autoreleasepool. For ...
Denis Steinman's user avatar
2 votes
1 answer
220 views

Convert *const __CFData to String in Rust

I am trying to convert *const __CFData to String in rust. I am trying to get Keyboard language and checking if it is a particular language. let current_source = ffi::...
hyoyin_Kyuoma's user avatar
0 votes
1 answer
108 views

Objective-C NSRunLoop & NotificationCenterDelegate not functional when spawned on Rust worker thread

I'm currently trying to use Rust C interop in order to send actional desktop notifications (using a modified version of this lib). The main goal here would be to handle these notification sending ...
user avatar
2 votes
1 answer
550 views

How to pass out parameter to function from Swift FFI?

Let's say I have a function defined in Rust, which looks like this: #[no_mangle] pub unsafe extern "C" fn do_something( my_value: *mut MyStruct, some_param: c_uint, content: *mut ...
frankenapps's user avatar
  • 7,667
1 vote
1 answer
797 views

How to call function using objc in Rust

I want to run a function of Cocoa's Quartz Window Services on Mac called CGWindowListCopyWindowInfo using a library called objc from Rust, is it possible? I can't figure out how to run function it ...
tasuren's user avatar
  • 301
0 votes
3 answers
354 views

Rust Cocoa - How to make an NSDictionary?

I've been reading around trying to understand it. You can see here dictionaryWithObjects:objects the takes an array of Objects and Keys: NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:...
Mikeumus's user avatar
  • 3,840
2 votes
3 answers
395 views

Rust Cocoa - How to Iterate NSArray

From brandonhamilton/image-capture-core-rs's ICCameraDevice.mediaFiles() I can get the NSArray::count() (from core-foundation-rs) : let cam_media_files = camera_device.mediaFiles(); println!( ...
Mikeumus's user avatar
  • 3,840
0 votes
1 answer
204 views

Apple PTP - withCompleteContentCatalog not firing (Rust + Obj-C)

From the imagecapturecore-rs crate here: https://github.com/brandonhamilton/image-capture-core-rs/issues/7 Only didOpenSessionWithError fires when connecting a PTP (picture transfer protocol) device ...
Mikeumus's user avatar
  • 3,840
0 votes
1 answer
789 views

Rust bindgen clang error, incompatible constant for this __builtin_neon function

Trying to generate bindings for an Obj-C++ header which is a part of Superpowered crossplatform audio library with rust bindgen. I am in Catalina 10.15.6, clang version 10.0.1 Target: x86_64-apple-...
Ali Somay's user avatar
  • 595
1 vote
1 answer
880 views

The correct way to manage cocoa memory when working with Objective-C from Rust

I'm struggling with one issue related to the cocoa foundation memory management. Basically I have a project, written in Rust and I'm using cocoa-rs and objc-rs to interact with Objective-C. I'm ...
Daniel's user avatar
  • 675
1 vote
1 answer
140 views

How do I determine the actual values of certain Objective-C constants?

I'm using Objective-C functions in my Rust application through the layer of different bindings. So far it was simple to call Objective-C functions and to implement the required functionality without ...
Daniel's user avatar
  • 675
7 votes
1 answer
2k views

How to call a Swift function in Rust?

I have a function written in Swift that I want to call from Rust. I've tried exposing it through Objective-C, however I continue to get errors from ld saying it can't find _foo. The Rust project is ...
XAMPPRocky's user avatar
  • 3,529
3 votes
1 answer
248 views

Create cross-platform library to be used from .NET and Objective-C

I feel that it is expected to be possible (to create a library with Rust that can be used from .NET and Objective-C) but after hours of googling I still have not clear picture of how to do so. Does ...
Alex Netkachov's user avatar