Skip to content

Instantly share code, notes, and snippets.

@russbishop
russbishop / StringLiteral.swift
Created Sep 9, 2016
Make ExpressibleByStringLiteral tolerable
View StringLiteral.swift
// If you want types initializable from String literals
// but don't want to implement three separate initializers.
extension ExpressibleByUnicodeScalarLiteral where Self: ExpressibleByStringLiteral, Self.StringLiteralType == String {
public init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}
View xctest.sh
# It's relatively easy to run Apple XCTest on OS X and swift-corelibs-xctest on Linux.
# Just look at apple/swift-corelibs-foundation for an example.
#
# But it's pretty difficult to run swift-corelibs-xctest on OS X.
#
# Let's say we have the following file:
#
# // main.swift
# import XCTest
# XCTMain([])
@briancroom
briancroom / code-coverage.sh
Last active Dec 9, 2016
A pair of scripts to help with basic parsing of LLVM code-coverage output data, as produced by Xcode 7. The `cov-exclusions.txt` file can be used to exclude files and globs from the output
View code-coverage.sh
SCHEME=MyApp
PRODUCT_NAME=${SCHEME}
WORKSPACE=${SCHEME}.xcworkspace
SOURCE_ROOT=./
###
ABSOLUTE_SOURCE_ROOT=$(cd $SOURCE_ROOT; pwd)
BUILD_SETTINGS=`xcodebuild -workspace ${WORKSPACE} -scheme ${SCHEME} -sdk iphonesimulator -showBuildSettings`
# Project Temp Root ends up with /Build/Intermediates/
@jpsim
jpsim / JAZMusician.h
Created Jul 7, 2014
SourceKit Playground
View JAZMusician.h
//
// JAZMusician.h
// JazzyApp
//
#import <Foundation/Foundation.h>
/**
JAZMusician models, you guessed it... Jazz Musicians!
From Ellington to Marsalis, this class has you covered.
@eternalstorms
eternalstorms / Apple Evangelists.txt
Created Jun 12, 2013
Apple Evangelists (WWDC 2013)
View Apple Evangelists.txt
UI- and App Frameworks Evangelist - Jake Behrens, behrens@apple.com, twitter: @Behrens
- What's new in Cocoa
- Accessibility in iOS
- Building User Interfaces for iOS 7
- Getting Started with UIKit Dynamics
- What's new in Cocoa Touch
- What's New With Multitasking
- Best Practices for Cocoa Animation
- Improving Power Efficiency with App Nap
- Introducing Text Kit