Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement basic view modifiers #3

Open
3 of 4 tasks
stackotter opened this issue Mar 20, 2022 · 3 comments
Open
3 of 4 tasks

Implement basic view modifiers #3

stackotter opened this issue Mar 20, 2022 · 3 comments
Labels
API feature A feature request

Comments

@stackotter
Copy link
Owner

stackotter commented Mar 20, 2022

SwiftUI has a concept called view modifiers. SwiftUI's ViewModifier protocol is for modifiers that can apply to any view, but individual views can also declare their own modifiers by creating a method of the form func modifierName(/* parameters */) -> Self which modifies the view accordingly and returns a copy.

The following view modifiers would be the most useful to have:

  • padding
  • foreground (colour)
  • background (colour)
  • scale

If you think of any more, reply below.

The SwiftGtk package currently doesn't support CSS styling which means that the styling feature request for SwiftGtk would have to be completed first. SwiftGtk now supports CSS styling and has been merged into the SwiftCrossUI repo for ease of rapid development.

@stackotter stackotter added the feature A feature request label Mar 20, 2022
@skela
Copy link

skela commented Feb 26, 2025

Not sure if this belongs in here or its own task, but the lack of disabled for Buttons is a pretty obvious one that i encountered 10 seconds into looking into this library.

In Swift UI its:

Button("Whatever")
{
}
.disabled(true)

@bbrk24
Copy link
Contributor

bbrk24 commented Feb 26, 2025

disabled is a little more complex than it appears at first because it disables all controls (buttons, text fields, etc) no matter how deep in the view hierarchy they may be. I agree that it is necessary, though.

@stackotter
Copy link
Owner Author

It has been on my todos for quite a while but I’ve mostly been focusing on other parts of SwiftCrossUI. Now that I’ve implemented an environment system, propagating disabledness down the view hierarchy should be easy enough. The backend implementations for disabling all the various controls would probably take an hour or something? With Windows being the annoying one cause SwiftCrossUI stuff takes quite a while to build in my Windows VM atm (due to the swift-winui library I’m using).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API feature A feature request
Projects
None yet
Development

No branches or pull requests

3 participants