forked from NikantVohra/HackerNewsClient-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserProfileViewController.swift
More file actions
62 lines (44 loc) · 1.72 KB
/
UserProfileViewController.swift
File metadata and controls
62 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// UserProfileViewController.swift
// HackerNews
//
// Created by Vohra, Nikant on 03/04/15.
// Copyright (c) 2015 Vohra, Nikant. All rights reserved.
//
import UIKit
class UserProfileViewController : UIViewController {
//@IBOutlet weak var scrollView: UIScrollView!
//@IBOutlet weak var contentView: UIView!
var userName: String! = "jl"
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var karmaLabel: UILabel!
@IBOutlet weak var averageLabel: UILabel!
@IBOutlet weak var aboutLabel: UILabel!
@IBOutlet weak var averageTextLabel: UILabel!
@IBOutlet weak var karmaTextLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
self.nameLabel.text = ""
self.karmaLabel.text = ""
self.averageLabel.text = ""
self.aboutLabel.text = ""
self.karmaTextLabel.text = ""
self.averageTextLabel.text = ""
// Do any additional setup after loading the view, typically from a nib.
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
view.showLoading()
HNService.getUser(userName, response: { (userJSON) -> () in
self.view.hideLoading()
self.nameLabel.text = userJSON["id"].string ?? ""
self.karmaLabel.text = String(userJSON["karma"].int!);
self.averageLabel.text = String(userJSON["karma"].int! / (userJSON["submitted"].count))
self.aboutLabel.text = userJSON["about"].string ?? ""
self.karmaTextLabel.text = "karma"
self.averageTextLabel.text = "avg"
})
}
override func viewDidAppear(animated: Bool) {
}
}