swift-cross-ui
swift-cross-ui copied to clipboard
Implement a layout system
Currently, the layout of views is at the mercy of Gtk, which is not too great. Gtk supports styling through CSS, so the layout system would most likely just consist of generating css for each component according to certain layout rules. But there may be a better approach that I haven't thought of.
The SwiftGtk package currently doesn't support CSS styling which means that the styling feature request for SwiftGtk would have to be completed first.
We now have some limited layout:
- Alignment through
Spacer:
/// horizontal alignment
HStack {
Spacer()
Content()
}
/// vertical alignment
VStack {
Spacer()
Content()
}
- Forced minimum size using
.frame(minWidth:maxWidth:)
Content().frame(minWidth: 200)
- Padding
Content().padding(10)
Maybe we should define which layout features we would like next
That's almost all of the main ones done, I can't really think of any off the top of my head other than navigation layouts, but that's also pretty good now. I feel like it's almost time to start trying to build some more complicated apps and just see what's missing in practice