Skip to content

Instantly share code, notes, and snippets.

💭
fucking your mom

Bryan Joseph bj97301

💭
fucking your mom
  • your mom
  • Portland Oregon
Block or report user

Report or block bj97301

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
@lattner
lattner / async_swift_proposal.md
Last active Feb 19, 2020 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift
View async_swift_proposal.md

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.

@db0company
db0company / topMostViewController.swift
Created Jan 19, 2015
Get the top most viewController anywhere in the app (typically from the appDelegate). Get the current visible viewController.
View topMostViewController.swift
extension UIViewController {
func topMostViewController() -> UIViewController {
if self.presentedViewController == nil {
return self
}
if let navigation = self.presentedViewController as? UINavigationController {
return navigation.visibleViewController.topMostViewController()
}
if let tab = self.presentedViewController as? UITabBarController {
if let selectedTab = tab.selectedViewController {
You can’t perform that action at this time.