Skip to content

Instantly share code, notes, and snippets.

View crisanvlad's full-sized avatar
🎯
Focusing

Vlad crisanvlad

🎯
Focusing
View GitHub Profile
@crisanvlad
crisanvlad / CombineLatestFailure.swift
Created September 18, 2025 17:07
CombineLatest failures
//
// TestViewModel.swift
// TestCombine
//
// Created by Vlad Crisan on 18.09.2025.
//
import Combine
import Foundation
class Cache<Key: Hashable, Value> {
private let _cache: OSAllocatedUnfairLock<[Key: Value]>
init() {
_cache = OSAllocatedUnfairLock(initialState: [:])
}
func get(_ key: Key) -> Value? {
_cache.withLock { cache in
cache[key]