Good afternoon! I have a task, I need to do navigation (When I tap a cell, I navigate to another controller that contains the album list , then When I tap an album, I navigate to another controller that contains the list of images. I do not know what the error is? Thank you ! My Json is http://appscorporation.ga/api-user/test
I created struct.
struct ProfileElement: Decodable {
let user: User
let postImage: String
let postLikes: Int
let postTags: String
}
struct User: Decodable {
let name, surname: String
let profilePic: String
let albums: [Album]
}
struct Album : Decodable {
let id: Int
let title: String
var images: [Image]
}
struct Image: Decodable {
let id: Int
let url: String
}
I decoded by this code
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let result = try decoder.decode([ProfileElement].self, from: data)
I was advised to receive image data with
for item in result {
for album in item.user.albums {
for image in album.images {
print(image)
}
}
}
But unfortunately, I did not understand how I use data acquisition, then transfer and use them to other controllers. Help me please. My project in GitHub https://github.com/VladimirRebricov/TestProject