Post

Replies

Boosts

Views

Activity

Reply to Data transfer with API
I fixed it struct PatientDetail: View { private let patient: HastaViewModel var body: some View {  VStack {       Form {         Section(header: Text("Kişisel Bilgiler")) {           Text("\(patient.ad)")           Text("\(patient.soyad)")           Text("\(patient.phone)")           Text("\(patient.email)")           Text("\(patient.dogumyili)")           Text("\(patient.ulke)")           Text("\(patient.sehir)")           Text("\(patient.ilce)")           Text("\(patient.adres)")           Text("\(patient.tcno)")         }       } } } So that you only show one user/patient instead of a list of users. And then call it from the main view like List { ForEach(patientVM.hastalar, id: \.id){ patient in NavigationLink { PatientDetail(patient: patient) } label: { VStack(alignment: .leading) { Text(patient.ad) Text(patient.email).font(.caption).foregroundColor(.gray) } }
Jun ’22
Reply to [NSJSONSerialization dataWithJSONObject:options:error:]: Invalid top-level type in JSON write
By response, I mean, for example, for if I request a user's info, then the server should give me a response of the user's info or a response of why the server refuses/fail to get the user's info. So you need to know what response the server gives when the registry is complete. And then you can parse it into an object that we can use in the app using JSONDecoder. (e.g. parse from data to a user's info. Data -> UserInfo)
Jun ’22