title: CallKit with Swift
body: <p>I have developed an app using the <code>CoreTelephony</code> framework to detect changes in the phone status that works beautifully.  The generic form of the Swift code (leveraged from another <code>StackOverflow</code> answer) is:</p>
  
  <pre><code>import CoreTelephony
  
  class SomeClass: UIViewController {
  
      private var callCenter = CTCallCenter()
  
      override func viewDidLoad() {
         super.viewDidLoad()
  
         callCenter.callEventHandler = { (call:CTCall!) in
  
             switch call.callState {
                 case CTCallStateConnected:
                      println("CTCallStateConnected")
                     self.callConnected()
                 case CTCallStateDisconnected:
                     println("CTCallStateDisconnected")
                     self.callDisconnected()
                 default:
                 //Not concerned with CTCallStateDialing or CTCallStateIncoming
                     break
             }
         }
     }
  
     func callConnected(){
         // Do something when call connects
     }
  
     func callDisconnected() {
         // Do something when call disconnects
     }
  }
  </code></pre>
  
  <p>As the <code>CoreTelephony</code> framework has been largely deprecated and been replaced by the <code>CallKit</code> framework, I would like to replace this code with the equivalent <code>CallKit</code> framework Swift code.  I have tried to use my limited knowledge to do this, but I not been successful.</p>
  
  <p>Any help would be gratefully appreciated.</p>
  
  <p>Thanks in advance.</p>