Mads Marquart

Results 394 comments of Mads Marquart

You can link to the framework using [the `link` attribute](https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute): ```rust #[link(name = "GameController", kind = "framework")] extern "C" {} ``` Note that it doesn't matter what's inside the `extern`...

`*const NSString`, or even better, `&'static NSString`, should work, but doesn't because `NSString` is incorrectly defined. Using `&'static Object` instead is perfect fine! For reference, the [implementation](https://github.com/SSheldon/rust-objc-foundation/blob/15f9ebec1190889e48a4bc2d36601e61d303071f/src/macros.rs#L4-L6) should be changed...

I've been working on a few crates to improve the soundness situation, see [`objc2`](https://github.com/madsmtm/objc2) if you're interested. They're not really ready for general audience, but I'm getting pretty close to...

Just to be clear, it should be: ```rust let ns_dict = class!(NSDictionary); let ns_number = class!(NSNumber); let options: Id = unsafe { let obj: Id = Id::from_ptr(msg_send![ns_number, numberWithBool: objc::runtime::YES]); Id::from_ptr(msg_send![ns_dict,...

`@available` is a compile-time directive, it conditionally compiles the code depending on the deployment target (can be set using the `MACOSX_DEPLOYMENT_TARGET` / `IPHONEOS_DEPLOYMENT_TARGET` / ... environment variables). I am working...

Actually it's a little more complex than I thought: Objective-C's `@available` / Swift's `#available` acts as _both_ a compile-time _and_ a run-time check! As an example, if you have the...

But again, using the `sysinfo` crate you can essentially do the exact same runtime checks (albeit less efficiently).

So the issue is... Quite complex, and honestly feels more like a bug in the compiler (though I'm not really qualified to state that). In short, it's because our implementation...

### Idea 1 Just wrap all your message sends in a new function: ```rust fn call_my_selector(obj: &mut Object) { unsafe { msg_send![obj, my_selector] } } ``` Which, well, is probably...

A first step would be to add `UnsafeCell` somewhere in https://github.com/SSheldon/rust-objc/blob/0.2.7/src/runtime.rs#L43 or similar places - that would as far as I know make it so that internal things that `Object`...