SingleContactViewController.swift 1.04 KB
Newer Older
Javier Heisekce committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
//
//  SingleContactViewController.swift
//  ContactsApp
//
//  Created by User on 3/13/20.
//  Copyright © 2020 jheisecke. All rights reserved.
//

import UIKit
import ContactsUI

class SingleContactViewController: UIViewController {
    
    @IBOutlet weak var contactFullname: UILabel!
    var selectedContact : CNContact?
    @IBOutlet weak var profilePic: UIImageView!
    @IBOutlet weak var phoneNumber: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        if let contact = selectedContact{
            title = "\(contact.givenName) \(contact.familyName)"
            contactFullname.text = "\(contact.givenName) \(contact.familyName)"
24
            //phoneNumber.text = CNLabeledValue.localizedStringForLabel(contact.phoneNumbers)
Javier Heisekce committed
25 26 27 28 29 30 31 32 33 34 35 36 37
            
            if contact.imageDataAvailable {
                if let image = contact.imageData {
                    if let imageData = UIImage(data: image){
                        profilePic.image = imageData
                    }
                }
            }

        }
    }

}