Skip to content

Instantly share code, notes, and snippets.

//
// CDZIdioms.h
// https://www.dzombak.com/blog/2015/02/Tiny-Swift-idioms-in-ObjC.html
//
// Created by Chris Dzombak on 3/21/15.
// Copyright (c) 2015 Chris Dzombak. All rights reserved.
//
#ifndef CDZIdioms_h
#define CDZIdioms_h
@cdzombak
cdzombak / CDZScalingButton.h
Created January 21, 2017 16:34
A UIButton with a nice scaling effect when the user touches down on it.
//
// CDZScalingButton.h
// ScalingButton
//
// Created by Chris Dzombak on 10/17/15.
// Copyright © 2015 Chris Dzombak. All rights reserved.
//
@import UIKit;
@cdzombak
cdzombak / cdz.dump1090.plist
Created January 29, 2017 22:41
launchd plists for dump1090 and the QEMU Pi emulator. Will require changing to use your OS X username. See: https://www.dzombak.com/blog/2017/01/Monitoring-aircraft-via-ADS-B-on-OS-X.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
//
// FileURL.swift
// Created by Chris Dzombak on 11/16/16.
//
import Validated
public typealias FileURL = Validated<URL, FileURLValidator>
public struct FileURLValidator: Validator, _FileURL_Validating {

Hello Everyone,

The Swift 3 release is nearing completion, so it is time to look back on the release, learn from what happened, and use it to shape what we (the Swift community) do in the year ahead. Overall, Swift 3 is going to be an absolutely amazing release, and it is impressive how much got done. Thank you to everyone who contributed to making it happen. Instead of diving into a flurry of new proposals immediately, it is important to take stock of where we are, and look at the bigger picture.

Metapoint: this email is ridiculously long and covers multiple topics. Instead of replying to it directly, it is best to start new threads on individual topics that you’d like to discuss. Just tag them with “[Swift 4]” in the subject line.

Swift 3 Retrospective

Every year of Swift’s development has been completely different from the previous one, and I expect Swift 4 to continue this trend. With a goal of learning and improving year over year, here are some observations & retrospective about Swi

@cdzombak
cdzombak / tgmath.md
Last active July 14, 2016 18:01
fucking tgmath doesn't work with ObjC modules, and Apple has known about this for at least a year and doesn't care about fixing it
protocol ThingDelegate: class {
var fooString: String { get }
func foo()
}
class Controller: ThingDelegate {
let fooString: String
func foo() {
print("foo")
}
let nilString: String? = nil
let aString: String? = "a non-nil string"
print (nilString ?? "the string is nil")
print (aString ?? "the string is nil")
// if you don't want to use `??` …
// (inspired by Scala's Option's `getOrElse`)
extension Optional {
tell application id "OOut"
try
set doc_name to name of front document
on error
activate
display alert "No Document Open"
return
end try