mirror of
https://github.com/Mueller-Patrick/DHBW-Service-App.git
synced 2024-11-01 08:53:58 +00:00
Added TextFields to FirstTimeOpening
This commit is contained in:
parent
cfa09ec7aa
commit
2ea4182e63
|
@ -495,7 +495,7 @@
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"DHBW-Service/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"DHBW-Service/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = HS7KNT4MZ2;
|
DEVELOPMENT_TEAM = G3TRS8UHWN;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
INFOPLIST_FILE = "DHBW-Service/Supporting Files/Info.plist";
|
INFOPLIST_FILE = "DHBW-Service/Supporting Files/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
|
@ -517,7 +517,7 @@
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"DHBW-Service/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"DHBW-Service/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = HS7KNT4MZ2;
|
DEVELOPMENT_TEAM = G3TRS8UHWN;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
INFOPLIST_FILE = "DHBW-Service/Supporting Files/Info.plist";
|
INFOPLIST_FILE = "DHBW-Service/Supporting Files/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1" systemVersion="11A491" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="true" userDefinedModelVersionIdentifier="">
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17511" systemVersion="20C69" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
|
||||||
<entity name="Item" representedClassName="Item" syncable="YES" codeGenerationType="class">
|
<entity name="Item" representedClassName="Item" syncable="YES" codeGenerationType="class">
|
||||||
<attribute name="timestamp" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
<attribute name="timestamp" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||||
</entity>
|
</entity>
|
||||||
|
<entity name="User" representedClassName="User" syncable="YES" codeGenerationType="class">
|
||||||
|
<attribute name="course" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="director" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="name" optional="YES" attributeType="String"/>
|
||||||
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Item" positionX="-63" positionY="-18" width="128" height="44"/>
|
<element name="Item" positionX="-63" positionY="-18" width="128" height="44"/>
|
||||||
|
<element name="User" positionX="-63" positionY="-9" width="128" height="74"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
|
@ -39,5 +39,6 @@ struct ContentView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ContentView()
|
ContentView()
|
||||||
.preferredColorScheme(.dark)
|
.preferredColorScheme(.dark)
|
||||||
|
.environmentObject(LocalSettings())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,21 +6,61 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import CoreData
|
||||||
|
|
||||||
struct FirstOpeningSettings: View {
|
struct FirstOpeningSettings: View {
|
||||||
@EnvironmentObject var settings: LocalSettings
|
@EnvironmentObject var settings: LocalSettings
|
||||||
|
@State private var name = ""
|
||||||
|
@State private var course = ""
|
||||||
|
@State private var director = ""
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: {
|
|
||||||
self.settings.isFirstOpening = !self.settings.isFirstOpening
|
VStack {
|
||||||
}){
|
TextField("Name", text: self.$name)
|
||||||
Text("First opening toggle")
|
.textContentType(.name)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.frame(minWidth: 200, idealWidth: nil, maxWidth: 500, minHeight: nil, idealHeight: nil, maxHeight: nil, alignment: .center)
|
||||||
|
.padding(.horizontal)
|
||||||
|
TextField("Course", text: self.$course)
|
||||||
|
.textContentType(.name)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.frame(minWidth: 200, idealWidth: nil, maxWidth: 500, minHeight: nil, idealHeight: nil, maxHeight: nil, alignment: .center)
|
||||||
|
.padding(.horizontal)
|
||||||
|
TextField("Director", text: self.$director)
|
||||||
|
.textContentType(.name)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.frame(minWidth: 200, idealWidth: nil, maxWidth: 500, minHeight: nil, idealHeight: nil, maxHeight: nil, alignment: .center)
|
||||||
|
.padding(.horizontal)
|
||||||
|
Button(action: {
|
||||||
|
self.settings.isFirstOpening = !self.settings.isFirstOpening
|
||||||
|
}){
|
||||||
|
Text("Confirm")
|
||||||
|
.padding()
|
||||||
|
.foregroundColor(.white)
|
||||||
|
.background(Color.blue)
|
||||||
|
.cornerRadius(15)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension FirstOpeningSettings{
|
||||||
|
func saveToCoreData(){
|
||||||
|
let entity = NSEntityDescription.entity(forEntityName: "User", in: PersistenceController.shared.context)!
|
||||||
|
let user = NSManagedObject(entity: entity, insertInto: PersistenceController.shared.context)
|
||||||
|
user.setValue(name, forKey: "name")
|
||||||
|
user.setValue(course, forKey: "course")
|
||||||
|
user.setValue(director, forKey: "director")
|
||||||
|
|
||||||
|
PersistenceController.shared.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct FirstOpeningSettings_Previews: PreviewProvider {
|
struct FirstOpeningSettings_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
FirstOpeningSettings()
|
FirstOpeningSettings()
|
||||||
|
.preferredColorScheme(.dark)
|
||||||
|
.environmentObject(LocalSettings())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,6 @@ struct HomeView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
HomeView()
|
HomeView()
|
||||||
.preferredColorScheme(.dark)
|
.preferredColorScheme(.dark)
|
||||||
|
.environmentObject(LocalSettings())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user