Hi I'm having an issue with parsing.
When I try to parse this JSON in my tableviewcell and can't get the values that I need.
My request:
let videos = NewestVideos()
let URL = "https://api.vid.me/channel/1/new"
override func viewDidLoad() {
super.viewDidLoad()
Alamofire.request(.GET, self.URL).responseObject { (response: Response<NewestVideos, NSError>) in
switch response.result {
case .Success(self.videos):
print("")
case .Failure(let error):
print("Request failed with error: \(error)")
}
}
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath) as! NewTableViewCell
cell.newVideoNameLabel.text = resultr
return cell
}
How do I get values in tableviewcell, and make the correct request?
My mapping via ObjectMapper:
class Videos: Mappable {
var embedUrl: String?
var title: String?
required init?(_ map: Map){
}
func mapping(map: Map) {
embedUrl <- map["embed_url"]
title <- map["title"]
}
}
class NewestVideos: Mappable {
var videos: [Videos]? = []
required init?(_ map: Map){
}
func mapping(map: Map) {
videos <- map["videos"]
}
}