Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return cities.count
- }
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: "Cell")
- cell.textLabel?.text = "In (cities[indexPath.row]) it's (cities.description + Calendar.Component.hour)"
- return cell
- }
- let cities:[String:Int] = ["Rome": +1 ,"London": 0, "Los Angeles" : -8, "Seul" : +9,"Honolulu": -10, "Pechino" : +8, "Il Cairo": +2, "Tokyo" : +9]
- override func viewDidLoad() {
- super.viewDidLoad()
- //Takes the date from the device
- let date = Date()
- let formatter = DateFormatter()
- formatter.dateFormat = "dd.MM.yyyy"
- let result = formatter.date(from: "date")
- //Takes the time from the device
- var calendar = Calendar.current
- var hour = calendar.component(.hour, from: date)
- var minutes = calendar.component(.minute, from: date)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement