Elektrine lite

← Feed

@kylebshr@mastodon.social

Post #1249911

2026-03-30 01:00 UTC

@mergesort I think I understand what you’re trying to do, and instead of something like `.empty` I’ve used the type system for this; optional view properties get init variations where they’re omitted from the init, and they get set to nil (and constrained to Never, though you could constraint to EmptyView for the same effect). I prefer optional views instead of views that may be EmptyView, because you can customize the layout based on their presence instead of checking the type.

Replies (2)

  • @kylebshr@mastodon.social 2026-03-30 01:03

    @mergesort also, sounds like I need a much better readme

    Open ##1249912

  • @willing@mastodon.social 2026-03-31 07:39

    @kylebshr @mergesort A more resilient approach I like to use for components like this is to use Group(subviews:transform:) to resolve subview proxies, so you can check if the view is _actually_ empty (beyond just inspecting types). Unsure if that’s something a macro could help with — seems less likely.

    Open ##1249921