Author: Chris Lattner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In my core data stack | |
let container = NSPersistentCloudKitContainer(name: "DataModel") | |
let storeUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: groupIdentifier)!.appendingPathComponent("DataModel.sqlite") | |
// Enable history tracking and remote notifications | |
guard let description = container.persistentStoreDescriptions.first else { | |
fatalError("###\(#function): Failed to retrieve a persistent store description.") | |
} | |
description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) | |
description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BlurryVibrantView.swift | |
// | |
// | |
// Created by Adam Bell on 11/9/19. | |
// Copyright © 2019 Adam Bell. All rights reserved. | |
// | |
import SwiftUI | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import PromiseKit | |
class PromiseOperation<T>: Operation { | |
var result: T? = nil | |
var error: Error? | |
var promise: Promise<T> | |
override var isExecuting: Bool { | |
get {return _isExecuting} |
- Proposal: SE-XXXX
- Authors: Chris Lattner, Joe Groff
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.