Skip to content

Instantly share code, notes, and snippets.

View arashkashi's full-sized avatar
💭
Working with machines against the machine

A.K. arashkashi

💭
Working with machines against the machine
View GitHub Profile
@arashkashi
arashkashi / AppCoreDataManager.swift
Created November 7, 2022 07:33 — forked from levibostian/AppCoreDataManager.swift
iOS CoreData ultimate document. Stack, tutorial, errors could encounter. All my CoreData experience for what works in 1 document.
import CoreData
import Foundation
protocol CoreDataManager {
var uiContext: NSManagedObjectContext { get }
func newBackgroundContext() -> NSManagedObjectContext
func performBackgroundTaskOnUI(_ block: @escaping (NSManagedObjectContext) -> Void)
func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void)
func loadStore(completionHandler: ((Error?) -> Void)?)
}
@arashkashi
arashkashi / CurrentValueSubjectToBinding.swift
Created June 10, 2021 11:51 — forked from PaulWoodIII/CurrentValueSubjectToBinding.swift
Bindings over a CurrentValue subject allow you to use combine for side affects
//: [Previous](@previous)
import Foundation
import SwiftUI
import Combine
//: Current Value Subject is a value, a publisher and a subscriber all in one
let currentValueSubject = CurrentValueSubject<Bool, Never>(true)
print(currentValueSubject.value)
@arashkashi
arashkashi / AsynchronousOperation.swift
Last active September 26, 2019 09:01 — forked from Sorix/AsynchronousOperation.swift
Subclass of NSOperation to make it asynchronous in Swift 3
//
// AsynchronousOperation.swift
//
// Created by Vasily Ulianov on 09.02.17.
// Copyright © 2017 Vasily Ulianov. All rights reserved.
//
import Foundation
/// Subclass of `Operation` that add support of asynchronous operations.
@arashkashi
arashkashi / CollectionViewDataSource.swift
Created February 24, 2017 13:02 — forked from andymatuschak/CollectionViewDataSource.swift
Type-safe value-oriented collection view data source
//
// CollectionViewDataSource.swift
// Khan Academy
//
// Created by Andy Matuschak on 10/14/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
//
import UIKit