Skip to content

Instantly share code, notes, and snippets.


Yonathan Goriachnick yoni-g

  • BA-link
  • Israel
View GitHub Profile
nalexn / CancelBag.swift
Last active May 20, 2022
Collecting AnyCancellable tokens in declarative SwiftUI fashion
View CancelBag.swift
// Copyright © 2019 Alexey Naumov. MIT License
import Combine
typealias CancelBag = Set<AnyCancellable>
extension CancelBag {
mutating func collect(@Builder _ cancellables: () -> [AnyCancellable]) {
View add border to an image swift 3
func imageByAddingBorder(width: CGFloat, color: UIColor) -> UIImage? {
let imageRect = CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height)
self.draw(in: imageRect)
let context = UIGraphicsGetCurrentContext()
let borderRect = imageRect.insetBy(dx: width / 2, dy: width / 2)
crisbit / ElapsedTime.swift
Created Dec 14, 2016
Calculate elapsed time in Swift
View ElapsedTime.swift
let start = Date()
print("Elapsed time: \(start.timeIntervalSinceNow) seconds")
hujunfeng /
Last active Oct 28, 2021
UDID, identifierForVendor and advertisingIdentifier FAQ

What's the difference between UUID, GUID and UDID?

  • UUID (Universally Unique Identifier): A sequence of 128 bits that can guarantee uniqueness across space and time, defined by [RFC 4122][rfc4122].

  • GUID (Globally Unique Identifier): Microsoft's implementation of the UUID specification; often used interchangeably with UUID.

  • UDID _(Unique Device Identifier)): A sequence of 40 hexadecimal characters that uniquely identify an iOS device (the device's Social Security Number, if you will). This value can be retrieved through iTunes, or found using UIDevice -uniqueIdentifier. Derived from hardware details like MAC address.

Is UDID deprecated?