Added a basic settings view, not too happy with it yet though
This commit is contained in:
parent
16bfb8d6ba
commit
9bffe349e0
@ -32,6 +32,8 @@
|
|||||||
46AD30F82C2689B900486C25 /* ProjectSlideshowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46AD30F72C2689B900486C25 /* ProjectSlideshowView.swift */; };
|
46AD30F82C2689B900486C25 /* ProjectSlideshowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46AD30F72C2689B900486C25 /* ProjectSlideshowView.swift */; };
|
||||||
46D3E13F2C26D6430060722E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D3E13E2C26D6430060722E /* Constants.swift */; };
|
46D3E13F2C26D6430060722E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D3E13E2C26D6430060722E /* Constants.swift */; };
|
||||||
46D3E1402C26D6430060722E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D3E13E2C26D6430060722E /* Constants.swift */; };
|
46D3E1402C26D6430060722E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D3E13E2C26D6430060722E /* Constants.swift */; };
|
||||||
|
46D3E1422C27DD5D0060722E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D3E1412C27DD5C0060722E /* SettingsView.swift */; };
|
||||||
|
46D3E1442C27DFCE0060722E /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D3E1432C27DFCE0060722E /* Preferences.swift */; };
|
||||||
46E5FFD92C26A50D001191C9 /* CueCardViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46E5FFD82C26A50D001191C9 /* CueCardViewPresenter.swift */; };
|
46E5FFD92C26A50D001191C9 /* CueCardViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46E5FFD82C26A50D001191C9 /* CueCardViewPresenter.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -81,6 +83,8 @@
|
|||||||
46AD30F52C26823B00486C25 /* AddNewCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddNewCardView.swift; sourceTree = "<group>"; };
|
46AD30F52C26823B00486C25 /* AddNewCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddNewCardView.swift; sourceTree = "<group>"; };
|
||||||
46AD30F72C2689B900486C25 /* ProjectSlideshowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectSlideshowView.swift; sourceTree = "<group>"; };
|
46AD30F72C2689B900486C25 /* ProjectSlideshowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectSlideshowView.swift; sourceTree = "<group>"; };
|
||||||
46D3E13E2C26D6430060722E /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
|
46D3E13E2C26D6430060722E /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
|
||||||
|
46D3E1412C27DD5C0060722E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
||||||
|
46D3E1432C27DFCE0060722E /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
|
||||||
46E5FFD82C26A50D001191C9 /* CueCardViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CueCardViewPresenter.swift; sourceTree = "<group>"; };
|
46E5FFD82C26A50D001191C9 /* CueCardViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CueCardViewPresenter.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@ -180,6 +184,7 @@
|
|||||||
46AD30F52C26823B00486C25 /* AddNewCardView.swift */,
|
46AD30F52C26823B00486C25 /* AddNewCardView.swift */,
|
||||||
46AD30F72C2689B900486C25 /* ProjectSlideshowView.swift */,
|
46AD30F72C2689B900486C25 /* ProjectSlideshowView.swift */,
|
||||||
464787CA2C269CAF00A9C462 /* TeleprompterView.swift */,
|
464787CA2C269CAF00A9C462 /* TeleprompterView.swift */,
|
||||||
|
46D3E1412C27DD5C0060722E /* SettingsView.swift */,
|
||||||
);
|
);
|
||||||
path = View;
|
path = View;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -206,6 +211,7 @@
|
|||||||
46AD30F12C2672BD00486C25 /* ColorModel.swift */,
|
46AD30F12C2672BD00486C25 /* ColorModel.swift */,
|
||||||
46AD30F32C267D6400486C25 /* PreviewData.swift */,
|
46AD30F32C267D6400486C25 /* PreviewData.swift */,
|
||||||
46D3E13E2C26D6430060722E /* Constants.swift */,
|
46D3E13E2C26D6430060722E /* Constants.swift */,
|
||||||
|
46D3E1432C27DFCE0060722E /* Preferences.swift */,
|
||||||
);
|
);
|
||||||
path = Shared;
|
path = Shared;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -319,7 +325,9 @@
|
|||||||
46AD30ED2C266C0B00486C25 /* CardsView.swift in Sources */,
|
46AD30ED2C266C0B00486C25 /* CardsView.swift in Sources */,
|
||||||
46AD30BD2C26557500486C25 /* MainView.swift in Sources */,
|
46AD30BD2C26557500486C25 /* MainView.swift in Sources */,
|
||||||
46AD30F22C2672BD00486C25 /* ColorModel.swift in Sources */,
|
46AD30F22C2672BD00486C25 /* ColorModel.swift in Sources */,
|
||||||
|
46D3E1422C27DD5D0060722E /* SettingsView.swift in Sources */,
|
||||||
46D3E13F2C26D6430060722E /* Constants.swift in Sources */,
|
46D3E13F2C26D6430060722E /* Constants.swift in Sources */,
|
||||||
|
46D3E1442C27DFCE0060722E /* Preferences.swift in Sources */,
|
||||||
46AD30BF2C26557500486C25 /* Item.swift in Sources */,
|
46AD30BF2C26557500486C25 /* Item.swift in Sources */,
|
||||||
46AD30F42C267D6400486C25 /* PreviewData.swift in Sources */,
|
46AD30F42C267D6400486C25 /* PreviewData.swift in Sources */,
|
||||||
46AD30BB2C26557500486C25 /* OnCueApp.swift in Sources */,
|
46AD30BB2C26557500486C25 /* OnCueApp.swift in Sources */,
|
||||||
|
@ -12,6 +12,7 @@ struct MainView: View {
|
|||||||
@Environment(\.modelContext) private var modelContext
|
@Environment(\.modelContext) private var modelContext
|
||||||
@Query private var items: [OCProject]
|
@Query private var items: [OCProject]
|
||||||
|
|
||||||
|
@State private var showSettingsView = false
|
||||||
@State private var newProjectName = ""
|
@State private var newProjectName = ""
|
||||||
@State private var addNewProject = false
|
@State private var addNewProject = false
|
||||||
@State private var filterColor = ""
|
@State private var filterColor = ""
|
||||||
@ -37,6 +38,12 @@ struct MainView: View {
|
|||||||
|
|
||||||
}
|
}
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
// ToolbarItem(placement: .topBarLeading) {
|
||||||
|
// Button(action: {showSettingsView.toggle()}) {
|
||||||
|
// Image(systemName: "gear")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
// ToolbarItem(placement: .topBarTrailing) {
|
// ToolbarItem(placement: .topBarTrailing) {
|
||||||
// Menu {
|
// Menu {
|
||||||
// Picker(selection: $filterColor) {
|
// Picker(selection: $filterColor) {
|
||||||
@ -65,6 +72,9 @@ struct MainView: View {
|
|||||||
.sheet(isPresented: $addNewProject) {
|
.sheet(isPresented: $addNewProject) {
|
||||||
NewProjectForm(completionHandler: addItem)
|
NewProjectForm(completionHandler: addItem)
|
||||||
}
|
}
|
||||||
|
.sheet(isPresented: $showSettingsView) {
|
||||||
|
SettingsView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func addItem(name: String, color: String) {
|
private func addItem(name: String, color: String) {
|
||||||
|
36
OnCue/View/SettingsView.swift
Normal file
36
OnCue/View/SettingsView.swift
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// SettingsView.swift
|
||||||
|
// OnCue
|
||||||
|
//
|
||||||
|
// Created by Pradyun Setti on 23/06/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct SettingsView: View {
|
||||||
|
@Environment(\.dismiss) var dismiss
|
||||||
|
|
||||||
|
// @State private var teleprompterSeparator = "---"
|
||||||
|
@AppStorage(Preferences.teleprompterSeparator) var teleprompterSeparator: String = "---"
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
NavigationView {
|
||||||
|
List {
|
||||||
|
Section {
|
||||||
|
TextField(text: $teleprompterSeparator) { Text("Teleprompter Cuecard Separator") }
|
||||||
|
} header: { Text("Teleprompter View") }
|
||||||
|
}
|
||||||
|
.navigationTitle("Settings")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
|
Button("Done") { dismiss() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
SettingsView()
|
||||||
|
}
|
12
Shared/Preferences.swift
Normal file
12
Shared/Preferences.swift
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// AppStorage.swift
|
||||||
|
// OnCue
|
||||||
|
//
|
||||||
|
// Created by Pradyun Setti on 23/06/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct Preferences {
|
||||||
|
static let teleprompterSeparator = "teleprompterSeparator"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user