Minor changes to the NewFeedEntryView; fixed some other classes because of compile errors

This commit is contained in:
severin.memmishofer
2023-07-10 17:49:42 +02:00
parent 1f664b4250
commit 988dca5ff1
6 changed files with 30 additions and 16 deletions

View File

@@ -9,11 +9,11 @@ import Foundation
struct Body: Codable {
let tag: Apps
let tag: String
let value: String
init(tag: Apps = Apps.txt, value: String = "") {
self.tag = tag
self.tag = tag.description
self.value = value
}
}
@@ -21,4 +21,11 @@ struct Body: Codable {
enum Apps: Codable {
case nam
case txt
var description : String {
switch self {
case .nam: return "nam"
case .txt: return "txt"
}
}
}

View File

@@ -21,7 +21,6 @@ struct ContentView: View {
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
Spacer()
Button("Save Feed") {
Task {
do {
@@ -36,12 +35,14 @@ struct ContentView: View {
}
}
.padding()
NavigationView {
List(bluetoothViewModel.peripheralNames, id: \.self) { peripheral in
Text(peripheral)
}
.navigationTitle("Peripherals")
}
Spacer()
NewFeedEntryView()
// NavigationView {
// List(bluetoothViewModel.peripheralNames, id: \.self) { peripheral in
// Text(peripheral)
// }
// .navigationTitle("Peripherals")
// }
}

View File

@@ -9,7 +9,7 @@ import SwiftUI
@main
struct RippleChatApp: App {
@State private var currentView: CurrentView = CurrentView.feeds
//@State private var currentView: CurrentView = CurrentView.feeds
var body: some Scene {
WindowGroup {

View File

@@ -8,7 +8,7 @@
import SwiftUI
struct FeedListView: View {
@State var feeds: [Feed]
var body: some View {
Text("FeedListView")
@@ -17,6 +17,6 @@ struct FeedListView: View {
struct FeedListView_Previews: PreviewProvider {
static var previews: some View {
FeedListView()
FeedListView(feeds: [])
}
}

View File

@@ -8,13 +8,19 @@
import SwiftUI
struct NewFeedEntryView: View {
@State private var name: String = "Alice"
@State private var newEntry: String = ""
var body: some View {
VStack(alignment: .leading) {
TextField("Enter your name", text: $name)
Text("Hello, \(name)!")
HStack {
TextField("Enter your new feed message:", text: $newEntry)
Button(action: {}) {
Text("Send")
}
}
Text("New entry: \(newEntry)")
}
.padding()
}
}