Skip to content

Instantly share code, notes, and snippets.

View pj4533's full-sized avatar

PJ Gray pj4533

View GitHub Profile
@steipete
steipete / swift-testing-playbook.md
Last active June 9, 2025 14:20
The Ultimate Swift Testing Playbook (feed it your agents for better tests!)

The Ultimate Swift Testing Playbook (2024 WWDC Edition, expanded with Apple docs from June 2025)

Updated with info from https://developer.apple.com/documentation/testing fetched via Firecrawl on June 7, 2025.

See also my blog: See also my blog post: https://steipete.me/posts/2025/migrating-700-tests-to-swift-testing

A hands-on, comprehensive guide for migrating from XCTest to Swift Testing and mastering the new framework. This playbook integrates the latest patterns and best practices from WWDC 2024 and official Apple documentation to make your tests more powerful, expressive, and maintainable.


1. Migration & Tooling Baseline

@pyrtsa
pyrtsa / Managing-optionals-in-Swift.swift
Last active March 7, 2017 18:39
Managing optionals in Swift
// Hello, fellow Swift programmer!
//
// Here's a demonstration of a few ways of cleaning up the unwrapping of
// optionals in Swift.
//
// Swift is known to have both OO and functional background. Thus, there is
// probably some middle ground programming style that is *more* functional than
// Objective-C, and probably less so than Haskell. This playground tries to
// compare their differences in the pretty common scenario of dealing with
// errors or missing input.
@edwardinubuntu
edwardinubuntu / gist:1111753
Created July 28, 2011 15:31
applicationDidBecomeActive
- (void)applicationDidBecomeActive:(UIApplication *)application {
...
// Initial Google analytics
[[GANTrackersharedTracker] startTrackerWithAccountID:
@"UA-xxxxxxxx-y"dispatchPeriod:
kGANDispatchPeriodSecdelegate:self];
...
}
@mdippery
mdippery / FileTailer.m
Created January 12, 2011 23:02
A class that mimics `tail -f`
//
// Created by Michael Dippery on 1/12/2011.
// Copyright 2011 Michael Dippery. All rights reserved.
//
#import "FileTailer.h"
@implementation FileTailer
- (id)initWithPath:(NSString *)path refreshPeriod:(NSTimeInterval)aRefresh