Combine Framework
Publishers, subscribers, operators, subjects, backpressure, error handling, schedulers
1What is a Publisher in Combine?
What is a Publisher in Combine?
Câu trả lời
A Publisher is a fundamental protocol in Combine that describes how a sequence of values can be delivered over time. It is responsible for emitting values or errors to subscribers that connect to it. Understanding this concept is essential for working with Combine, as all other framework elements depend on this publication model.
2What is a Subscriber in Combine?
What is a Subscriber in Combine?
Câu trả lời
A Subscriber is a protocol that defines how to consume values emitted by a Publisher. It has three essential methods: receive(subscription:) to acknowledge the subscription, receive(_:) to handle values, and receive(completion:) to manage completion or errors. It is the receiving end of the data flow in Combine.
3Why should one store the AnyCancellable returned by subscribe()?
Why should one store the AnyCancellable returned by subscribe()?
Câu trả lời
AnyCancellable is a token that keeps the subscriber alive. Without storing it in a property or variable, the object is immediately deallocated, canceling the subscription. This common mistake causes the data flow to stop immediately. Keeping AnyCancellable ensures the subscription remains active as long as needed.
What is the main role of an operator in Combine?
What is the difference between a Publisher and a Subscriber?
+21 câu hỏi phỏng vấn
Các chủ đề phỏng vấn iOS khác
Swift Basics
Swift Language Essentials
UIKit Fundamentals
UIViewController Lifecycle
UserDefaults & Keychain
Application Lifecycle
Auto Layout & Constraints
UITableView & UICollectionView
SwiftUI Basics
SwiftUI State Management
SwiftUI Navigation
Networking & URLSession
Codable & JSON Parsing
Core Data
Protocol Oriented Programming
MVVM Architecture
Push Notifications
Unit Testing & XCTest
UI Testing
Xcode & Build System
Swift Package Manager
Memory Management & ARC
Concurrency & async/await
iOS Design Patterns
Performance Optimization
Security & Encryption
SwiftUI Advanced
iOS Application Architecture
Nắm vững iOS cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí