Skip to content

Add a binding helper for easier SwiftUI integration#102

Merged
DevYeom merged 2 commits into
mainfrom
binding
Oct 6, 2024
Merged

Add a binding helper for easier SwiftUI integration#102
DevYeom merged 2 commits into
mainfrom
binding

Conversation

@DevYeom
Copy link
Copy Markdown
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
@DevYeom DevYeom deleted the binding branch October 6, 2024 04:11
@sobabear
Copy link
Copy Markdown
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