Sobes.tech

protocol SomeProtocol {} func test1_1(value: SomeProtocol) {} func test1_2(value: any SomeProtocol) {}

Senior
Salmon
20

struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // READ ONLY struct FormView: View { @State private var firstname = "" @State private var lastname = "" @State private var email = "" @State private var website = "" var body: some View { Form { TextField("Enter firstname", text: self.$firstname) TextField("Enter lastname", text: self.$lastname) TextField("Enter email address", text: self.$email) TextField("Enter website address", text: self.$website) } } }

Senior
Salmon
19

If you use DispatchQueue with WorkItem and call cancel() — when and how does the cancellation occur?

Senior
Salmon
18

Tell about useful Property Wrappers you've used in a project.

Senior
Salmon
18

Were there interesting sessions/frameworks at the last WWDC that you would like to try applying in your work?

Senior
Salmon
18

final class ProfileViewModel1 { enum State { ... } var state: State = .idle let service: UserService init(service: UserService) { ... } func onBackPress() { // view deinit } func loadUser() { state = .loading Task { [weak self] guard let self else { return } do { let user = try await self.service.fetchUser() self.state = .loaded(user) } catch { self.state = .failed(error.localizedDescription) } } } }

Senior
Salmon
16

Tell me more about your last project — the photo gallery module in Avito, which you were responsible for (short-term rental, booking form, etc.)

Senior
Salmon
16

How do you understand the term 'structured concurrency' in Swift? Does Task.detached fit this concept?

Senior
Salmon
15

Self -> Task -> (strong) Self .... Back -> View desinit -> View model deinit?

Senior
Salmon
15

// Writes `data` to a file named `file`. func writeData(_ data: Data, to file: String) { let documentDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let fileURL = documentDirectoryURL.appendingPathComponent(file) try? data.write(to: fileURL) } // Removes file named `file`. func remove(file: String) { let documentDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let fileURL = documentDirectoryURL.appendingPathComponent(file) try? FileManager.default.removeItem(at: fileURL) } // Reads `Data` from a file named `file`. If the file doesn't exists returns `nil`. func readData(from file: String) -> Data? { let documentDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let fileURL = documentDirectoryURL.appendingPathComponent(file) return try? Data(contentsOf: fileURL) } final class DiskCache<T>: CacheProtocol { func setValue(_ value: T?, forKey key: String) { } func getValue(forKey key: String) -> T? { } func fetchValue(forKey key: String, completion: @escaping (T?) -> Void) { } }

Middle+
RevolutRevolut
15

Briefly introduce yourself and describe your current work.

Middle+
RevolutRevolut
14

What happens when nil is passed to set?

Middle+
RevolutRevolut
14

import UIKit protocol CacheProtocol { associatedtype Value func setValue(_ value: Value?, forKey key: String) func value(forKey key: String) -> Value? func fetchValue(forKey key: String, completion: @escaping (Value?) -> Void) }

Middle+
RevolutRevolut
14

Why did you choose a dictionary as the cache storage?

Middle+
RevolutRevolut
13

Why did the UI render correctly before adding an explicit main-thread dispatch?

Senior
Uzum
8

Why did you create separate load and getLastCities methods, and what should happen if getLastCities is called before data has been loaded?

Senior
Uzum
8

Why use final class instead of class for the cache implementation?

Middle+
RevolutRevolut
7

How would you prioritize the identified issues if the project must go to production in one hour?

Senior
Uzum
7
/85