Skip to content

Instantly share code, notes, and snippets.

View S2dentik's full-sized avatar

Alex Culeva S2dentik

  • Ellation
  • Chisinau, Moldova
View GitHub Profile
@S2dentik
S2dentik / SwiftUIClock.swift
Created April 29, 2020 18:39
Simple Clock built using SwiftUI and Combine
import SwiftUI
import Combine
import Foundation
import PlaygroundSupport
// Make it animatable
struct ClockModel: VectorArithmetic {
static func - (lhs: ClockModel, rhs: ClockModel) -> ClockModel {
ClockModel(seconds: lhs.seconds - rhs.seconds)
}
@S2dentik
S2dentik / Delegate.swift
Last active June 21, 2017 00:38
Generic Delegate class to encapsulate general delegate ideas like using `: class` and `weak` everywhere and calling methods on some specific queue everytime.
import Foundation
protocol Delegatable: class {
var queue: DispatchQueue? { get }
associatedtype Delegatables
func call(_ method: Delegatables)
}
extension Delegatable {