Best Practices

Thomas Hanning outlines how to use the new defer keyword in Swift in his blog post.

Essentially, the defer keyword executes its block before exiting the scope it is contained within. It’s a great tool to ensure you do any clean-up code required, even if an error is thrown.

It’s almost like a deinit() block for your own functions!

Check out his full post here: http://www.thomashanning.com/swift-2-0-defer/

Link
Best Practices, Resources

Little Bites of Cocoa is a blog I recently discovered that offers some truly great bite-sized snippets of knowledge via a newsletter. It’s a good way to keep on top of new best practices and bits of knowledge.

In the latest newsletter, a bunch of handy Swift tricks were featured, with my favourite being this one:

  
It’s helped me cut way down on the pyramid of doom! And what’s even better is you can even throw in a condition using the where keyword to the end of the chain. 😍 brilliance.

Check out the rest here: https://littlebitesofcocoa.com/175-more-swift-tricks

Link
Uncategorized

My First iOS App Is ‘Waiting for Review’!

I’m finally satisfied with a 1.0 version of my first iOS app, BB Links! I submitted it to the App Store for Apple’s approval a couple of weeks ago, but Apple had some questions that I had to answer after they had an initial look.  They’ve been sitting on it for 4 days now with my answers, so hopefully it goes into Review soon!

It was tough figuring out what I should and shouldn’t include in version 1.0. Try to do too much and it’ll never come out; do too little and its value isn’t immediately apparent. I’ve just got so many ideas floating around in my head for this app to help other Beachbody coaches find the information they need quickly and to take some stress off of them so they can focus on helping people get healthier! Win/Win!

I’ve been beta testing the app with a group of about 40 people (mostly Beachbody Coaches) and the response and enthusiasm about my app has been AMAZING. People love it and can’t wait for it to be released–that’s what this is all about: making software that helps people. I love it. I feel I’ve got the right launch features to make it immediately useful. 🙂

I’ve been toying with some new features and improvements for 1.1 as I wait for 1.0 to be approved. Problem solving is my forte so figuring out all of these little challenges in my app is fun and exciting!  I can’t wait to make this my career. 😀

Standard
Best Practices

radex.io has an excellent explanation of when you should AND shouldn’t use ‘guard’ in Swift. 🙌

‘Guard’ has quickly become one of my favourite way to help simplify my code by getting rid of lots of pyramids of doom! If if if 🙅.

Example:

guard !array.isEmpty else { return }

replaces the need to do an if statement around the entire code block that relies on the array not being empty and just returns from the function as soon as it finds an empty array without executing any further code in the function! 🎉

Make sure to check it out and try guard out in your code!

http://radex.io/swift/guard/

Link
Best Practices

Mixins over Inheritance – Crunchy Development

When coming from an Object-Oriented Programming language like ObjC, inheritance is often used to share code between multiple classes. But that solution is not always the best, and have some issues.

In today’s article, we’ll see how Swift’s Protocol Extensions and their usage as “Mixins” can change the deal.

via Mixins over Inheritance – Crunchy Development.

Check this amazing post out! Some really epic examples to show the power of Mixins (protocol extensions). ❤ it.

Standard