ryanmcgrath / cacao

Rust bindings for AppKit (macOS) and UIKit (iOS/tvOS). Experimental, but working!
MIT License
1.79k stars 65 forks source link

Multiple changes I had to make for Ebou #89

Closed terhechte closed 11 months ago

terhechte commented 1 year ago

This PR contains a couple of changes:

Segmented Control

This adds a segmented control. In order to know which index was selected (crucial to do something useful) I had to extend set_action to also receive an object (*const Object) which can then be inspected:

       let mut control = SegmentedControl::new(images, cacao::appkit::segmentedcontrol::TrackingMode::SelectOne);
        control.set_action(|index| {
            println!("Selected Index {index}");
        });

This is a bit of a pervasive change that goes through the whole codebase

Formatting

I'm using the default Rust Analysers auto formatting rules in all my code and somehow my settings are different than the one used in this codebase, so it added a lot of commas in places. I'm not sure if this is a problem for you or not.

Various

terhechte commented 1 year ago

I can look into the conflicts once I know whether you'd be willing to merge this PR :)

ryanmcgrath commented 11 months ago

I'd say I'm probably down to merge this, because you're actually using it in a production application and discovering things that are necessary. :)

The aspect of it being a slightly invasive change is fine since this repo is prepping for a 0.4 anyway.

terhechte commented 11 months ago

Awesome! I've fixed the merge conflicts 😄

ryanmcgrath commented 11 months ago

Thanks!