Skip to content

Instantly share code, notes, and snippets.

Keith Smiley keith

Block or report user

Report or block keith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@keith
keith / simctl-commands.txt
Last active May 13, 2020
All the subcommands of `xcrun simctl` (including ones that aren't listed in `simctl help`) LC_SOURCE_VERSION 681.5.4
View simctl-commands.txt
delete
pbpaste
terminate
keyboard_set_language
erase
pbsync
diagnose
status_bar
openurl
get_app_container
@keith
keith / exclusivity.md
Last active Nov 30, 2019
The matrix of Xcode build settings to compiler flags for Swift memory exclusivity
View exclusivity.md
  • Compiler flag: -enforce-exclusivity=<value>
  • Build setting: SWIFT_ENFORCE_EXCLUSIVE_ACCESS

Xcode 10.1 & Swift 4.2

  • Compiler default for non optimized builds if you pass no argument is the same as if you passed checked
  • Compiler default for optimized builds if you pass no argument is the same as if you passed unchecked
Configuration Compiler Flag Value Build Setting Description Build Setting Value Notes
@keith
keith / delete-apps.rb
Last active Sep 10, 2018
A script for prompting to delete app ids from the provisioning portal
View delete-apps.rb
require 'spaceship'
Spaceship::Portal.login
Spaceship::Portal.select_team
Spaceship::Portal.app.all.collect do |app|
print "Delete #{ app.bundle_id }? [y/N]: "
delete = gets.strip.downcase == "y"
if delete
puts "Deleting #{ app.bundle_id }"
@keith
keith / RadarDocument.swift
Created Jul 20, 2017
NSDocument canClose in Swift
View RadarDocument.swift
/// So, lets talk about AppKit. The way this function works is by passing a delegate (which is required
/// to be a NSObject, but here is typed as Any) which turns out to be the same type as `self`, a Selector,
/// which in this case is `_something:didSomething:soContinue:` (not kidding), and some "contextInfo"
/// (which is actually a block). While all of these arguments appear to be optional, passing nil through
/// to the function call that `shouldCloseSelector` defines, or passing nil to super, will cause the app
/// to crash. So then we need to call the function on `delegate` defined by `shouldCloseSelector`.
///
/// According to the documentation the function signature for this selector looks like this:
/// - (void)document:(NSDocument *)doc shouldClose:(BOOL)shouldClose contextInfo:(void *)contextInfo
///
@keith
keith / testflight.sh
Last active Apr 29, 2020
Upload an ipa to testflight using altool
View testflight.sh
#!/bin/bash
set -euo pipefail
xcrun altool --upload-app --type ios --file "path/to/foo.ipa" --username "$ITC_USER" --password "$ITC_PASSWORD"
@keith
keith / userdefaults.swift
Last active Oct 11, 2016
Implicitly unwrapped optional crash
View userdefaults.swift
import Foundation
func set<T>(value: T, forKey key: String) {
UserDefaults.standard.set(value, forKey: key) // this crashes because it's trying to store Optional<Date>
}
let date: Date! = Date()
set(value: date, forKey: "key")
@keith
keith / optimizationCrash.swift
Last active Oct 14, 2016
Swift 3.0 optimizations crash (fixed in Xcode 8.1 beta 3)
View optimizationCrash.swift
///
/// This code crashes with Swift 3.0 with optimizations enabled
/// Run with:
/// $ swift -O optimizationCrash.swift
///
extension Dictionary {
// init(pairs: [(Key, Value)]?) { // With `(Key, Value)` this doesn't crash
init(pairs: [Element]?) { // With `Element` this crashes with -0
self.init()
}
@keith
keith / link.sh
Last active Dec 22, 2016
Build to iOS 10 from Xcode 7.3.1
View link.sh
@keith
keith / lumail2.rb
Created May 28, 2016
Homebrew formula for lumail2
View lumail2.rb
class Lumail2 < Formula
desc "Console based email"
homepage "https://lumail.org/"
url "https://lumail.org/download/lumail-2.5.tar.gz"
version "2.5"
sha256 "76805e40038e11aa3a44fc29a015ca67553b44b7b951839e9f9102679f112c77"
depends_on "pkg-config"
depends_on "pcre++"
depends_on "gmime"
View keybase.md

Keybase proof

I hereby claim:

  • I am keith on github.
  • I am smileykeith (https://keybase.io/smileykeith) on keybase.
  • I have a public key whose fingerprint is AC20 B263 327E 9C9A A61A 55A1 33BA 60D4 4C71 67F8

To claim this, I am signing this object:

You can’t perform that action at this time.