-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from makinosp/develop
Develop
- Loading branch information
Showing
17 changed files
with
686 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Binding+containsBinding.swift | ||
// Harmonie | ||
// | ||
// Created by makinosp on 2024/10/20. | ||
// | ||
|
||
import SwiftUICore | ||
|
||
extension Binding where Value: SetAlgebra & Sendable, Value.Element: Sendable { | ||
func containsBinding(for value: Value.Element) -> Binding<Bool> { | ||
Binding<Bool>( | ||
get: { wrappedValue.contains(value) }, | ||
set: { newValue in | ||
if newValue { | ||
wrappedValue.insert(value) | ||
} else { | ||
wrappedValue.remove(value) | ||
} | ||
} | ||
) | ||
} | ||
} |
Oops, something went wrong.