mokacoding

unit and acceptance testing, automation, productivity

Posts tagged "xcode"

A real-world example of TDD catching bugs

I published a YouTube video with a tutorial on implementing the FizzBuzz algorithm using Test-Driven Development. While recording, I made a couple of thinking or coding mistakes, and, sure enough, the tests immediately pointed them out.

How to test Swift async/await code with XCTest

Swift 5.5 and Xcode 13 introduce the async/await pattern for concurrent code. This tutorial post shows how to write unit tests for asynchronous code in Swift using the XCTest framework.

Unit Testing Combine Publisher Cheatsheet

Snippets to test the behavior of Combine Publishers in XCTest ready to copy and paste into Xcode

How to migrate from SwiftUI to UIKit App Delegate Life Cycle in Xcode

This free tutorial shows how to migrate an existing app with SwiftUI life cycle to use UIKit App Delegate instead

Write better Swift unit tests with custom XCTest assertions

The XCTest Swift testing framework has a limited offer of assertions. There's only so much you can do with XCTAssertTrue and XCTAssertEqual. This XCTest tutorial shows how to create custom assertions to make your unit tests and UI tests shorter and clearer.

How to bypass the SwiftUI App when running unit tests

How to make the unit tests of your SwiftUI app safer and faster by preventing them from running the program startup flow. This will avoid all of the launch operations like network requests or reads from the local storage that would affect the global state.

How to run a single test in Xcode

A collection of ways to run a single test or a subset of tests using Xcode.

How to remove duplication from Swift tests with helper functions

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.

How to write code faster using snippets

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.

Better Xcode Run Script Build Phases

Practical tips to write "Run Script" build phases in Xcode.

Setting Up Firebase Without Using CocoaPods

A guide on how to configure your Xcode project to use Google Firebase without using CocoaPods.

Maintaining Sanity with Multiple Versions of Xcode

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.

How to update all plug-ins for the latest version of Xcode and Xcode-beta

An handy script to update all Xcode plug-ins to be compatible with the latest version of Xcode and Xcode-beta.

Prevent Unit Tests from Loading AppDelegate in Swift

How to prevent the unit test target from loading the AppDelegate and have faster tests execution.

How to use a double slash in xcconfig files

A short post showing how to use a double slash in xcconfig files, for example to write URLs like https://mokacoding.com

How to update an Xcode plug-in for the latest version of Xcode

A simple command to run in your terminal to make sure you can use your favourite plugins on the latest version of Xcode

Installing Xcode plugins from the terminal with Fastlane

How to install Xcode plugins from the terminal using Fastlane, and persist them across machines.

How to configure Travis CI for iOS testing

A practical guide on how to configure Travis CI to run iOS, and OS X, tests.

How to configure CircleCI for iOS testing

A practical guide on how to configure CircleCI for to run iOS, and OS X, tests.

Xcodebuild Destination Cheatsheet

A collection of tips on how to configure the -destination option for the xcodebuild tool.

Automated Xcode version and build numbering via Git

How to configure Xcode to automatically set the version and build number of your projects using Git.

How to always use the latest Simulator with Xcodebuild

There is a simple keyword you can use in the destination option of an xcodebuild command to always run the most recent Simulator version.

An even lighter way to use Carthage

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.

How to install Xcode Command Line Tools without GUI or Xcode

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.

How to add testing dependencies using Carthage, with Swift 2 and Xcode 7

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.

XVim, harnessing the king of text editor's power in Xcode

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.

Xcode 7 UI testing, a first look

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.

xUnique: a tool to avoid Xcode project merge conflicts

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.

Xcode keyboard shortcuts for testing

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.

How to run Xcode tests from the terminal

How to invoke xcodebuild to run the tests from the command line and how to format its output using xcbeautify or xcpretty

A dive into Xcode projects and workspaces

A look at how Xcode stores information about the project and the workspace

A workaround to Xcode 5 GM crash on app submission

A workaround for the unusual crash of Xcode 5 GM during the App Store submission process.