WWDC 2006 2007 2008 2009 2010 2011 2012 2013 2014
/* | |
In response of Tom Lokhort's article. | |
A third alternative: alternative 2 under steroïds | |
--- | |
Source: http://tom.lokhorst.eu/2017/07/strongly-typed-identifiers-in-swift | |
*/ | |
struct GenericIdentifier<T>: RawRepresentable, Hashable, Equatable { | |
let rawValue: String |
import Cocoa | |
class MyAppDelegate: NSObject, NSApplicationDelegate { | |
let window = NSWindow() | |
var didFinishLaunching: NSWindow -> () = { _ in () } | |
func applicationDidFinishLaunching(aNotification: NSNotification) { | |
didFinishLaunching(window) | |
} | |
} |
Modern Cocoa development involves a lot of asynchronous programming using blocks and NSOperations. A lot of APIs are exposing blocks and they are more natural to write a lot of logic, so we'll only focus on block-based APIs.
Block-based APIs are hard to use when number of operations grows and dependencies between them become more complicated. In this paper I introduce asynchronous semantics and Promise type to Swift language (borrowing ideas from design of throw-try-catch and optionals). Functions can opt-in to become async, programmer can compose complex logic involving asynchronous operations while compiler produces necessary closures to implement that logic. This proposal does not propose new runtime model, nor "actors" or "coroutines".
Automatically copy all PNG assets to the correct Android drawable folder. Very helpful when exporting assets with @?x
-suffix from, for example, Sketch and putting them into the correct folder without human interaction.
- Copy the AppleScript file to
~/Library/Workflows/Applications/Folder Actions
- Create a export folder where you'll put all exported PNGs
- Right click the folder, choose configure folder actions, check the "Enable folder actions" checkbox and attach the
android_assets.scpt
to your folder - Open the terminal and create a symbolic link by typing
ln -s /path/to/android-project/app/src/main/res /path/to/export-folder-you-just-created
// | |
// NetworkActivityIndicatorManager.swift | |
// | |
// Created by Mathijs Kadijk on 30-10-14. | |
// From: https://gist.github.com/ab1b9196c99dcc16e5fe | |
// License: Public domain | |
// | |
@objc | |
class NetworkActivityIndicatorManager { |