Skip to content

Commit 8207c5b

Browse files
committed
Fix Equatable and Hashable conformances
1 parent d88929e commit 8207c5b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Sources/ToastUI/ToastState.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import CasePaths
33
import SwiftUI
44
import SwiftUINavigation
55

6-
public struct ToastState: Identifiable, Equatable, Hashable {
6+
public struct ToastState: Identifiable {
77
public let id = UUID()
88

99
let style: ToastView.Style
@@ -24,6 +24,24 @@ public struct ToastState: Identifiable, Equatable, Hashable {
2424
}
2525
}
2626

27+
extension ToastState: Equatable {
28+
public static func == (lhs: ToastState, rhs: ToastState) -> Bool {
29+
lhs.style == rhs.style &&
30+
lhs.icon == rhs.icon &&
31+
lhs.title == rhs.title &&
32+
lhs.subtitle == rhs.subtitle
33+
}
34+
}
35+
36+
extension ToastState: Hashable {
37+
public func hash(into hasher: inout Hasher) {
38+
hasher.combine(style)
39+
hasher.combine(icon)
40+
hasher.combine(title)
41+
hasher.combine(subtitle)
42+
}
43+
}
44+
2745
extension View {
2846
public func toast(
2947
unwrapping value: Binding<ToastState?>,

0 commit comments

Comments
 (0)