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 look at the practical benefits of writing descriptive commits
Practical tips to write "Run Script" build phases in Xcode.
A look at what implicitly unwrapping and force unwrap a Swift Optional mean, and how they differ from each other.
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.
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.
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.
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
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.
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.
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.
How to install Xcode plugins from the terminal using Fastlane, and persist them across machines.
A practical guide on how to configure Travis CI to run iOS, and OS X, tests.
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.
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
How to configure Xcode to automatically set the version and build number of your projects using Git.
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.
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.
A look at how to write classes and structs that expose their dependencies as initialization arguments in Swift.
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.
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.
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 little guide on how to edit an existing model adding a new has_many association
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 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.