Social media can be a valuable source of news and interactions, or a disruption to our focus. The difference is in how we approach using these technologies.
A collection of ways to run a single test or a subset of tests using Xcode.
The answer to "How can I test that a view controller presents another view controller when something happens?" is as simple as defining a delegate.
"You take care of your tools, your tools take care of you."
Professional chefs keep their benches clean because clutter will get in the way of their work. Software developers should do the same.
A running list of the top 10 most impactful books on productivity I've encountered so far
I realized I was on a path to remove time for reflection from my life, mainly by filling every available moment with podcasts and audiobooks. These are the steps I'm taking to cultivate more solitude, and the benefits I'm already seeing.
When testing delegates, we are asserting rigid implementation details. Here's a way to make those tests more flexible.
By looking at how the consistently successful New England Patriots operate we can learn useful lessons to apply to our job as software developers.
Digital minimalists believe that clutter is costly and optimization is important. Let me show you how these ideas apply to software development as well.
But you should track it anyways.
The best thing you can do as a software developer is not writing code, but removing it. Here's why.
With test driven development you can write high quality software in small shippable steps. Here's how to get started.
My notes and quotes from The Productivity Project by Chris Bailey
An overview of the different kind of doubles we can use in our tests, and how to write them in Swift.
Using the terminal might seem slow and cumbersome because every command needs to be typed. Learn how to drastically reduce the amount of typing you have to do by configuring aliases for your most used commands, making them only a few keystrokes long.
There is a subtle way to overload software components, by making them both take decision and act on them. We can simplify these bloated components by separating the responsibility of taking decisions from the one action on them. This will result in leaner and easier to maintain software, and is made simple by the Swift type system.
Some code ends up requiring a lot of duplication to be tested. You can remove it by using helper functions encapsulating the shared assertion logic.
In "On Writing" Stephen King shares invaluable lessons for aspiring novelists which can be applied to software development too.
What does it take to be productive? What does it event mean? Here's a introduction to the pillars of productivity, with many resources to start from.
Leveraging "snippets" is a way to get faster at writing code and free mental resources for problem solving. Most IDEs and text editor offer this feature, where you can write code scaffolding with a keyboard shortcut.
Keeping tests short and focused is important for the health of the test suite. A fixture method to generate instances with default values in the tests helps keeping the setup code short, focused, and readable
One of the best things you could do to improve as a software developer is constantly investing in your terminal setup and skills.
Leonardo da Vinci's life as told by Walter Isaacson in his biography is a source of inspiration for anyone working in a technical and creative field.
Test driven development works at its best when you refactor as you go. Write the failing test, write just enough code to make it pass, then and only then focus on making that code good.
Using protocols describing a single capability or action that can be performed is a way to enhance local reasoning and facilitate testability
A way to identify the areas of code to refactor with the highest return of investment using the "focusing question" technique.
The focusing question, a tool devised by Gray W. Keller, is a simple yet effective way to identify work to focus on with the highest return of investment.
A look at the benefits of writing unit tests before production code, in other words TDD.
Thoughts on a Michael Feathers post on how the understanding of complexity in software development compares to other fields.
A list of the apps and tools I use everyday and help me getting stuff done.
Books suggestions to start 2018 with the right mindset and tools.
Here's how to track symbolic liks in a Git repository, in a way suitable for teams.
A look at how beforeSuite and afterSuite behave in the Quick testing framework, and the dangers of using them
A look at how nested beforeEach and afterEach behave in the Quick testing framework.
The Nimble matchers framework provides two ways assert expectations on asynchronous code, this post explores when to use one or the other.
Porting Ruby's unless operator into Swift via a function.
Testing async code is not simple, but XCTest provides us with all the required tool. This post shows how to wait for an expectation to be fulfilled based on a Swift closure.
In Swift it is possible to pass a reference to a type itself, not just to an instance of it. This post shows how to use this capability to test legacy code.
A little post to share some things I learnt while working on a PR for danger-swiftlint to allow selective linting.
A look at the practical benefits of writing descriptive commits
Practical tips to write "Run Script" build phases in Xcode.
A guide on how to configure your Xcode project to use Google Firebase without using CocoaPods.
A look at what implicitly unwrapping and force unwrap a Swift Optional mean, and how they differ from each other.
A deploy hook to configure Postfix every time a Cloud 66 stack is built
A look at what implicitly unwrapping an Optional value means and why it should be avoided.
This post introduces the Either type and shows a practical application of it in Swift, injecting extra cells in a table view.
Strong opinions loosely held, and other cornerstones for a winning mindset
An exercise to understand Swift's optional type: reimplementing the if let functionality
This post looks into one of Swift's most powerful feature: optionals
Working with Xcode and Xcode-beta on the same machine can sometimes be confusing, this post shares some tools to help make it less so.
A quick post showing how to use the Swift availability attribute to mark objects and functions as unavailable.
This is a blogpost version of the content of my talk "Functional Core, Reactive Shell"
Every project can benefit from having a set of scripts to automate tasks such as running tests or distributing to testers. When setting up automation for your projects you can use a language agnostic setup. This will make it easier for new team members to get started, and allow you to change the setup without having to change the way the scripts are invoked.
How to configure NSDateFormatter to work with JSON API dates.
Links from my "Functional Core, Reactive Shell" talk
A collection of tips to get you started with workflow automation, increase productivity, and save time.
Third party code can be hard to test, but you can use Swift's protocols to abstract its details and improve testability
An handy script to update all Xcode plug-ins to be compatible with the latest version of Xcode and Xcode-beta.
Good unit tests are fast and deterministic. Testing code that hits the network could undermine this goal, but using OHHTTPStubs we can take back control of our tests. This post explores the advantages of stubbing the network, and provide a guide on how to do it with OHHTTPStubs.
In this post we are going to look at why hitting the network from your unit tests is a bad thing, and introduce some way to solve the problem.
Between CocoaPods and Fastlane, Ruby is an important part of the iOS developer toolchain. How can we reliably control the versions of the tools our project's automation is using in Ruby? Bundler is a simple way to specify Ruby dependencies and automate their setup.
Between CocoaPods and Fastlane, Ruby is an important part of the iOS developer toolchain. Managing versions and gems can be a challenge for developers outside of the Ruby community, but it doesn't have to be. In this two parts post we will see how to simply and reliably handle our Rubies.
If you are experiencing crashes with a version of Fabric and Crashlytics installed via CocoaPods chances are you are missing required information in the Info.plist. This post shows how to solve this issue.
A look at how to write tests for async code when using the Quick and Nimble Swift frameworks. This post is part of the Practical Testing in Swift series.
In this second post of the Practical Testing in Swift we a look at strategies to test how objects call their delegate methods or set property on them.
How to prevent the unit test target from loading the AppDelegate and have faster tests execution.
A short post showing how to use a double slash in xcconfig files, for example to write URLs like http://mokacoding.com
A retrospective on my consulting business in 2015. What when well, what didn't and how to act on it, how to move forward in 2016. I think my personal experience could be valuable for every iOS freelancer, I have done a couple of things right that helped my business a lot.
A simple script you can run to open a PR on BitBucket for your current branch.
A simple command to run in your terminal to make sure you can use your favourite plugins on the latest version of Xcode
How to add an Hacker News button to your blog
How to install Xcode plugins from the terminal using Fastlane, and persist them across machines.
How to provide environment variables stored in a .env file as an input for a command execution without having to export then, with a deep look at the shell commands used.
A practical guide on how to configure Travis CI to run iOS, and OS X, tests.
A quick guide on how to safely use Homebrew in CI.
A practical guide on how to configure CircleCI for to run iOS, and OS X, tests.
Unit and acceptance test are powerful tools that can be used to identify and fix bugs. Let's see how using a bugged Swift app as an example.
Practical advices on how to keep your tools sharp, master them, and become more productive.
A collection of tips on how to configure the -destination option for the xcodebuild tool.
By using the powerful automation provided by IFTTT we can make deliver the latest posts of your favourite blogs to Pocket. This is the most powerful RSS reader ever, and it is free.
Swift allows us to natively iterate over arrays using map. Map could be used to replace every for loop in your code, but that's not a great idea. Map and for have different purposes and should be used appropriately
Vim's relative line numbers are great for jumpin around files, and once you get used to them you want to enable them everywhere. Here's how to have NERDTree use relative line numbers
How to configure Xcode to automatically set the version and build number of your projects using Git.
There is a simple keyword you can use in the destination option of an xcodebuild command to always run the most recent Simulator version.
This is the post version of a talk I've been given in the past months. In this post we will demystify functional programming terms like monad and functor, and see how those concepts can be brought back to the every day Swift development, in particular how they can help to deal with optionals in a leaner way.
Among the options Carthage, an iOS and OS X dependency manager, provides there is the --no-build one. Using this we can integrate dependencies in the form of Xcode projects rather than frameworks, keeping the repository slimmer and the CI time low. This approach is lighter than than the usual way to work with Carthage, but comes with some disadvantages too.
Here's a little script that will allow you to install the Xcode Command Line Tools without having to install Xcode, nor having a logged GUI. This can come pretty handy in automated scripts or when provisioning virtual machines.
I attended /dev/world/2015 in Melbourne this week. It has been a great conference, full of very friendly and smart people. Being a test and automation fanboy I attended as many talks related to that topic as I could. These are my notes.
Nimble is a matchers framework built for Swift that provides powerful and versatile expectations. Writing test within the standard XCTest harness but using Nimble assertions is easier and productive, and a good combination of tools to introduce testing and TDD to colleagues and teams in a frictionless way.
How to implement a custom AFNetworking response serializer to read the failure response data and populate the callback error with it.
A look at how to write classes and structs that expose their dependencies as initialization arguments in Swift.
How to get an array of single characters String from a multiple characters String. From foobar to [f, o, o, b, a, r].
Sometimes the idea we get when reading a class interface is different from what is actually going on inside its implementation, for example there could be several hidden dependencies. Making a class dependency explicit in its interface is a useful technique to make the code simpler to understand, and easier to test.
When typing a shell command it is possible to reuse the last argument of the previous call without having to type it. Let's see how.
Like good chefs keep their benches clean to make delicious dishes all day long in the restaurants' kitchens, so good developer keep their codebase clean. It all comes down to little habits, the result of which when summed up together is a tidy, clean and easy to maintain software.
If you are having problems with xcodebuild failing to export your apps with either Swift or Watch Kit support here's the solution, with a handy custom script.
One of the characteristic of the UI is that it changes, and there are scenarios in which writing UI tests to assure that the change has happened correctly can be very valuable for the reliability of our apps. Writing such a test is a bit harder than normal, let's see how to do it.
In this little tutorial we will see how to use Cathage, an OS X and iOS depencendy manager, to install libraries written in Swift 2 and Xcode 7, with a focus on the process to get testing dependencies.
In this port to Swift of the great of Haskell's "Functors, Applicatives, And Monads In Pictures" we are going to look at these functional programming concepts aided by some very helpful pictures.
An introduction to the XVim plugin, that adds most Vim keybindings and features to the Xcode IDE, and how this can make you more productive as a developer.
Realm is a mobile database that, unlike CoreData, is easy to test. In this post we will discuss some ideas on how to test an app using Realm as its database.
Companion blogpost for Gio's talk "Talking myself into the value of acceptance testing" at Melbourne CocoaHeads meetup
How to get started with UI testing in Xcode 7, recording tests and using the new APIs to assert the state of the application under test.
At mokacoding we're big on automation, and we eat our own dog's food! The workflow to write and send new issues of our newsletter, mokacoding weekly, is (partially) automated thanks to some simple Ruby scripting and Mac command line utilities.
Git provides a mechanism to run one or more scripts before a commit is actually added to the history called pre-commit hook. We can use this hook to run scripts that validate or sanitise the changes to be committed automatically, saving time and brain power, and assuring the quality of the codbase and git log.
How many times when working on a Mac OSX or iOS app with a team have you had a merge conflict on the project.pbxproj file? I guess more than a few, a lot more than a few. Lucky for you there is an handy tool called xUnique that will make the chances of this happening way smaller.
Not only Expecta is a simple to use library that allows us to write highly readable code, but it can also be extended by the users with custom matchers. Let's see how to write a custom matcher to gain readability and reuse code in our test suites.
A test that express is intent clearly is arguably twice as effective as one that doesn't. Writing test in an xSpec style is a good first step to express behaviour clearly, and when matched with a matcher library such as Expecta the results are test that are easy to read and reason about
An interesting and powerful, yet not at all documented feature of Spetca are global beforeEach and afterEach hooks. In this post we'll see how to configure them, and how to blacklist classes from running them. Updated for version 0.5
When writing tests it's very important do be declarative, aiming to have tests that explain how a class is supposed to behave as good as its documentation would do. When talking about acceptance tests we can achieve this kind of clarity by having a 1:1 relationship between the tests and the acceptance criteria for the application. A very effective way to express acceptance criteria is through _job stories_. In this post we'll see how to write acceptance tests that map job stories for our iOS apps, using KIF and Specta.
Writing unit tests for our iOS and OS X projects not only is important, but should be always part of the development cycle. As such the way we write the tests is as important, and having the option to write tests that easily explain their purpose can drastically increase the quality of the suite. Specta and Expecta are two libraries that provide a different way to writing tests than XCTest, let's see what we can gain by using such approach.
Keyboard shortcuts are easies way to start increasing your productivity. Let's look at how to run tests in Xcode without ever touching the mouse.
A guide on install and use the KIF framework for iOS acceptance testing.
In this post we'll look at the main tools and libraries available to write unit and acceptance tests for iOS and OS X applications, as well as the solutions to host Continuous Integration for our projects.
An interesting and powerful, yet not at all documented feature of Spetca are global beforeEach and afterEach hooks. In this post we'll see how to configure them, and how to blacklist classes from running them.
In this post we take a look at how to run Xcode tests suites from the terminal with xcodbuild and xcpretty, and why you should do it
Rake, the Ruby build utility, can lift off all the typing involved in running the Cucumber/Calabash acceptance tests, saving us a lot of typing time.
Every team and every project should have a Git-iquette: a set of common practices for managing the git repository.
A simple guide that shows the simplest way to install Calabash on an iOS project, by using Build Configurations and CocoaPods.
By implementing these 5 small habits you'll kickstart your 2015 and become a better software developer.
Tips for freelance software developers (and non) to improve the security of laptops, smartphones and website accounts, to keep your and your clients data safe.
Some time ago I learned the hard way that I shouldn't work on Fridays. I've been applying an alternative schedule to my week, and it's working out pretty well.
A couple of tips learnt the hard way on how to develop and debug In App Purchase support in an iOS app.
Some tips on how to use CocoaPods and customs build configurations without headaches.
A way of automating the deployment of an iOS app for enterprise distribution using the shenzhen gem.
Taking a look back at 2013, to find good propositions for 2014
A list of the tech podcasts I follow
A quick summary and memo of interesting things I've learned in October - iOS screen capture, HTML5 game development, ways to improve your coding.
A little guide on how to edit an existing model adding a new has_many association
A look at how Xcode stores information about the project and the workspace
Introducing mokagio's monthly questions, related to iOS, Objective-C, Xcode, xctool, AFNetworking, CocoaPods.
A quick summary and memo of interesting things I've learned in September
Sharing thoughts by some lead designers on iOS 7.
A simple checklist of the basic tools to setup a Mac for development.
Introducing MTFontIcon, a CocoaPod library for iOS to improve application development efficiency by using font icons.
A workaround for the unusual crash of Xcode 5 GM during the App Store submission process.
A summary of the things I learned in July 2013.
A recap of what I developed during an unusual week left by myself without neither girlfriend nor friends.
A declaration of purposes for what I'm gonna do in the next week.
A self memo on how to set the $(inherited) flag on a project using CocoaPods on Xcode.
A summary of the things I learned in June 2013.
Step by step guide on how to integrate the Facebook SDK in an iOS app, the right way. Part 1: Facebook Login.
The link to the Samsung Printer Drivers, enclosed in a ranting post.
How to distribute multiple builds of your iOS app, such as stable, QA and development builds, via TestFlight.
A step by step guide to create a basic CocoaPod.
A brief introduction to CocoaPods, the Objective-C dependencies manager.