Skip to content

Instantly share code, notes, and snippets.

View Anatoli-Petrosyants's full-sized avatar

AnatoliPetrosyants Anatoli-Petrosyants

View GitHub Profile
@radutzan
radutzan / UIButton+Actions.swift
Last active December 13, 2018 19:43
A way to declare a UIButton's tap, touch down, and "touch lift" actions through closure properties. See comments for more info.
typealias ButtonAction = (button: UIButton) -> Void
class ButtonActionWrapper: NSObject {
var action: ButtonAction
init(action: ButtonAction) {
self.action = action
}
}
//
// RealmSwift+Codable.swift
//
// Created by Michael Gray on 8/16/17.
//
import Foundation
import RealmSwift
// swiftlint:disable line_length identifier_name
@gokselkoksal
gokselkoksal / Channel.swift
Last active September 16, 2022 03:53
Channel implementation
public class Channel<Value> {
private class Subscription {
weak var object: AnyObject?
private let notifyBlock: (Value) -> Void
private let queue: DispatchQueue
var isValid: Bool {
return object != nil