我的初始化器没有 工作。如果我只是从初始化程序中删除图像,则初始化程序会工作
met-a-pet-812ca
publications:
age:
breed:
city:
color:
currentUser:
description:
gender:
images
0:
1:
2:
3:
name:
region:
type:
init?(snapshot: DataSnapshot){
guard
let value = snapshot.value as? [String: AnyObject],
let imagesAll0 = value["images"]!["0"] as? String,
let imagesAll1 = value["images"]!["1"] as? String,
let imagesAll2 = value["images"]!["2"] as? String,
let imagesAll3 = value["images"]!["3"] as? String,
let type = value["type"] as? String,
let name = value["name"] as? String,
let gender = value["gender"] as? String,
let breed = value["breed"] as? String,
let color = value["color"] as? String,
let region = value["region"] as? String,
let city = value["city"] as? String,
let age = value["age"] as? String,
let description = value["description"] as? String,
let currentUser = value["currentUser"] as? String
else {return nil}
self.type = type
self.name = name
self.gender = gender
self.breed = breed
self.color = color
self.region = region
self.city = city
self.age = age
self.description = description
self.imagesAnimal = ([imagesAll0,imagesAll1,imagesAll2,imagesAll3] as! [String])
self.currentUser = currentUser
}