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

Added dynamicMemberLookup support #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jayrhynas
Copy link

@jayrhynas jayrhynas commented Jul 30, 2022

This PR leverages dynamicMemberLookup to allow setting properties in the same style as SwiftUI.

Unfortunately DML cannot be implemented by a protocol so the implementation needs to be duplicated between the conforming types (UIViewContainer and ModifiedUIViewContainer)

@jayrhynas
Copy link
Author

jayrhynas commented Aug 2, 2022

The one downside of this approach is that any UIKit properties that have the same name as a View modifier won't be available via DML, but you can still fall back to set(_:to:)
(for example with a wrapped UILabel you cannot set the font as it tries to use View.font(_:Font))

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

Successfully merging this pull request may close these issues.

None yet

1 participant