diff --git a/swiftapp.xcodeproj/project.pbxproj b/swiftapp.xcodeproj/project.pbxproj index fbc2480..e008bd6 100644 --- a/swiftapp.xcodeproj/project.pbxproj +++ b/swiftapp.xcodeproj/project.pbxproj @@ -442,7 +442,7 @@ ); MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.jamesssystems.swiftapp; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = swiftapp; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; }; @@ -472,7 +472,7 @@ ); MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.jamesssystems.swiftapp; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = swiftapp; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; }; diff --git a/swiftapp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/swiftapp.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 919434a..0b305e6 100644 --- a/swiftapp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/swiftapp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:/Users/jwilson/Desktop/swiftapp/swiftapp.xcodeproj"> diff --git a/swiftapp/ContentView.swift b/swiftapp/ContentView.swift index f5ce098..fa46a41 100644 --- a/swiftapp/ContentView.swift +++ b/swiftapp/ContentView.swift @@ -185,6 +185,7 @@ struct ContentView: View { struct Login: View { @State var title: String = "" @State var cont: String = "" + @State var savestr: String = "" @State var currentNote: Note = Note(noteid: "n/a", title: "n/a", contents: "n/a") @EnvironmentObject private var current_data: CurrentApp var body: some View { @@ -210,6 +211,8 @@ struct Login: View { handleSave() } .padding(.bottom, 70) + Text(savestr) + .padding(.bottom, 70) } .frame(width: 500, height: 500, alignment: .topLeading) .padding(.bottom, 80) @@ -235,10 +238,20 @@ struct Login: View { cont = "" currentNote = Note(noteid: "n/a", title: "", contents: "") } + func setStr(text: String) { + savestr = text + DispatchQueue.main.asyncAfter(deadline: .now() + 4) { + if (savestr == text) { + savestr = "" + } + } + } func handleSave() { if(currentNote.noteid == "n/a") { + setStr(text: "Saving new note...") newNote(note: Note(noteid: "n/a", title: title, contents: cont)) } else { + setStr(text: "Saving note...") updateNote(note: Note(noteid: currentNote.noteid, title: title, contents: cont)) } } @@ -247,7 +260,9 @@ struct Login: View { if(ret["status"] as! Int == 201) { current_data.all_notes.append(Note(noteid: ret["note_id"] as! String, title: note.title, contents: note.contents)) currentNote = Note(noteid: ret["note_id"] as! String, title: note.title, contents: note.contents) + setStr(text: "Created new note!") } else { + setStr(text: "New note creation failed!") print(ret) print("the funny occurred!!! (unable to make new note)") } @@ -260,7 +275,9 @@ struct Login: View { } current_data.all_notes.append(Note(noteid: note.noteid, title: note.title, contents: note.contents)) currentNote = Note(noteid: note.noteid, title: note.title, contents: note.contents) + setStr(text: "Saved note!") } else { + setStr(text: "Unable to save note!") print("the funny occurred!!! (unable to update note)") } }