Skip to content

Instantly share code, notes, and snippets.

View jstart's full-sized avatar
💭
Learning SwiftUI... slowly

Christopher Truman jstart

💭
Learning SwiftUI... slowly
View GitHub Profile
#!/bin/sh
# make sure you have imagemagick installed: brew install imagemagick
# your app_icons.sh file should have the correct permissions: run `chmod 775 app_icons.sh` in your terminal from where you put this file
# put your `my_icon.png` next to this file and run ./app_icons.sh to export your app icons
x=my_icon.png
y=${x%.*}
# delete the export directory so we start clean
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 7, 2024 09:05
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

//
// OLD AND BUSTED
//
if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES)
{
// Do something important.
}
//
@n-b
n-b / NSRunLoop+TimeOutAndFlag.h
Created April 4, 2012 08:29
A simple runloop addition to ease Asynchronous Unit Tests in ObjC
//
// NSRunLoop+TimeOutAndFlag.h
//
//
@interface NSRunLoop (TimeOutAndFlag)
- (void)runUntilTimeout:(NSTimeInterval)delay orFinishedFlag:(BOOL*)finished;
@end
#!/bin/bash
##
## are you root?
##
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi