Skip to content

Instantly share code, notes, and snippets.

@markedwardmurray
markedwardmurray / gist:ba888d5ea428902f3db63ecaad98ae7e
Created October 20, 2016 15:11
Mike Sanderson's BFTask vc presentation pattern
-(BFTask *)viewControllerToPresent:(UIViewController *)viewController task:(BFTask *)task {
BFTaskCompletionSource *dismissalComplete = [BFTaskCompletionSource taskCompletionSource];
[self presentViewController:viewController animated:YES completion:nil];
[task continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock: ^id (BFTask * t) {
[self dismissViewControllerAnimated:YES completion: ^void() {
[BFTask completeSource:dismissalComplete basedOnTask:t];
}];
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
lazy var hello: UILabel = {
let hello = UILabel()
hello.frame = CGRect(x: 50, y: 200, width: 50, height: 50)
hello.text = "Hello"
@markedwardmurray
markedwardmurray / Keybase.md
Created November 19, 2020 00:56
Keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@markedwardmurray
markedwardmurray / UIRefreshControl+CustomImage.swift
Created February 11, 2021 06:22
Adds a spinning custom image to a UIRefreshControl
import UIKit
extension UIRefreshControl {
func addCustomImage(_ image: UIImage) {
tintColor = .clear
let container = UIView(frame: frame)
addSubview(container)
let imageView = UIImageView(image: image)