Intervjuu abi
Intervjuu ettevalmistamine
Jätka
Tööotsing
Vahendid
Tellimus
ET
Telegramm
Logi sisse
Ava menüü
Intervjuu abi
AI assistent
Brauseri laiendus
Vahendid
Laadi alla
KKK / Abi
Intervjuu ettevalmistamine
Küsimuste pank
Intervjuupank
Näidisintervjuud
Mentorid
Vahendid
KKK / Abi
Tööotsing
Tööotsingu automatiseerimine
Turuanalüüs
Tööpakkumised Telegramist
Vahendid
Karjäär
Blogi
KKK / Dokumentatsioon
Telegrami ajaveeb
Telegrami tugi
Juriidiline
Tagasimakse
Tingimused
Privaatsus
Õiguste omanikud
Tagasi küsimuste juurde
Küsimuste pank
iOS - Arendaja
küsimus
Middle+
protokoļs CacheProtocol { associatedtype Value func setValue(_ value: Value?, forKey key: String) func getValue(forKey key: String) -> Value? func fetchValue(forKey key: String, completion: @escaping (Value?) -> Void) } final class Cache<T>: CacheProtocol { private var storage: [String: T] = [:] func setValue(_ value: T?, forKey key: String) { storage[key] = value } func getValue(forKey key: String) -> T? { return storage[key] } func fetchValue(forKey key: String, completion: @escaping (T?) -> Void) { let value = storage[key] completion(value) } } import XCTest final class CacheTests: XCTestCase { override func setUp() { super.setUp() } func testSetAndGetValue() { let cache = Cache<String>() let key: String = "key" let value: String = "value" cache.setValue(value, forKey: key) XCTAssertEqual(cache.getValue(forKey: key), value) cache.setValue(nil, forKey: key) XCTAssertTrue(cache.getValue(forKey: key) == nil) } } CacheTests.defaultTestSuite.run()
Märgi lõpetatuks
Eelmine
Edasi