]> git.r.bdr.sh - rbdr/map/blame - Map/Data/FocusedValues+document.swift
Address the lint warnings
[rbdr/map] / Map / Data / FocusedValues+document.swift
CommitLineData
be897af3
RBR
1// Copyright (C) 2024 Rubén Beltrán del Río
2
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see https://map.tranquil.systems.
14491563
RBR
15import SwiftUI
16
17struct DocumentFocusedValueKey: FocusedValueKey {
18 typealias Value = Binding<MapDocument>
19}
20
21struct IsSearchingValueKey: FocusedValueKey {
22 typealias Value = Binding<Bool>
23}
24
25struct SelectedEvolutionValueKey: FocusedValueKey {
26 typealias Value = Binding<StageType>
27}
28
29struct FileURLValueKey: FocusedValueKey {
30 typealias Value = URL
31}
32
33extension FocusedValues {
34 var document: DocumentFocusedValueKey.Value? {
35 get { self[DocumentFocusedValueKey.self] }
36 set { self[DocumentFocusedValueKey.self] = newValue }
37 }
38 var isSearching: IsSearchingValueKey.Value? {
39 get { self[IsSearchingValueKey.self] }
40 set { self[IsSearchingValueKey.self] = newValue }
41 }
42 var selectedEvolution: SelectedEvolutionValueKey.Value? {
43 get { self[SelectedEvolutionValueKey.self] }
44 set { self[SelectedEvolutionValueKey.self] = newValue }
45 }
46 var fileURL: FileURLValueKey.Value? {
47 get { self[FileURLValueKey.self] }
48 set { self[FileURLValueKey.self] = newValue }
49 }
50}