You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
PadelClub/PadelClub/ViewModel/TournamentSeedEditing.swift

29 lines
678 B

//
// tournamentSeedEditing.swift
// PadelClub
//
// Created by Razmig Sarkissian on 31/03/2024.
//
import Foundation
import SwiftUI
// Create an environment key
private struct TournamentSeedEditing: EnvironmentKey {
static let defaultValue: Bool = false
}
// ## Introduce new value to EnvironmentValues
extension EnvironmentValues {
var isEditingTournamentSeed: Bool {
get { self[TournamentSeedEditing.self] }
set { self[TournamentSeedEditing.self] = newValue }
}
}
// Add a dedicated modifier (Optional)
extension View {
func editTournamentSeed(_ value: Bool) -> some View {
environment(\.isEditingTournamentSeed, value)
}
}