Skip to content

Instantly share code, notes, and snippets.


Andrea Cipriani andreacipriani

View GitHub Profile
andreacipriani / TestAsync.swift
Created Apr 6, 2020
Show the problem of testing an async function in Tuist
View TestAsync.swift
class Subject {
let dependency: Dependency
func doSomethingAsync() {
DispatchQueue.main.async {
andreacipriani / DispatchGroupSwift5Example.swift
Created Sep 12, 2019
Dispatch group on Swift example: how to wait for multiple asynchronous closures to complete
View DispatchGroupSwift5Example.swift
let group = DispatchGroup()
group.notify(queue: .main, work: DispatchWorkItem(block: {
print("everything finished")
func asyncOne() {
print("finished A")
View RepositoryChainDraft.swift
import Foundation
// Models:
struct TrackModel {
let title: String
struct UserModel {
let name: String
andreacipriani / Bash.swift
Last active Oct 9, 2020
Execute shell/bash commands from Swift
View Bash.swift
import UIKit
protocol CommandExecuting {
func run(commandName: String, arguments: [String]) throws -> String
enum BashError: Error {
case commandNotFound(name: String)
andreacipriani / UIImagePickerControllerWithCircleOverlay.c
Last active Apr 16, 2020
iOS: UIImagePickerController editing view circle overlay
View UIImagePickerControllerWithCircleOverlay.c
Credit: I've started by reading this SO question:
Trick to add a circle view on image picker editing to facilitate circular cropping
Tested on iPhone4s, iPhone5, iPhone6, iPhone6+, iPad - iOS 7 and iOS 8 - on May 2015
#pragma mark - UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
You can’t perform that action at this time.