Learning iOS part 1: Using Delegates in Swift for E-mailing

After working in Android for a while, I am taking the plunge into Swift. Learning the ropes has been fairly easy, except for there are a few differences you must be careful on. This reminds me of learning Portuguese after learning Spanish. There are a lot of words that are alike, but you must not always assume that they are the same.

One of those differences has been nil and null. Apparently null does exist in the iOS world, and is actually used. Nil is used when you are wanting to return a null id, except for an object. If it is a non-object pointer (void*) then you would use null. Some other small differences include not needing to put parenthesis around if statements, and not having to add a semi-colon to the end of everything. Some of these changes have taken a while to get used to, but one thing that is taking a little bit more time to learn how to call system functions to do things like sending an e-mail.

In Android, you would use intents to handle calling system tasks like sending an e-mail. In iOS there is a specified controller that you can switch to after you pass it some extra information. This is much more tightly coupled, but makes the documentation at least pretty straight forward:

Sending files using Swift

The article does warn that you probably should use an actual device, and not a simulator. In the simulator the e-mail comes up, but it soon crashes. As soon as I get my developer account I will update.

The World is Not Flatter


Thomas Friedman wrote a book about how the world is flat. The world is not flat, I believe that in a sense that people are more enclosed in their own world then ever before. People I believe have the opportunity to connect more to those that are around them, but a lot of people do not take that risk. They have the opportunity to outsource, insource and do things in ways that we never thought possible, but more important than how we do things is how often we do things. 90% of internet traffic is local. This leads me to believe that physical geography is still a great motivator in keeping people and nationas apart. I believe that the book is full of anecdotes and does not have the basis in reality that one needs to have to convince someone of the real truth of things. I enjoyed listening to the stories, but thought that the book would be more useful if it were shorter and contained more basis in studies.