Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DetailView.swift
- // HomeMed
- //
- // Created by Joao Boavida on 10/12/2018.
- // Copyright © 2018 Joao Boavida. All rights reserved.
- //
- import UIKit
- class DetailView: UIViewController {
- @IBOutlet var nameLbl: UILabel!
- @IBOutlet var subtextLbl: UILabel!
- @IBOutlet var expdateLbl: UILabel!
- }
- override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- let medicine = medArray[indexPath.row]
- if let vc = storyboard?.instantiateViewController(withIdentifier: "DetailView") as? DetailView {
- vc.nameLbl.text = medicine.name
- if let subtext = medicine.subtext {
- vc.subtextLbl.text = subtext
- } else {
- vc.subtextLbl.text = ""
- }
- let ISOdateFormatter = ISO8601DateFormatter()
- ISOdateFormatter.formatOptions = [.withMonth, .withYear, .withDashSeparatorInDate]
- vc.expdateLbl.text = "Exp: (ISOdateFormatter.string(from: medicine.expiry))"
- navigationController?.pushViewController(vc, animated: true)
- }
- }
Add Comment
Please, Sign In to add comment