Skip to content

Instantly share code, notes, and snippets.

@atomicbird
atomicbird / NSPersistentContainer+extension.swift
Created May 22, 2020 21:39
Back up and restore Core Data persistent stores
//
// NSPersistentContainer+extension.swift
// CDMoveDemo
//
// Created by Tom Harrington on 5/12/20.
// Copyright © 2020 Atomic Bird LLC. All rights reserved.
//
import Foundation
import CoreData
@tomisacat
tomisacat / CountDownTimer.swift
Last active November 5, 2021 12:46
A simple count down timer using RxSwift
import RxSwift
func count(from: Int, to: Int, quickStart: Bool) -> Observable<Int> {
return Observable<Int>
.timer(quickStart ? 0 : 1, period: 1, scheduler: MainScheduler.instance)
.take(from - to + 1)
.map { from - $0 }
}
//
// RealmSwift+Codable.swift
//
// Created by Michael Gray on 8/16/17.
//
import Foundation
import RealmSwift
// swiftlint:disable line_length identifier_name
@lattner
lattner / TaskConcurrencyManifesto.md
Last active November 4, 2024 21:18
Swift Concurrency Manifesto
@mzaks
mzaks / SwiftCoRoutine.swift
Last active April 15, 2019 15:15
A simple coroutine for swift
import Foundation
public class CoRoutine<T> {
private var index = 0
private var sequence : [T]
private var routine : (T)->()
private let step : Int?
private let deltaTime : TimeInterval?
private(set) public var isCanceled : Bool = false
private(set) public var isDone : Bool = false
@lukaskubanek
lukaskubanek / NSBezierPath+CGPath.swift
Created June 14, 2015 08:19
NSBezierPath+CGPath.swift
import AppKit
public extension NSBezierPath {
public convenience init(path: CGPath) {
self.init()
let pathPtr = UnsafeMutablePointer<NSBezierPath>.alloc(1)
pathPtr.initialize(self)