Edited at

fetch from NSURL

More than 1 year has passed since last update.

/ * sample

var videos: [Video] = {
var kanyeChannel = Channel()
kanyeChannel.name = "TTT"
kanyeChannel.profileImageName = "TTTTT"

var tmpVideo = Video()
tmpVideo.title = "fafds"
tmpVideo.thumbnailImageName = "spdka"
tmpVideo.channel = kanyeChannel
tmpVideo.numberOfViews = 3232

var ttVideo = Video()
ttVideo.title = "aaaaaaaa"
ttVideo.thumbnailImageName = "fffffff"
ttVideo.channel = kanyeChannel
ttVideo.numberOfViews = 3434343

return [tmpVideo, ttVideo]
}()
*/

var videos: [Video]?

func fetchVideos() {
let url = NSURL(string:"https://....../home.json")
NSURLSession.sharedSession().dataTaskWithURL(url!) { (data, response, error) in
if error != nil {
print(error)
}

do {
let json = NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers)

self.videos = [Video]()
for dictionary in json as! [[String: AnyObject]] {
let video = Video()
video.title = dictionary["title"] as? String
....
let channelDictionary = dictionary["channel"] as! [String: Anyobject]
let channel = Channel()
cannel.name = channelDictionary["name"] as? String
video.channel = channel
videos?.append(video)
}
self.collectionView?.reloadData()
//print(json)

} catch let jsonError {
print(jsonError)
}

}.resume()
}

collectionView numberOfItemsInSection..
return videos?.count ?? 0