I am working on an app that has an email form which holds all the usual contact information.
I need to be able to format the email body with that information. I have done it successfully in the Android sister app, but I can't find how to achieve it in Swift.
String message = "Name: " + txtFullName.getText().toString() + "\n" + "Street: " + txtStreet.getText().toString() + "\n" + "Suburb: " + txtSuburb.getText().toString() + "\n" + "State: " + spState.getSelectedItem().toString() + ", Post Code: " + txtPostCode.getText().toString() + "\n" + "Phone number : " + txtPhone.getText().toString() + "\n\n" +
"Have you ever tried before? " + sp_ever_tried.getSelectedItem().toString() + "\n\n" + "Would you be intereseted in Hosting a Facebook Party? " + sp_hos_fb_party.getSelectedItem().toString() + "\n\n" + "Would you like to become a Consultant? " + sp_consultant_joiner.getSelectedItem().toString() + "\n\n" + "Comments: \n" + txtComments.getText().toString();
Apologies about the code formatting in here.
in Swift I have :
@IBOutlet var txtFullName: UITextField!
@IBOutlet var txtAddress: UITextField!
@IBOutlet var txtSuburb: UITextField!
@IBOutlet var txtPostCode: UITextField!
@IBOutlet var txtPhoneNumber: UITextField!
@IBOutlet var txtEmailAddresss: UITextField!
@IBOutlet var txtComments: UITextView!
@IBOutlet var txtTriedB4: UITextField!
@IBOutlet var txtState: UITextField!
@IBOutlet var txtHostFBParty: UITextField!
@IBOutlet var txtJoinAsCons: UITextField!
Then in
@IBAction sendEmail(sender: AnyObject) {
...
let msgBody = "<h3>Free Sample Request</H3>\n"
"<b>Full Name: " + txtFullName.text! + "</b>\n"
...
}
But I'm stuck here building the message body.
for new lines. – Nick Feb 27 '16 at 16:10