Skip to content

Commit

Permalink
Merge pull request #170 from makinosp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
makinosp authored Oct 20, 2024
2 parents 9a45afb + fb5a019 commit 76580e0
Show file tree
Hide file tree
Showing 17 changed files with 686 additions and 178 deletions.
3 changes: 3 additions & 0 deletions harmonie/Components/IconSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ enum IconSet {
static var circleFilled: some Iconizable {
Icon("circle.fill")
}
static var clear: some Iconizable {
Icon("clear")
}
static var code: some Iconizable {
Icon("curlybraces")
}
Expand Down
6 changes: 3 additions & 3 deletions harmonie/Extensions/Binding+NilCoalescing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import SwiftUICore

extension Binding {
static func ?? <T>(optional: Self, defaultValue: T) -> Binding<T> where T: Sendable, Value == T? {
.init(
extension Binding where Value: Sendable {
static func ?? <T>(optional: Self, defaultValue: T) -> Binding<T> where Value == T? {
Binding<T>(
get: { optional.wrappedValue ?? defaultValue },
set: { optional.wrappedValue = $0 }
)
Expand Down
23 changes: 23 additions & 0 deletions harmonie/Extensions/Binding+containsBinding.swift
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)
}
}
)
}
}
Loading

0 comments on commit 76580e0

Please sign in to comment.