{"action":"created","comment":{"url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/comments/74365787","id":74365787,"diff_hunk":"@@ -7,25 +7,57 @@\n //\n \n import UIKit\n+import RealmSwift\n \n class ContentViewController: BaseViewController {\n \n     @IBOutlet weak private var contentTableView: UITableView!\n     var pageIndex = 0\n+    var pageId = \"\"\n+    private var dataOfVideo: Results<Video>?\n     override func viewDidLoad() {\n         super.viewDidLoad()\n     }\n \n     override func didReceiveMemoryWarning() {\n         super.didReceiveMemoryWarning()\n     }\n+    // MARK:- Set Up UI\n+    override func setUpUI() {\n+        self.configureContentViewCOntroller()\n+    }\n+    // MARK:- Set Up Data\n+    override func setUpData() {\n+        if let videos = Video.getVideos(pageId) where videos.count > 0 {\n+            dataOfVideo = videos\n+            print(dataOfVideo)\n+            loadData()\n+        } else {\n+            loadVideos(pageId, pageToken: \"\")\n+        }\n+    }\n     // MARK:- Register Cell\n     private func configureContentViewCOntroller() {\n         self.contentTableView.registerNib(HomeCell)\n     }\n-    // MARK:- Set Up UI\n-    override func setUpUI() {\n-        self.configureContentViewCOntroller()\n+    // MARK:- Load Data\n+    func loadData() {\n+        do {\n+            let realm = try Realm()\n+            dataOfVideo = realm.objects(Video).filter(\"idCategory = '\\(pageId)'\")\n+            self.contentTableView.reloadData()\n+        } catch let error as NSError {\n+            print(error.localizedDescription)\n+        }\n+    }\n+    private func loadVideos(id: String, pageToken: String) {\n+        MyVideo.loadDataFromAPI({ (success, error) in\n+            if success {\n+                self.loadData()\n+            } else {\n+                print(\"load video fail\")","path":"YouTube/Classes/ViewControllers/ContentViewController/ContentViewController.swift","position":55,"original_position":55,"commit_id":"3e64c4f3e6fdf0d68b3648d51ed87d2a765226b7","original_commit_id":"3e64c4f3e6fdf0d68b3648d51ed87d2a765226b7","user":{"login":"at-phuongvnc","id":11311613,"avatar_url":"https://avatars.githubusercontent.com/u/11311613?v=3","gravatar_id":"","url":"https://api.github.com/users/at-phuongvnc","html_url":"https://github.com/at-phuongvnc","followers_url":"https://api.github.com/users/at-phuongvnc/followers","following_url":"https://api.github.com/users/at-phuongvnc/following{/other_user}","gists_url":"https://api.github.com/users/at-phuongvnc/gists{/gist_id}","starred_url":"https://api.github.com/users/at-phuongvnc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-phuongvnc/subscriptions","organizations_url":"https://api.github.com/users/at-phuongvnc/orgs","repos_url":"https://api.github.com/users/at-phuongvnc/repos","events_url":"https://api.github.com/users/at-phuongvnc/events{/privacy}","received_events_url":"https://api.github.com/users/at-phuongvnc/received_events","type":"User","site_admin":false},"body":"remove `print`","created_at":"2016-08-11T03:45:05Z","updated_at":"2016-08-11T03:45:05Z","html_url":"https://github.com/DuyTang/at_duytd_YouTube/pull/2#discussion_r74365787","pull_request_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/comments/74365787"},"html":{"href":"https://github.com/DuyTang/at_duytd_YouTube/pull/2#discussion_r74365787"},"pull_request":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2","id":80747060,"html_url":"https://github.com/DuyTang/at_duytd_YouTube/pull/2","diff_url":"https://github.com/DuyTang/at_duytd_YouTube/pull/2.diff","patch_url":"https://github.com/DuyTang/at_duytd_YouTube/pull/2.patch","issue_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/2","number":2,"state":"open","locked":false,"title":"Feature/home data","user":{"login":"DuyTang","id":16666508,"avatar_url":"https://avatars.githubusercontent.com/u/16666508?v=3","gravatar_id":"","url":"https://api.github.com/users/DuyTang","html_url":"https://github.com/DuyTang","followers_url":"https://api.github.com/users/DuyTang/followers","following_url":"https://api.github.com/users/DuyTang/following{/other_user}","gists_url":"https://api.github.com/users/DuyTang/gists{/gist_id}","starred_url":"https://api.github.com/users/DuyTang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DuyTang/subscriptions","organizations_url":"https://api.github.com/users/DuyTang/orgs","repos_url":"https://api.github.com/users/DuyTang/repos","events_url":"https://api.github.com/users/DuyTang/events{/privacy}","received_events_url":"https://api.github.com/users/DuyTang/received_events","type":"User","site_admin":false},"body":"Load data to HomeViewController, DetailVideoViewController","created_at":"2016-08-10T07:33:17Z","updated_at":"2016-08-11T03:45:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1f95f2504de642256f586d60049a8196070ef77","assignee":{"login":"at-phuongvnc","id":11311613,"avatar_url":"https://avatars.githubusercontent.com/u/11311613?v=3","gravatar_id":"","url":"https://api.github.com/users/at-phuongvnc","html_url":"https://github.com/at-phuongvnc","followers_url":"https://api.github.com/users/at-phuongvnc/followers","following_url":"https://api.github.com/users/at-phuongvnc/following{/other_user}","gists_url":"https://api.github.com/users/at-phuongvnc/gists{/gist_id}","starred_url":"https://api.github.com/users/at-phuongvnc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-phuongvnc/subscriptions","organizations_url":"https://api.github.com/users/at-phuongvnc/orgs","repos_url":"https://api.github.com/users/at-phuongvnc/repos","events_url":"https://api.github.com/users/at-phuongvnc/events{/privacy}","received_events_url":"https://api.github.com/users/at-phuongvnc/received_events","type":"User","site_admin":false},"assignees":[{"login":"at-phuongvnc","id":11311613,"avatar_url":"https://avatars.githubusercontent.com/u/11311613?v=3","gravatar_id":"","url":"https://api.github.com/users/at-phuongvnc","html_url":"https://github.com/at-phuongvnc","followers_url":"https://api.github.com/users/at-phuongvnc/followers","following_url":"https://api.github.com/users/at-phuongvnc/following{/other_user}","gists_url":"https://api.github.com/users/at-phuongvnc/gists{/gist_id}","starred_url":"https://api.github.com/users/at-phuongvnc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-phuongvnc/subscriptions","organizations_url":"https://api.github.com/users/at-phuongvnc/orgs","repos_url":"https://api.github.com/users/at-phuongvnc/repos","events_url":"https://api.github.com/users/at-phuongvnc/events{/privacy}","received_events_url":"https://api.github.com/users/at-phuongvnc/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2/commits","review_comments_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2/comments","review_comment_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/2/comments","statuses_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/statuses/3e64c4f3e6fdf0d68b3648d51ed87d2a765226b7","head":{"label":"DuyTang:feature/home-data","ref":"feature/home-data","sha":"3e64c4f3e6fdf0d68b3648d51ed87d2a765226b7","user":{"login":"DuyTang","id":16666508,"avatar_url":"https://avatars.githubusercontent.com/u/16666508?v=3","gravatar_id":"","url":"https://api.github.com/users/DuyTang","html_url":"https://github.com/DuyTang","followers_url":"https://api.github.com/users/DuyTang/followers","following_url":"https://api.github.com/users/DuyTang/following{/other_user}","gists_url":"https://api.github.com/users/DuyTang/gists{/gist_id}","starred_url":"https://api.github.com/users/DuyTang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DuyTang/subscriptions","organizations_url":"https://api.github.com/users/DuyTang/orgs","repos_url":"https://api.github.com/users/DuyTang/repos","events_url":"https://api.github.com/users/DuyTang/events{/privacy}","received_events_url":"https://api.github.com/users/DuyTang/received_events","type":"User","site_admin":false},"repo":{"id":65033512,"name":"at_duytd_YouTube","full_name":"DuyTang/at_duytd_YouTube","owner":{"login":"DuyTang","id":16666508,"avatar_url":"https://avatars.githubusercontent.com/u/16666508?v=3","gravatar_id":"","url":"https://api.github.com/users/DuyTang","html_url":"https://github.com/DuyTang","followers_url":"https://api.github.com/users/DuyTang/followers","following_url":"https://api.github.com/users/DuyTang/following{/other_user}","gists_url":"https://api.github.com/users/DuyTang/gists{/gist_id}","starred_url":"https://api.github.com/users/DuyTang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DuyTang/subscriptions","organizations_url":"https://api.github.com/users/DuyTang/orgs","repos_url":"https://api.github.com/users/DuyTang/repos","events_url":"https://api.github.com/users/DuyTang/events{/privacy}","received_events_url":"https://api.github.com/users/DuyTang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DuyTang/at_duytd_YouTube","description":null,"fork":false,"url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube","forks_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/forks","keys_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/teams","hooks_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/hooks","issue_events_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/events{/number}","events_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/events","assignees_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/assignees{/user}","branches_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/branches{/branch}","tags_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/tags","blobs_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/refs{/sha}","trees_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/statuses/{sha}","languages_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/languages","stargazers_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/stargazers","contributors_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/contributors","subscribers_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/subscribers","subscription_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/subscription","commits_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/commits{/sha}","git_commits_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/commits{/sha}","comments_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/comments{/number}","issue_comment_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/comments{/number}","contents_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/contents/{+path}","compare_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/merges","archive_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/downloads","issues_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues{/number}","pulls_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls{/number}","milestones_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/milestones{/number}","notifications_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/labels{/name}","releases_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/releases{/id}","deployments_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/deployments","created_at":"2016-08-05T16:32:23Z","updated_at":"2016-08-10T01:48:10Z","pushed_at":"2016-08-10T10:08:51Z","git_url":"git://github.com/DuyTang/at_duytd_YouTube.git","ssh_url":"git@github.com:DuyTang/at_duytd_YouTube.git","clone_url":"https://github.com/DuyTang/at_duytd_YouTube.git","svn_url":"https://github.com/DuyTang/at_duytd_YouTube","homepage":null,"size":138,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"DuyTang:master","ref":"master","sha":"2affad1b4d5532c7af57cffeaa6bd6c597b7447a","user":{"login":"DuyTang","id":16666508,"avatar_url":"https://avatars.githubusercontent.com/u/16666508?v=3","gravatar_id":"","url":"https://api.github.com/users/DuyTang","html_url":"https://github.com/DuyTang","followers_url":"https://api.github.com/users/DuyTang/followers","following_url":"https://api.github.com/users/DuyTang/following{/other_user}","gists_url":"https://api.github.com/users/DuyTang/gists{/gist_id}","starred_url":"https://api.github.com/users/DuyTang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DuyTang/subscriptions","organizations_url":"https://api.github.com/users/DuyTang/orgs","repos_url":"https://api.github.com/users/DuyTang/repos","events_url":"https://api.github.com/users/DuyTang/events{/privacy}","received_events_url":"https://api.github.com/users/DuyTang/received_events","type":"User","site_admin":false},"repo":{"id":65033512,"name":"at_duytd_YouTube","full_name":"DuyTang/at_duytd_YouTube","owner":{"login":"DuyTang","id":16666508,"avatar_url":"https://avatars.githubusercontent.com/u/16666508?v=3","gravatar_id":"","url":"https://api.github.com/users/DuyTang","html_url":"https://github.com/DuyTang","followers_url":"https://api.github.com/users/DuyTang/followers","following_url":"https://api.github.com/users/DuyTang/following{/other_user}","gists_url":"https://api.github.com/users/DuyTang/gists{/gist_id}","starred_url":"https://api.github.com/users/DuyTang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DuyTang/subscriptions","organizations_url":"https://api.github.com/users/DuyTang/orgs","repos_url":"https://api.github.com/users/DuyTang/repos","events_url":"https://api.github.com/users/DuyTang/events{/privacy}","received_events_url":"https://api.github.com/users/DuyTang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DuyTang/at_duytd_YouTube","description":null,"fork":false,"url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube","forks_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/forks","keys_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/teams","hooks_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/hooks","issue_events_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/events{/number}","events_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/events","assignees_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/assignees{/user}","branches_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/branches{/branch}","tags_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/tags","blobs_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/refs{/sha}","trees_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/statuses/{sha}","languages_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/languages","stargazers_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/stargazers","contributors_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/contributors","subscribers_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/subscribers","subscription_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/subscription","commits_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/commits{/sha}","git_commits_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/git/commits{/sha}","comments_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/comments{/number}","issue_comment_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/comments{/number}","contents_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/contents/{+path}","compare_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/merges","archive_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/downloads","issues_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues{/number}","pulls_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls{/number}","milestones_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/milestones{/number}","notifications_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/labels{/name}","releases_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/releases{/id}","deployments_url":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/deployments","created_at":"2016-08-05T16:32:23Z","updated_at":"2016-08-10T01:48:10Z","pushed_at":"2016-08-10T10:08:51Z","git_url":"git://github.com/DuyTang/at_duytd_YouTube.git","ssh_url":"git@github.com:DuyTang/at_duytd_YouTube.git","clone_url":"https://github.com/DuyTang/at_duytd_YouTube.git","svn_url":"https://github.com/DuyTang/at_duytd_YouTube","homepage":null,"size":138,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2"},"html":{"href":"https://github.com/DuyTang/at_duytd_YouTube/pull/2"},"issue":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/2"},"comments":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/DuyTang/at_duytd_YouTube/statuses/3e64c4f3e6fdf0d68b3648d51ed87d2a765226b7"}}}}
{"actor":{"display_login":"at-phuongvnc"}}