Sample code for 30+ languages & platforms
Swift Requires Chilkat v11.0.0+

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let cert = CkoCert()!

    //  ------------------------------------------------------------------------
    //  The ExportPublicKey method is deprecated:

    var publickeyObj: CkoPublicKey? = cert.exportPublicKey()
    if cert.lastMethodSuccess == false {
        print("\(cert.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    publickeyObj = nil

    //  ------------------------------------------------------------------------
    //  Do the equivalent using GetPublicKey.
    //  Your application creates a new, empty PublicKey object which is passed 
    //  in the last argument and filled upon success.

    let publickeyOut = CkoPublicKey()!
    success = cert.getPublicKey(pubKey: publickeyOut)
    if success == false {
        print("\(cert.lastErrorText!)")
        return
    }


}