Skip to content

Instantly share code, notes, and snippets.

View The-Igor's full-sized avatar
🏡
Working from home

Software Engineer The-Igor

🏡
Working from home
View GitHub Profile
@MaciejGad
MaciejGad / NSImageExtensions.swift
Created March 24, 2017 11:49
NSImage extensions for easy resizing, cropping and saving png images. Version updated for Swift 3. Originally by Raphael Hanneken https://gist.github.com/raphaelhanneken/cb924aa280f4b9dbb480
extension NSImage {
/// Returns the height of the current image.
var height: CGFloat {
return self.size.height
}
/// Returns the width of the current image.
var width: CGFloat {
return self.size.width
@M0rtyMerr
M0rtyMerr / combine_vs_RxSwift_perfomance.swift
Last active April 22, 2024 07:48
Combine vs RxSwift perfomance
import XCTest
import Combine
import RxSwift
final class PlaygroundTests: XCTestCase {
private let input = stride(from: 0, to: 10_000_000, by: 1)
override class var defaultPerformanceMetrics: [XCTPerformanceMetric] {
return [
XCTPerformanceMetric("com.apple.XCTPerformanceMetric_TransientHeapAllocationsKilobytes"),
@inamiy
inamiy / SwiftUI-emulating-React-Hooks.swift
Last active March 20, 2023 07:19
SwiftUI emulating React custom hooks (DynamicProperty composition) https://twitter.com/inamiy/status/1313343537132433409
import SwiftUI
struct ContentView: View {
@UseCounter
var counter: Int = 0
@UseCounterEffect(initialCount: 1, onUpdate: { count in
print("===> update: \(count)")
})
var counterEffect: Void