fix lag due to court used calculation on each match cellpaca_championship
parent
17e0c85e0b
commit
e852999739
@ -0,0 +1,51 @@ |
||||
// |
||||
// MatchViewStyle.swift |
||||
// PadelClub |
||||
// |
||||
// Created by razmig on 17/11/2024. |
||||
// |
||||
|
||||
import SwiftUI |
||||
|
||||
enum MatchViewStyle { |
||||
case standardStyle // vue normal |
||||
case sectionedStandardStyle // vue normal avec des sections indiquant déjà la manche |
||||
case feedStyle // vue programmation |
||||
case plainStyle // vue detail |
||||
//case tournamentResultStyle //vue resultat tournoi |
||||
case followUpStyle // vue normal |
||||
|
||||
func displayRestingTime() -> Bool { |
||||
switch self { |
||||
case .standardStyle: |
||||
return false |
||||
case .sectionedStandardStyle: |
||||
return false |
||||
case .feedStyle: |
||||
return false |
||||
case .plainStyle: |
||||
return false |
||||
// case .tournamentResultStyle: |
||||
// return false |
||||
case .followUpStyle: |
||||
return true |
||||
} |
||||
} |
||||
} |
||||
|
||||
struct MatchViewStyleKey: EnvironmentKey { |
||||
static let defaultValue: MatchViewStyle = .standardStyle |
||||
} |
||||
|
||||
extension EnvironmentValues { |
||||
var matchViewStyle: MatchViewStyle { |
||||
get { self[MatchViewStyleKey.self] } |
||||
set { self[MatchViewStyleKey.self] = newValue } |
||||
} |
||||
} |
||||
|
||||
extension View { |
||||
func matchViewStyle(_ style: MatchViewStyle) -> some View { |
||||
environment(\.matchViewStyle, style) |
||||
} |
||||
} |
||||
Loading…
Reference in new issue