Skip to content

Instantly share code, notes, and snippets.

Avatar
🕵️‍♂️
debugging

Yonathan Goriachnick yoni-g

🕵️‍♂️
debugging
View GitHub Profile
@nalexn
nalexn / CancelBag.swift
Last active Apr 22, 2021
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]) {
formUnion(cancellables())
}
View add border to an image swift 3
func imageByAddingBorder(width: CGFloat, color: UIColor) -> UIImage? {
UIGraphicsBeginImageContext(self.size)
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)
context?.setStrokeColor(color.cgColor)
@crisbit
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
hujunfeng / udid-faq.md
Last active Jun 16, 2021
UDID, identifierForVendor and advertisingIdentifier FAQ
View udid-faq.md

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?