Skip to content

Commit 7fc68e5

Browse files
committed
Use binding instead of wrapped value
1 parent 82bb92a commit 7fc68e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Shared/Supporting Files/Views/FavoritesView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import SwiftUI
1616

1717
struct FavoritesView: View {
1818
/// The editing mode of the environment.
19-
@Environment(\.editMode) private var editMode
19+
@State private var editMode: EditMode = .inactive
2020

2121
/// A Boolean value indicating whether the add favorite sheet is showing.
2222
@State private var addFavoriteSheetIsShowing = false
@@ -57,8 +57,9 @@ struct FavoritesView: View {
5757
}
5858
}
5959
}
60+
.environment(\.editMode, $editMode)
6061
.onDisappear {
61-
editMode?.wrappedValue = .inactive
62+
editMode = .inactive
6263
}
6364
}
6465
}

0 commit comments

Comments
 (0)