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) } } } }
iOS
Array { value1 value2 if condition { value3 } }
What is the minimum target iOS version currently in the project?
When you joined the project, was Swift 6 already available, or did the transition happen during your time?
Tell about interesting resources for development — YouTube channels, Telegram channels, communities, tools.
Do you use Viper architecture for UIKit? Does this apply to all applications?
@MainActor final class ViewModel: ObservableObject { @Published var image: UIImage? func onDownloadPhoto(url: URL) { do { let data = try Data(contentsOf: url) image = UIImage.init(data: data) } catch { log.error("Failed to download image: \(error)") } } } Button("Download") { onDownloadPhoto(url) }
Are there issues, hacks, or limitations related to SwiftUI with iOS 16 target compared to iOS 15?
```swift struct ContentView: View { var body: some View { ScrollView { content .padding(20) } .background(Color(.systemGroupedBackground)) .overlay(alignment: .bottom) { continueButton } } } ``` ```swift struct ContentView: View { var body: some View { ScrollView { content .padding(20) } .background(Color(.systemGroupedBackground)) .safeAreaInset(edge: .bottom) { continueButton } } } ```
Tell us about using SwiftUI in a project — what is the policy, how many screens are written in SwiftUI?
When implementing a new screen or feature, do you immediately write in SwiftUI, or are there discussions about choosing between UIKit and SwiftUI?
Self -> Task -> (strong) Self .... Back -> View desinit -> View model deinit?
If you were designing a reusable button component for a design system in SwiftUI with different styles (primary/secondary), how would you implement it?
protocol SomeProtocol { func test() } func test1_1(value: SomeProtocol) {} func test1_2(value: any SomeProtocol) {} func test2_1(value: some SomeProtocol) {} func test2_2<Value: SomeProtocol>(value: Value) {} class A { func test2_2<Value: SomeProtocol>(value: Value) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(value: B())
What is used for presentation modules in UIKit and SwiftUI — what architecture?
Are you currently using GCD or Modern Concurrency (async/await) for new thread-related tasks?
How do you understand the term 'structured concurrency' in Swift? Does Task.detached fit this concept?
If you use DispatchQueue with WorkItem and call cancel() — when and how does the cancellation occur?