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

Transition from MailMan.LoadXmlEmailString to Email.SetFromXmlText

Provides instructions for replacing deprecated LoadXmlEmailString method calls with Email.SetFromXmlText.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let mailman = CkoMailMan()!

    //  ...
    //  ...

    var xmlStr: String? = "..."

    //  ------------------------------------------------------------------------
    //  The LoadXmlEmailString method is deprecated:

    var emailObj: CkoEmail? = mailman.loadXmlEmailString(xmlString: xmlStr)
    if mailman.lastMethodSuccess == false {
        print("\(mailman.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    emailObj = nil

    //  ------------------------------------------------------------------------
    //  Do the equivalent using Email.SetFromXmlText.

    let email = CkoEmail()!
    success = email.set(fromXmlText: xmlStr)
    if success == false {
        print("\(email.lastErrorText!)")
        return
    }


}