Swift: Selector Syntax Sugar

I’ve been burned by string-typed selectors in the past so I was happy to find this excellent post regarding the new Swift 2.2 #selector functionality and creating extensions of Selector to allow syntax sugar 🍧🍪🍰🍭🍦.

Check it out here!

😍

Learning TDD

I’m currently intrigued with how TDD (Test Driven Development) can help me become a better developer. The problem is…you see TDD mentioned a lot on the Internet, but it’s hard to come across good explanations of HOW to actually DO Test Driven Development.

I first became interested in learning TDD because I read in the book I’m reading now called The Clean Coder: A Code of Conduct for Professional Programmers that TDD isn’t optional–it’s required if you want to be seen as a professional coder, which of course I want to be!:) In the book, Robert Martin discusses using Katas for TDD, so I thought I’d give it a try.

What is a TDD Kata?

TDD Kata was first introduced in the book The Pragmatic Programmer: From Journeyman to Master (which I have yet to read…it’s next on my list). Essentially, it’s taking a set of predefined programming steps that take you through a programming problem from start to finish, using proper TDD techniques right from the start. Its goal is to teach via muscle memory. This blog post describes it well.

My First TDD Kata

Today I did The Bowling Game Kata (linked below) from start to finish. I plan to do it daily for 15 minutes (as suggested by Marlena below). I definitely see the benefit now.

My first reaction as I went through each step of the kata was to check to make sure my logic was correct…but then I realized that that’s why the test was written before writing the logic–it was already verified to be correct since the test passed. Still–I found it hard not to try to run through the logic to make sure (which is muscle memory from non-TDD habits–exactly what I’m trying to break :)).

Fun!

TDD/TDD Kata Resources

Here’s what else I’ve come across that I’ve found helpful thus far in terms of TDD:

Marlena Compton’s Learn TDD with Katas

Marlena describes a 15-minute-per-day technique of learning TDD using Katas. The point is to follow the Kata step by step, which goes through the proper method to do TDD, bit by bit, day by day, to practice and make the act of writing tests before logic the most natural and comfortable way of coding for you.

Jon Reid’s Xcode TDD Kata: Practice with the Bowling Game

Jon adapted this Java TDD Kata so it is in both Objective-C and Swift. It describes what TDD Kata is, and how to do it.

Martin Fowler’s Mocks Aren’t Stubs

Martin describes the different ways in which you can create your app’s objects needed to test your app. It’s an oldie, but I found it to be very good at describing different techniques for actually building your tests for TDD.


I’ll update this post as I learn and find more resources!

-Justin

My Favourite iOS Development Podcasts

Podcasts are an essential part of my learning workflow. I’ve only discovered the power of podcasts in the past couple of years, and I find them super useful for learning new things and keeping up with the latest news and tips and tricks!

I subscribe to many different podcasts, but right now I’ve been mainly sticking to iOS Development-themed shows to help accelerate my learning rate. I’m confident in saying that it’s accomplishing that goal!

Typically I’ll digest these podcasts in the shower using my Bluetooth speaker, in my car to and from work, and sometimes during work.

Here are my top picks (in no particular order)!

Top Picks

More Than Just Code

Website: http://mtjc.fm

Description: Each week, Aaron Vegh, Jaime Lopez, Mark Rubin (sometimes Greg Heo), and Tim Mitra discuss iOS and Mac development, including current issues, what developers are talking about, what their apps are about, what they are using to create their apps and what advice they have for other developers (or those looking to become one). It also features news, notes and tech tips for developers.

Why I Like It: It’s got a Canadian perspective, eh! 🇨🇦 A minimum of 50% Canadian hosts—sometimes 100%! 👌 The crew has great chemistry and each episode is always full of entertaining shenanigans. The show talks about real-world problems developers face and how they deal with them. Also I always love the picks.

Under The Radar

Website: https://www.relay.fm/radar

Description: From development and design to marketing and support, Under the Radar is all about independent app development. It’s never longer than 30 minutes. Hosted by Marco Arment and David Smith.

Why I like It: Marco and David are influential and successful indie developers who know their stuff. Each episode is focused on a single focused topic that’s to the point and under 30 minutes. Start from the beginning as it’s rather new.

iOhYes

Website: http://5by5.tv/iohyes

Description: A podcast by iOS developers for iOS developers, delivering news, tips, and rants for professional iOS/Mac developers, with something for enterprise and indie developers alike.
Hosted by Darryl Thomas, John Sextro, and Nolan O’Brien.

Why I Like It: These guys always have very focused, intelligent, technical discussions that are very detailed—we’re talking calling out and describing actual APIs. I always come away learning something new and/or understand better! Nolan is excellent at explaining technical topics.

Release Notes

Website: http://releasenotes.tv

Description: Release Notes is a weekly podcast about the business of Mac and iOS indie software development. It discusses inspiration, design, trends, and tools — everything but the code. The show is hosted by Charles Perry and Joe Cieplinski. Each week it covers topics for the new or curious independent developer looking to make his or her way in the iOS and Mac ecosystem. Tips and tricks, success stories as well as failures.

Why I Like It: It covers a wide range of topics with really great perspectives. I’m always learning something new about the business side of software. Great hosts!

Core Intuition

Website: http://www.coreint.org

Description: A podcast about indie software development for the Mac, iOS and other Apple technologies. Hosted by Daniel Jalkut and Manton Reese.

Why I Like It: Daniel and Manton are down to earth hosts who have great chemistry and aren’t afraid to say it like it is. It’s always a great way to keep up on the latest trends and often discussion of the softer parts of being a developer. Lots of tomfoolery.

Honourable Mentions

The RayWenderlich.com Podcast

Website: http://www.raywenderlich.com/rwpodcast

Why It Missed The Top: It recently moved to two 20 minute topics per episode…and while the content and focus is great, I just find it a bit too rushed now. Still recommended!

Concepts In Code

Website: http://podcast.conceptsincode.com/size/2

Why It Missed The Top: It’s a great podcast that discussed really good best practices, but sometimes it goes a bit on a tangent and it’s also a bit difficult to just listen to since it relies on the github project discussed. Great discussion nonetheless!

Are there any I’m missing that you find are key? If so tweet them at me @jstheoriginal or leave a comment below. 🙌

P.S. I use Marco’s Overcast podcast app…if you do as well make sure to hit the Recommend button on these podcasts!

Confirmation From Apple: iAd Completely Done For

On January 15th, Apple announced that the iAd App Network was being discontinued on June 30, 2016.

As soon as this announcement was made, panic set in as everyone assumed that the news meant that Apple was getting rid of the iAd program altogether. But later reports indicated that it was only the App Network (the ability for iOS App developers to advertise their apps using iAd) that would be going away. Panic subsided.

I had just submitted my first app BB Links (which I integrated iAd into) for review a couple of days before the January 15th announcement. My app was approved for sale near the end of January, but no iAds were being shown in-app, even two weeks post-launch despite iAd Workbench stating it was showing Live Ads.

I contacted Apple’s iAd team to see what was up. They just got back to me with the below note, confirming the initial reaction to the announcement:

Confirmation from Apple iAd Completely Discontinued

Either this employee is misinformed, or iAd is completely done for June 30, 2016.

Now’s a good time to switch over your app to a different ad delivery network if you thought you were safe using iAd going forward. I will be.

—————————————
Text version of the email:

Hello Justin,

As I understand your app is not receiving iAd. Please be aware the iAd App Network will be discontinued as of June 30, 2016. New apps are no longer being accepted into the iAd App Network program. This is why you are not receiving iAds. For more information on this news please you can reference News and Updates at:

https://developer.apple.com/news/

Thank you for your understanding.

Case number: [##########]

Best regards,

Angelica
Apple Inc.

The Style Guide for Prolific Interactive’s Swift Codebase

https://github.com/prolificinteractive/swift-style-guide

As my blog makes clear, I’m all about clean code and following best practices.1 Example: I always need to delete extra spaces between closing braces in my code. It must look perfect. 🙈

Prolific Interactive created a github repository that outlines their style guide for all of its Swift codebase. Great best practices. I align with most of what’s included, so take a look!


  1. I follow Ray Wenderlich’s Swift Style Guide found here

Xcode: Navigating Through Your Project by Thomas Hanning

http://www.thomashanning.com/xcode-navigating-through-your-project/

Xcode can be a bit daunting at first when you’re starting out as an iOS developer. It’s a very complex and capable program, which means it can be hard to find what you’re looking for.

Thomas has some good tips for Xcode, including using landmarks (TODO:, MARK:, FIXME:), search, groups and callers—which all make it much easier to find what you’re looking for or what you need to come back to later.

Check it out!

Stored vs. Computed Properties in Swift

Thomas Hanning has a great overview of the use-cases for stored properties and computed properties here.

Essentially, stored properties allow you to perform actions as the property’s value is about to be set (using willSet {}) or after it has been set (using didSet {}). With computed properties, you can also calculate a new value on the fly without storing a default value.