1 post tagged
#cocoa
Swipeable NSCollectionView
A look at how swipe-to-reveal can be implemented in NSCollectionView.
1 post tagged
A look at how swipe-to-reveal can be implemented in NSCollectionView.
On Tue, Sep 19, 2023 at 08:22, NeverEnoughRakia @.***(mailto:On Tue, Sep 19, 2023 at 08:22, NeverEnoughRakia < wrote:
a week agoThat said, this is a 'fork' of the most recent (haha) version found on the internets, with a ton of patches from various people around the internet cobbled together. Hello, In case you had bookmarked or you still remember from where you took the patches, could you please post a list of them? I guess some of their authors even commented them, for e.g. they might have made them for specific reasons you might have omitted.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***> on Consider posting from where you took the patches?
And yeah ownership of the ObjC object is something I want to try and hide from this all, since it can get thorny quickly - it’s what led me to the handler approach originally.
Def appreciate the efforts tho and we’ll figure out the best way to do this!
On Fri, Sep 15, 2023 at 20:51, Isaac-Leonard @.***(mailto:On Fri, Sep 15, 2023 at 20:51, Isaac-Leonard < wrote:
2 weeks agoOkay, so I think I've implemented everything now that's needed to use Layout as a dye trait. I had to create a new trait for the set_frame method as I didn't really know how that could work without generics, I updated the frame example with the change. I had to change how ObjcAccess works too as the get_from_backing_obj method couldn't work without the generic return type. Instead I've made a new method that just returns the reference to the inner Id that callers can then just dereference and do what they were doing before. I'm not sure if I've be putting Shared or Owned for the ownership generic of Id though, for now I've just got Owned. I've also not had any experience with objective C so I'm not sure if I'm creating layout anchors correctly,. I'm creating them the same way its done in the constructor for view but not sure if this creates non-allowed duplicates or anything. I believe all of these changes may allow me to implement a more reactive framework on top of cacao too now.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***> on Add trait to get layout anchors for a view
FYI this might be a thing you'll need to rebase since we merged the objc2
PR recently. Apologies for the hassle but it should overall be better for the library going forward. :( on Add trait to get layout anchors for a view
2 weeks ago
Note the change in API for Image::draw, which is unfortunate. It's not a strictly a needed change, but I wanted to avoid the direct dependency on core-graphics since it locks the public API to the specific version cacao depends on, and is used so little.
Hmm, you're specifically referring to not needing CGContextRef
? I see what you mean, though it is definitely unfortunate... but then again, if there were to be other spots that use CGContextRef
, it might make sense to bite the bullet and at the very least feature-flag it.
How often does core-graphics
change anyway? It might not be a big deal to have it as a dependency. on Replace core-foundation
and core-graphics
2 weeks ago
objc2
2 weeks ago
I would say a few changes come to mind tho:
The layout anchor getters could probably be safely thrown onto the Layout
trait without much issue, to reduce trait importing (mental) overhead.
top_to_bottom
would be improved (IMO) with the following api:
pub struct ColumnLayout {
pub spacing: usize // psuedocode, do whatever type here
}
pub fn column<I, C>(parent: &Layout, layout: ColumnLayout, children: I)
where
I: IntoIterator<Item = &C>,
C: Layout,
{
// Manage adding views, setting spacing, etc
}
This feels more declarative in nature to me, e.g I could then write:
impl MyGenericView {
pub fn build(&self) {
column(&self.view_handle, ColumnLayout {
spacing: 8
}, [
&self.child_view_1,
&self.child_view_2,
// etc
]);
}
}
The above is all pseudocode and not tested but hopefully showcases the idea.
fill_safe_area
I'm less enthused about and might want that in a contrib
or helpers
module, but I'll muse on that one for a bit. on Add trait to get layout anchors for a view
2 weeks ago
Thank you again for the sheer amount of work here, as well as for the wider ObjC work you're doing in the Rust community. It's really great that someone's picked up the torch and focused on making it all safer and more reliable overall.
I'll let this sit in trunk for a bit to see how people find it - whether we need to fix any bugs or anything - but then if all seems fine I'll eye pushing out the next (-beta
, maybe) release that uses this. on Initial conversion to objc2
2 weeks ago