1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

🏗️ Example of what a preference view might be

This commit is contained in:
2023-07-25 19:24:04 +02:00
parent 5e7c7bc903
commit 3ef1a6e60d
2 changed files with 61 additions and 0 deletions

View File

@ -712,6 +712,7 @@
C4D5576529C77CC5001A44CD /* PhpVersionManagerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D5576329C77CC5001A44CD /* PhpVersionManagerWindowController.swift */; };
C4D5576629C77CC5001A44CD /* PhpVersionManagerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D5576329C77CC5001A44CD /* PhpVersionManagerWindowController.swift */; };
C4D5576729C77CC5001A44CD /* PhpVersionManagerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D5576329C77CC5001A44CD /* PhpVersionManagerWindowController.swift */; };
C4D5857C2A7038DB00DDBB63 /* ByteLimitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D5857B2A7038DB00DDBB63 /* ByteLimitView.swift */; };
C4D5CFCA27E0F9CD00035329 /* NginxConfigurationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D5CFC927E0F9CD00035329 /* NginxConfigurationFile.swift */; };
C4D5CFCB27E0F9CD00035329 /* NginxConfigurationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D5CFC927E0F9CD00035329 /* NginxConfigurationFile.swift */; };
C4D8016622B1584700C6DA1B /* Startup.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D8016522B1584700C6DA1B /* Startup.swift */; };
@ -1052,6 +1053,7 @@
C4D36619291173EA006BD146 /* DictionaryExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DictionaryExtension.swift; sourceTree = "<group>"; };
C4D4CB3629C109CF00DB9F93 /* InternalSwitcher+Valet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "InternalSwitcher+Valet.swift"; sourceTree = "<group>"; };
C4D5576329C77CC5001A44CD /* PhpVersionManagerWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpVersionManagerWindowController.swift; sourceTree = "<group>"; };
C4D5857B2A7038DB00DDBB63 /* ByteLimitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ByteLimitView.swift; sourceTree = "<group>"; };
C4D5CFC927E0F9CD00035329 /* NginxConfigurationFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NginxConfigurationFile.swift; sourceTree = "<group>"; };
C4D8016522B1584700C6DA1B /* Startup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Startup.swift; sourceTree = "<group>"; };
C4D89BC52783C99400A02B68 /* ComposerJson.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerJson.swift; sourceTree = "<group>"; };
@ -1483,6 +1485,7 @@
isa = PBXGroup;
children = (
C44DFA7B2A67043000B98ED5 /* ConfigManagerView.swift */,
C4D5857B2A7038DB00DDBB63 /* ByteLimitView.swift */,
);
path = UI;
sourceTree = "<group>";
@ -2468,6 +2471,7 @@
03E36FE728D9219000636F7F /* ActiveShell.swift in Sources */,
C4D9ADBF277610E1007277F4 /* PhpSwitcher.swift in Sources */,
C45E76142854A65300B4FE0C /* ServicesManager.swift in Sources */,
C4D5857C2A7038DB00DDBB63 /* ByteLimitView.swift in Sources */,
C4D4CB3729C109CF00DB9F93 /* InternalSwitcher+Valet.swift in Sources */,
C46EBC4728DB9644007ACC74 /* RealShell.swift in Sources */,
C4068CAA27B0890D00544CD5 /* MenuBarIcons.swift in Sources */,

View File

@ -0,0 +1,57 @@
//
// ByteLimitView.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 25/07/2023.
// Copyright © 2023 Nico Verbruggen. All rights reserved.
//
import SwiftUI
struct PreferenceContainer: View {
private var name: String = "Memory Limit"
private var description: String = "This is the maximum memory a given PHP script may consume."
private var controlView: some View = ByteLimitView()
var body: some View {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 50) {
Text(self.name).bold()
controlView
}
.frame(width: 300)
Text(self.description).font(.subheadline)
}
.padding(10)
}
}
struct ByteLimitView: View {
@State private var selection = "256 MB"
let colors = [
"128 MB",
"256 MB",
"512 MB",
"1 GB",
"2 GB",
"Unlimited",
"Other"
]
var body: some View {
Picker("Limit Name", selection: $selection) {
ForEach(colors, id: \.self) {
Text($0)
}
}
.labelsHidden()
.pickerStyle(.menu)
}
}
struct ByteLimitView_Previews: PreviewProvider {
static var previews: some View {
PreferenceContainer()
}
}