Skip to content

Commit

Permalink
No longer with Identifiable constraint on Element
Browse files Browse the repository at this point in the history
  • Loading branch information
Reed Es committed Mar 4, 2022
1 parent 18cb2d6 commit 1bb3292
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Sources/DetailerDeleteButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import SwiftUI

public struct DetailerDeleteButton<Element, Content>: View
where Element: Identifiable, Content: View
where Content: View
{
public typealias CanDelete = (Element) -> Bool
public typealias OnDelete = (Element.ID) -> Void
public typealias OnDelete = (Element) -> Void

// MARK: Parameters

Expand Down Expand Up @@ -62,7 +62,7 @@ public struct DetailerDeleteButton<Element, Content>: View
// MARK: Views

public var body: some View {
Button(action: { onDelete?(element.id) }) {
Button(action: { onDelete?(element) }) {
label()
}
.keyboardShortcut(.delete, modifiers: [])
Expand Down
2 changes: 1 addition & 1 deletion Sources/DetailerEditButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SwiftUI
/// * Assumes the user will be allowed to edit (canEdit==true) even if no canEdit provided (canEdit==nil).
///
public struct DetailerEditButton<Element, Content>: View
where Element: Identifiable, Content: View
where Content: View
{
public typealias CanEdit = (Element) -> Bool
public typealias OnEdit = (Element) -> Void
Expand Down
2 changes: 1 addition & 1 deletion Sources/DetailerViewButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import SwiftUI

public struct DetailerViewButton<Element, Content>: View
where Element: Identifiable, Content: View
where Content: View
{
public typealias OnView = (Element) -> Void

Expand Down
3 changes: 1 addition & 2 deletions Sources/EditDetailerContextMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
import SwiftUI

public struct EditDetailerContextMenu<Element>: ViewModifier
where Element: Identifiable
{
public typealias CanEdit = (Element) -> Bool
public typealias CanDelete = (Element) -> Bool
public typealias OnDelete = (Element.ID) -> Void
public typealias OnDelete = (Element) -> Void
public typealias OnEdit = (Element) -> Void

private let element: Element
Expand Down
3 changes: 1 addition & 2 deletions Sources/EditDetailerSwipeMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import SwiftUI

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct EditDetailerSwipeMenu<Element>: ViewModifier
where Element: Identifiable
{
public typealias CanEdit = (Element) -> Bool
public typealias CanDelete = (Element) -> Bool
public typealias OnDelete = (Element.ID) -> Void
public typealias OnDelete = (Element) -> Void
public typealias OnEdit = (Element) -> Void

private let element: Element
Expand Down
1 change: 0 additions & 1 deletion Sources/ViewDetailerContextMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import SwiftUI

public struct ViewDetailerContextMenu<Element>: ViewModifier
where Element: Identifiable
{
private var element: Element
@Binding private var toView: Element?
Expand Down
1 change: 0 additions & 1 deletion Sources/ViewDetailerSwipeMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import SwiftUI

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct ViewDetailerSwipeMenu<Element>: ViewModifier
where Element: Identifiable
{
private var element: Element
@Binding private var toView: Element?
Expand Down

0 comments on commit 1bb3292

Please sign in to comment.