Well there are some tricks here to make this work right. Hat tip to Rennie on this:

### Setting up IOS

Gmail has this notion of labels and always tries to archive vs delete mail so this can be really confusing. But fortunately with iOS, there is a way to fix this. Go to Settings/Mail, Contacts and Calendars. Find your account for Gmail and click on the Account/Advanced and then change Move Discarded Messages Into to Deleted Mailbox. While you are there you can check that the mappings for various folders are correct in the Mailbox Behaviors settings, you want Draft Messages to map to the server side Draft.

### Setting up

It is a little trickier getting Apple Mail on OS X to cooperate, normally it just works if you use the Google option in System Preferences/Internet Accounts, but you have the same issue with archive vs. Delete. So here are the steps to check:

1. Logon to Gmail. Click on the Gear icon on the upper left and choose Settings/Labels. This shows how google maps its general label scheme to IMAP folders. Gmail is quite different than most other mail system. It always wants to archive and it doesn't have folders. It uses labels instead, so you want to make sure the mapping between its labels and the IMAP folders makes sense. So on the Labels page, it shows you what labels convert to IMAP folders with the Show in IMAP button on the right. Make sure the Trash, Sent Messages and so forth work. You need All Messages by the way. This is the default that is used for all mail.
2. You will also see lots of labels that may be junk. Kerio creates a bunch as artifacts for instance, you can delete those and make sure show in IMAP doesn't show on the rest.
3. One problem is the naming of Trash, for google it is Trash but for other clients it is Deleted Messages. The same for Sent Messages vs Sent Mail. Just settle on one and then in IOS and on Mac Mail make sure it points to the same folder. Since you are using Google Mail, you probably want to convert to its defaults which are Sent Mail and Trash, so in the client you just drag and drop all the Sent Messages and Deleted Messages into Sent Mail and Trash respectively.
4. Finally, to get Google to actually delete instead of archive (what this means is an archive means it loses all its labels and you can only see it with  All Messages label). To change this to really delete where the semantics are it gets a Trash label and then is deleted after 30 days, you have to go to Forwarding and POP/Imap and take Auto Expunge off and choose Move messages to Trash