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

Add a binding helper for easier SwiftUI integration #102

Merged
merged 2 commits into from
Oct 6, 2024
Merged

Conversation

DevYeom
Copy link
Owner

@DevYeom DevYeom commented Oct 6, 2024

Related Issues 💭

Description 📝

  • Since it is usually used with SwiftUI, a function to easily create bindings was added.
  • Separating into another target (e.g. OneWayUI) was considered, but for convenience, it was integrated into a single target.

Additional Notes 📚

AS-IS

Toggle(
    "isLoading",
    isOn: Binding<Bool>(
        get: { store.state.isLoading },
        set: { store.send(.setIsLoading($0)) }
    )
)

TO-BE

Toggle(
    "isLoading",
    isOn: store.binding(\.isLoading, send: { .setIsLoading($0) })
)

Checklist ✅

  • If it's a new feature, have appropriate unit tests been added?
  • If the changes affect existing functionality, please verify whether the above information has been appropriately described.

@DevYeom DevYeom self-assigned this Oct 6, 2024
@DevYeom DevYeom merged commit 72769ac into main Oct 6, 2024
2 checks passed
@DevYeom DevYeom deleted the binding branch October 6, 2024 04:11
@sobabear
Copy link
Contributor

sobabear commented Oct 7, 2024

@DevYeom 👍 Thank you! 감사합니다

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.

2 participants