I'm still getting:
Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "user", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: "updatedAt", intValue: nil) ("updatedAt").", underlyingError: nil))
Response data: {"user":{"id":2,"client_id":1,"first_name":"John","last_name":"Biddulph","email":"John.***[at]gmail.com","email_verified_at":null,"image":"1690027187.jpeg","location":null,"description":"Artist","created_at":"2023-07-22T10:51:57.000000Z","updated_at":"2023-07-22T11:59:47.000000Z","stripe_id":"cus_OJFvSSUgRbDTIi","pm_type":null,"pm_last_four":null,"trial_ends_at":null},"token":"46|ZZZjWGOQusPzsv5AA8yCmUpndoDikZha7F0lspe2"}
YAY thanks, no errors now apart from when I log in.
Error parsing response data: keyNotFound(CodingKeys(stringValue: "client_id", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "user", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: "client_id", intValue: nil) ("client_id").", underlyingError: nil))
Post not yet marked as solved
is anyone able to help me out here please?
Post not yet marked as solved
My new View has lots of errors in
import SwiftUI
import Firebase
struct FavouritesListView: View {
func getUsersFavourites() {
var user = FirebaseManager.shared.auth.currentUser
let data = FirebaseManager.shared.firestore.collection("favourites").where("uid", "==", user?.uid).get()
print(data)
}
var body: some View {
self.getUsersFavourites()
}
}
struct FavouritesListView_Previews: PreviewProvider {
static var previews: some View {
FavouritesListView()
}
}
Type '()' cannot conform to 'View'
ok so I created a separate view but now I am getting
Cannot find type 'artwork' in scope
on this line:
public func storeFaveArtwork(artwork) {
here is my view:
//
// SizePriceView.swift
// MBiddulph (iOS)
//
// Created by J** B****** on 05/06/2022.
//
import SwiftUI
struct SizePriceView: View {
let artwork: Artwork
var body: some View {
HStack(spacing: 2) {
if (artwork.size != nil) {
Text(artwork.size)
.padding(4)
.font(.caption)
.background(Color.gray.opacity(0.2))
.cornerRadius(5)
.foregroundColor(Color.gray)
.frame(height: 25, alignment: .center)
.frame(maxWidth: .infinity)
}
if (artwork.price != 0) {
Text("£\(artwork.price)")
.fontWeight(.bold)
.padding(4)
.font(.caption)
.background(Color.green)
.cornerRadius(5)
.foregroundColor(Color.white)
.frame(width: .infinity)
}
Button {
storeFaveArtwork(artwork: artwork)
} label: {
HStack {
Spacer()
Text("Favourite")
.foregroundColor(.white)
.padding(.vertical, 10)
.font(.system(size: 14, weight: .semibold))
Spacer()
}.background(Color.blue)
}
Spacer()
.frame(width: 0.0, height: 60.0)
}
public func storeFaveArtwork(artwork) {
guard let uid = FirebaseManager.shared.auth.currentUser?.uid else {
return
}
let artData = ["id": artwork.id as Any, "uid": uid] as [String : Any]
FirebaseManager.shared.firestore.collection("favourites")
.document(uid).setData(artData) { err in
if let err = err {
print(err)
return
}
print("Success")
}
}
}
}
So I tried a separate view, that didn't work, I still get:
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
how would it know what 'artwork ' is too?!
Post not yet marked as solved
I'm all confused, I moved the the ViewAllArtwork to the same folder and called viewAllArtwork() - still the same
Post not yet marked as solved
Artwork
import Foundation
import SwiftUI
struct Artwork: Hashable, Codable {
var size: String!
var title: String!
var file: String!
}
I get the following in browser but nothing in XCODE, how to debug?!:
{"id":11,"title":"NO NAME NO TITLE JUSTBORN","size":"806 X 1106 mm","category":"1","file":"1565686961MELV0011.jpg","artistNotes":"The painting is about the anguish of woman in post birth. She is of no nationality. Her hands (over large) and protective. Her belly still distended from the birth.","price":0,"isfeatured":0,"islive":1,"created_at":"2018-09-05T00:00:00.000000Z","updated_at":"2019-08-13T10:02:41.000000Z"}