Swift вопросы и ответы для интервью
Вопрос 1. What is the purpose of the 'NSCoding' protocol in Swift?
The 'NSCoding' protocol is used for encoding and decoding objects, typically for archiving and unarchiving data in iOS and macOS apps.
Вопрос 2. Explain the concept of key paths in Swift.
Key paths provide a way to reference properties in a type-safe manner. They are used in KVO, functional programming, and the 'Codable' protocol.
Вопрос 3. How does Swift handle memory leaks, and what are some common causes?
Swift uses Automatic Reference Counting (ARC) to manage memory, but memory leaks can still occur if strong reference cycles are created. Common causes include strong reference cycles between objects.
Вопрос 4. What are Swift access control levels, and how are they used?
Swift has five access control levels: 'open', 'public', 'internal', 'fileprivate', and 'private'. They control the visibility of classes, methods, and properties.
Вопрос 5. What is Swift?
Swift is a programming language developed by Apple for iOS, macOS, watchOS, tvOS, and Linux applications.
Самое полезное по оценкам пользователей:
- What is Swift?
- Explain optionals in Swift.
- What is the difference between 'let' and 'var' in Swift?
- What are property observers in Swift?
- What is the purpose of the 'static' keyword in Swift?