Post

Replies

Boosts

Views

Activity

Failed to produce diagnostic for expression
// Unsure why this error is occuring. Can someone please asist struct CustomiseUserType: View { @State private var isInfoVisible = false @State private var showBusinessSetUpView = false @State private var showPersonalSetUpView = false @State private var selectedImage: UIImage? = nil @State private var isImagePickerPresented = false @ObservedObject private var viewModel = SignUpViewModel() @ObservedObject private var userAccount = UserAccount() let sandColor = Color(red: 240/255, green: 195/255, blue: 160/255) var body: some View { ScrollView { VStack { Button(action: { isImagePickerPresented.toggle() }) { if let selectedImage = selectedImage { Image(uiImage: selectedImage) .resizable() .scaledToFill() .frame(width: 140, height: 140) .clipShape(Circle()) .padding() } else { Image(systemName: "person.circle.fill") .resizable() .scaledToFill() .frame(width: 140, height: 140) .foregroundColor(Color(sandColor)) .clipShape(Circle()) .padding() } } .sheet(isPresented: $isImagePickerPresented, onDismiss: loadImage) { ImagePicker(userAccount: userAccount) } Text("HAVEN") .font(.largeTitle) .foregroundColor(Color.black.opacity(0.8)) .multilineTextAlignment(.center) .dynamicTypeSize(.xxxLarge) .bold() Text("OK EVERYDAY") .font(.headline) .foregroundColor(Color.black.opacity(0.8)) .multilineTextAlignment(.center) .dynamicTypeSize(.medium) VStack(alignment: .leading, spacing: 16) { Text("\n") Text("Long Term Goals") .font(.headline) TextField("Enter your long term goals", text: $userAccount.longTermGoals?) .textFieldStyle(DefaultTextFieldStyle()) .frame(maxWidth: .infinity) .frame(height: .infinity) .lineLimit(4) VStack{Divider()} Text("Profile Biography") .font(.headline) TextField("Enter your profile bio", text: userAccount.biography) .textFieldStyle(DefaultTextFieldStyle()) .frame(maxWidth: .infinity) .lineLimit(2) VStack{Divider()} VStack { Text("Haven Profile Type") .font(.headline) .multilineTextAlignment(.center) HStack { Button(action: { withAnimation { self.showBusinessSetUpView.toggle() } }) { Text("Business") .foregroundColor(.white) .padding() .frame(width: 150) .background(Color.teal) .cornerRadius(10) } Spacer() .sheet(isPresented: $showBusinessSetUpView) { BusinessSetUpView(userAccount: $userAccount) } Button(action: { withAnimation { viewModel.reset() self.showPersonalSetUpView.toggle() } }) { Text("Personal") .foregroundColor(.white) .padding() .frame(width: 150) .background(Color(sandColor)) .cornerRadius(10) } .sheet(isPresented: $showPersonalSetUpView) { // PersonalSetUpView(PersonalUser: personalUser) } } .padding() } InfoButton { isInfoVisible.toggle() } .overlay( VStack { if isInfoVisible { Text("Business profile limits visibility of survey settings to the super user only") .multilineTextAlignment(.center) .background(Color.white.opacity(0.9)) .cornerRadius(10) Button(action: { withAnimation { isInfoVisible = false } }) { Text("Close") .foregroundColor(.white) .padding() .frame(width: 75) .background(Color.teal.opacity(0.7)) .cornerRadius(10) } } } ) } } } .padding() } private func loadImage() { userAccount.profilePicture = selectedImage } }
0
0
316
Feb ’24