Tur Flashcards

(160 cards)

1
Q

What is the difference between copy and retain?

A
  • both relates to memory management and object references in Objective-C (particularly)
  • retain increases the retain count of an object (thanks to ARC we don’t have to manually retain/release)
  • copy creates a new independent instance of an object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain code signing.

A
  • security mechanism used by Apple to ensure that only trusted apps run on iOS devices.
  • It involves cryptographically signing your app’s executable and other resources before they can be installed and run on an iOS device.
  • ensuring the app hasn’t been tampered by malicious entity
  • _CodeSignature + embedded.mobileprovision
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain iOS app lifecycle.

A
  • NotRunning
  • Inactive (NotRunning -> UIApplicationDidFinishLaunching , Active -> UIApplicationWillResignActive)
  • Active (Inactive -> UIApplicationDidBecomeActive,
    Background/Suspended -> UIApplicationWillEnterForeground)
  • Background (Active -> UIApplicationDidEnterBackground)
  • Suspended (UIApplicationWillTerminate -> NotRunning)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain the difference between background, suspended and not-running (terminated) app states.

A
  • when the user sends app to the background it goes to the background state
  • in background state the application is inactive, but may execute code (either finite current task, or perform some background tasks – permissions required).
  • after finishing background tasks, the application goes to the suspended state and cannot execute code.
  • when OS needs more memory, it may kill the suspended app.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe Swift language, outline its advantages and disadvantages.

A
  • strongly-typed
  • supports multiple paradigms
  • static typing
  • generics, protocols, optionals, etc..
  • concurrency checking in Swift 6 for data-race free applications
  • Swift is available on multiple platforms (AppleOS’s/Linux/Windows)
  • Swift compiler is based on LLVM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

[Architecture] Explain MVC.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

[Architecture] Compare delegate and KVO patterns.

A
  • both patterns are to provide communication between objects
  • delegation creates one-to-one relationship, it is protocol-based
  • KVO creates many-to-many relationship where messages are broadcasted and all subscribes are being notified
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain protocols to a junior developer.

A
  • protocols define blueprints of methods, properties and other requirements that a conforming type must implement
  • they enable polymorphism and abstraction in a type-safe manner
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain POP to a junior developer.

A
  • a specialized version of the OOP
  • popularized in Swift development
  • extends polymorphism to value-types
  • it is more lightweight and cleaner way to design reusable code
  • ## alternative to a hierarchy of classes via inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What static typing brings to the swift language?

A
  • type safety (errors caught at compile time)
  • performance (reduced runtime overhead thanks to generic specialization)
  • compile-time optimization (because types are fully known at compile time)
  • expressiveness
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

[Generics] How to explicitly specialize a generic function in Swift?

A
  • we need to pass the type explicitly to a function
  • explicit specialization is a process where you explicitly specify a type of a generic function at a call site.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain Generic Specialization to a junior developer.

A
  • swift compiler feature
  • creates type-specific versions of generic methods that are actually in use (previously resolved what set of specialized methods is needed)
  • to avoid runtime type checks
  • depends on optimization compiler’s flag (will be turned off with -Onone) and wholeModuleOptimization
  • happens during SILGen/SILOptimizationPasses compilation stages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain inlining.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe compiler’s optimization flags

A

-O
-O2
-O3
-Onone
-Osize

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Describe WMO (Whole Module Optimization)

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

[Generics] Explain generic type constraints.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

[SwiftConcurrency] What does it mean that a type is Sendable?

A
  • when a type conforms to the Sendable protocol it can be safely passed across concurrency boundaries (tasks, threads)
  • it is guaranteed by the compiler that this type will not introduce data races when passed between concurrent contexts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the difference between Sequence and Collection?

A
  • sequence protocol represents a series of values that can be iterated over one at a time
  • collection protocol represents a finite, repeatable, and random-access group of elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are phantom types and when would you use them?

A
  • Phantom Type to typ obecny w deklaracji generics, ale niewystępujący w runtime.
  • Używany do zapewnienia większego bezpieczeństwa typów, wprowadzania ograniczeń i rozróżnienia semantycznego typów.
  • Jest przydatny w modelowaniu stanów, systemach uprawnień i API, gdzie poprawność kolejności operacji lub rozróżnienie kontekstów jest kluczowe.
  • przykład z modelowaniem grup krwi
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Is it possible to have a type with non-throwing method that is satisfying a throwing protocol method?

A
  • yes, it is possible
  • however, we will still need to call it with try when dealing with the abstraction
  • when dealing with that particular type, we don’t need to call it with try
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

[Generics] Explain conditional conformances in Swift?

A
  • with conditional confromances we can make a generic type conform to a protocol under certain conditions (via type-constraints)
  • it is useful for making recursive design
  • some built-in generics uses conditional conformances in that way - e.g. an Array of Encodables is also Encodable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

[Generics] Explain generics and how we can use them?

A
  • generics enable you to write functions, protocols, classes, actors, structures, or enums that can work with any type, while still maintaining type safety
  • it is a very powerful feature that enables you to write reusable and robust code
  • especially in combination with generic type constraints, conditional conformances, specialized protocols
  • many Swift standard library features are generic, like Array, Dictionary, and Optional
  • however, we should not overuse generics, as it makes code more complex to understand
  • avoid premature generalization and always start with specialized code
  • everything is a trade-off
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Explain local reasoning and locality of behaviour.

A
  • writing clean code, minding encapsulation, immutability, value semantics, etc.. so anybody may understand the logic without knowing the wider context of the system.
  • LoB - good modularization - simmilar/cooperating functionalities should be close together.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Explain the difference between throws and rethrows.

A
  • a rethrowing function is the function that only rethrows errors from functions that were passed to that function as arguments and cannot throw any other (own) errors
  • in order to throw own errors, the function must be marked as throws
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a difference between print and debugPrint?
.
26
[ARC] What are the differences between ARC and GC?
- ARC based on couting references to the object, more deterministic when the object will be destroyed - GC is a totally separated (asynchronius) process - non-deterministic when the GC will destroy the object - ARC struggles with retain cycles - GC is able to resolve retain cycles by itself (using graph traversal)
27
[ARC] What is the difference between weak and unowned?
.
28
Explain terms: LLVM, Clang, Swift, LLDB.
- LLVM is a compiler framework used for developing frontends for various programming languages. - LLVM operates using a language-independent intermediate representation (IR). - Clang is a compiler front end specifically designed by Apple for C, C++, and Objective-C in order to replace GCC compiler and add support for modern programming features like multithreading. - Swift utilizes both LLVM and Clang; it relies on Clang to handle its interactions with C/C++ code while using LLVM to compile Swift code efficiently into machine-native binaries - Clang/Swift compiles source code into LLVM IR, which can then be further optimized and converted into machine code by LLVM.
29
Why don’t Swift classes have a memberwise initializer?
- beacause classes have inheritance - imagine having a class that is inherited and those subclasses are using a memberwise initializer of that class. Changing a set of properties within a superclass will break all of the initializer calls.
30
How do you define a constant that is computed at runtime in Swift?
- get-only computed property - set-once computed property - it is achievable by combining lazy properties and immediately-invoked closure expressions
31
[Networking] Why would you like to use (in what scenarios) a custom URLSession instead of URLSession.shared?
- we can think of a URLSession instance as of an opened tab in the web browser - this instance will cache data, etc.. - so in order to have a fresh tab (like a private one) we may create our own (independent) instance. - there is also specialized URLSession confiuration (ephemeral) that uses no persistent storage for caches, cookies, or credentials.
32
[Networking] Explain the difference between URLSessionConfiguration.default and URLSessionConfiguration.ephemeral
- default configuration is configured to cache data, cache cookies, etc.. - ephemeral doesn't cache any data, it's like opening a private tab in the web browser
33
What’s the difference between Sequence, AsyncSequence, and AsyncStream?
- Sequence continually returns values until the sequence is terminated by returning nil - AsyncSequence protocol is almost identical to Sequence, however values in AsyncSequence are returned asynchronously (the sequence may suspend itself when reading the next value) - AsyncStream is an AsyncSequence we can iterate on, it is initialized with closure with continiuation we can yield to/finish. It is a less powerful alternative to Combine's publishers.
34
[SwiftConcurrency] Describe AsynStream buffering policies.
- unbounded (default) - bufferingNewest() - bufferingOldest()
35
[SwiftConcurrency] What’s the difference between a task and a detached task?
- Task inherits the priority of the caller, any task local values, and its actor context - Task.detached doesn't
36
[SwiftConcurrency] Describe possible priorities of Tasks. How does the system resolve priority if it is set to nil?
- high (GCD's .userInitiated), medium, low (GCD's .utility), background - If the task was created from another task, the child task will inherit the priority of the parent task. - If the new task was created directly from the main thread as opposed to a task, it’s automatically assigned the highest priority of .high. - If the new task wasn’t made by another task or the main thread, Swift will try to query the priority of the thread or give it a nil priority.
37
[SwiftConcurrency] What are the ways to cancel a TaskGroup?
a TaskGroup gets cancelled when: - a parent Task is cancelled - the cancellAll() method was invoked on the group - one of the group tasks thrown an uncaught error
38
[SwiftConcurrency] When would you use async let/Task/TaskGroup?
- TaskGroups are prefect for dynamic amount of asynchronous work to be executed, where there is no need for a specific order of completion - Task - async let is just a sugar syntax for Task, but there is no option to cancel it, nor to pass around, etc.. however in most cases it is enough.
39
[SwiftConcurrency] Explain @TaskLocal property wrapper.
- with @TaskLocal property wrapper we can define task-local values - values that are scoped to a Task - e.g. Task.isCancelled is a task-local value.
40
[SwiftConcurrency] Explain actor isolation
- Only one piece of code at a time can access an actor’s mutable state unless you specifically mark some things as being unprotected.
41
[SwiftConcurrency] @MainActor annotation and inheritance, protocols, extensions.
- from Swift 6 this is automatically checked by compiler - between Swift 5.5 and Swift 5.10 we need to resolve this by ourselves - (1) @MainActor in superclass makes all subclasses @MainActor - (2) @MainActor on superclass's method makes all overrides @MainActor - (3) @MainActor on protocol method makes conformant's method @MainActor if it conform on type definition. When confromance is separated to the extension then need to mark method as @MainActor - (4) @MainActor on the whole protocol makes conformant @MainActor if it conform on type definition. When confromance is separated to the extension then only methods are @MainActor
42
[GCD] Explain QoS, describe all of them and in what situation would you use it?
- userInteractive - userInitiated - utility - background
43
What happens when you invoke a method on a nil pointer?
- Objective-C: nothing (sending a message to a nil objec: NSObject) - Swift: crash when force unwrapped
44
Explain your process for tracing and fixing a memory leak.
- analyse memory usage - analyse memory graph - look for retain cycles and resolve - look for memory spikes and resolve
45
[ARC] Explain how an autorelease pool works at the runtime level.
- ARC mechanism that manages "temporary" object's lifetime (e.g. objects created using factory methods - [NSString string...]) - objects are automatically released after scope ends (pool is drained) - sometimes it is needed to add autorelease around some operations in heavy loops to help runtime.
46
Explain method swizzling. When you would use it?
- this is an Objective-C thing - we can "swizzle" implementation of methods, thanks to Objective-C runtime and dynamic dispatch. - applicable in Swift only for Objective-C classes. - should not be used... - if you want to change behaviour - use protocols/extensions/decorators/...
47
What is the difference between concurrency and paralelism?
- concurrency is about dealing with several tasks at once (switching between tasks/cores-number-agnostic) - paralelizm is about doing several tasks at once (needs hardware support - more than one core)
48
List and describe common problems that may come with concurrency.
- Deadlocks - Race conditions - Starvation - Livelock - Threads explosion
49
What’s the difference between static and dynamic dispatch in Swift?
- static == resolved at compile time (everything preplanned). Faster, but not flexible. Non-polymorphic constructs are statically dispatched (nonpolymorphic value types) - dynamic == resolved at runtime (planning on the run). Slower, but flexibe. Polymorphic contstruct == dynamic dispatch (classes+inheritance/protocols) - marking class/metod as final forces a use of static dispatch - we can use a generic function vs method receiving an existential type to provide a static dispatch instead of dynamic.
50
Explain existential types.
- there exists a type T such that T conforms to a protocol - Swift 6 enforces to explicitly declare existential type variables with (any T)
51
Explain Existential Container.
- enables polymorphism - a wrapper box of fixed size (5 fields x 8bytes) - 3x8bytes - Value Buffer - 8 bytes - pointer to the VWT (how to allocate, copy, destroy described value) - 8 bytes - pointer to the PWT (table structure of pointers to protocol methods implementations)
52
Explain AnyObject, AnyClass, Any
- AnyObject: the protocol to which implicitly all classes/actors conform to - AnyClass: the protocol to which all class types implicitly conform (typealias AnyClass = any AnyObject.Type) - Any: the protocol to which all types implicitly conform to (value-types, reference-types)
53
Why Are Functions Value Types?
- By making functions value types, Swift ensures that function assignments or modifications don’t inadvertently introduce shared state or unexpected behavior.
54
Explain any and some.
- any introduces in Swift 5.7 for explicit type erasure (any Protocol == Protocol), dynamic dispatch - some is so called "opaque return time" - the concrete type is hidden from the user, but is known for the compiler - so it uses static dispatch.
55
What is the difference between Double and Float.
- Double is 64bit, higher precision, default type to represent floating point numbers - Float is 32bit, lower precision - we should use Double, as it is optimized on 64bit architectures.
56
Why classes and inheritance are said to create tight coupling?
- beacause any change to the superclass (method/class's structure) affects its subclasses.
57
Explain the difference between module/library/framework/package.
- module is a code organization unit, it might be a library, framework, app, unit tests bundle, etc..
58
Explain Mach-O types.
- Executable (application) - Dynamic Library - Static Library - Bundle - Relocatable Object File
59
Compare static and dynamic libraries.
. - *Code in the static library that isn't referenced by your program is removed (even if the library is distributed as precompiled).
60
Explain explicitly built modules.
- optimizes build time, as the tasks for building different sources doesn't await missing modules to be compiled first - introduced in Xcode 16 - from now on Xcode cooperates with the compiler - firstly it scans all the files and build the modules graph - then it builds all the extracted modules - then it builds final sources (those which are awaiting modules to be built, because the import them) - then linking
61
Describe the structure of a Swift module.
- The .swiftmodule file is a compiled representation of a Swift module. - every swift module consists of .swiftmodule (.swiftmodule, .swiftdoc, .swiftsourceinfo) which contain metadata about the module's public interface (for autocompletion, typechecking and documentation) - .abi.json (Application Binary Interface) for ABI stability - .swiftinterface for Module stability
62
Explain .modulemap.
- used for Swift/Objective-C interoperability. - file needed to define a module + Xcode DEFINES_MODULE to YES - it contains information which header files to import - thanks to that we can @import Framework in Objective-C code. - if the swift framework won't be integrated into Objective-C codebase, we can skip it.
63
Explain Objective-C Bridging Header and Swift Generated Interface Header.
- needed only in mixed-language project - needed only if a library/framework doesn't define a module (.modulemap) - needed when we mix Swift/Objective-C code under one target. - Objective-C Bridging Header is used for exposing Objective-C code to Swift. - Swift Generated Interface Header is used for exposing Swift code to Objective-C.
64
Explain ABI stability/Module stability/Library evolution.
- ABI - low-level description of the library's interface. It enables a cooperation of the modules built with different versions of the swift compilers. - ABI stability is about mixing versions of Swift at run time. Prior Swift 5.0, every module had to enclose its own version of libswiftCore.dylib. After introducing ABI stability libswiftCore.dylib is a part of the iOS. - Module stability - while ABI stability lets your app run on different OS versions, module stability ensures libraries can be used without recompilation across Swift compiler versions. - Library evolution - a way to keep modules binary compatible - meaning assurance that other modules may use it without being recompiled (resilience).
65
Explain Target/Scheme.
- target - a set of configuration settings that define what to build. Each target can specify: product type, build files, build configurations, resources, build phases. - scheme - offers an additional layer, allowing developers to define various workflows, such as Debug, Release, or even a custom one like ‘Beta Distribution’, it may have pre/post-build scripts, is used to build, run, test, archive products.
66
Explain package access modifier.
- a new access modifier, that exposes api to other modules in the package, but do not expose it publically outside the package. - it enables better encapsualtion for modularised packages.
67
Explain Embed & Sign/Do not embed.
- it is required for dynamic frameworks and dynamic libraries to be embedded at the top of the hierarchy (App target) and signed with App's certificate. They should be marked with "Do not embed" against lower-level modules where they are refrenced. - it doesn't apply to static frameworks and static libraries, as they are embedded with the module that uses them.
68
Is it possible to mix static library with dynamic library and vce-versa?
- we can embed a static library inside a dynamic one - commonly used. - it is possile to reference a dynamic library from the static one, however it requires a dynamic library to be linked against a top-level module (precaution when distributing that kind of library).
69
Explain bitcode.
- bitcode is the intermediate representation of the machine code (simmilar concept to bytecode in Java). It was used in order to eneble building specific-versions of applications at Apple's side - the developer only shipped universal bitcode binary then it could be recompiled for different/future architectures by Apple, without the need to resubmit binaries by developers. - deprecated with Xcode 14 (2023), ABI stability is enough
70
Explain app thinning.
- intermediate process when submitting app to AppStore. - developer submits an universal version of the application - Apple performs slicing (e.g. resources) so there are specific app versions for different devices - when client downloads the app, the appropriate slice is being selected for download.
71
Tell me about UIKit app architecture you were using in your previous company.
- MVVM+C
72
Tell me about SwiftUI app architecture you were using in your previous company.
- TCA - MV+R
73
Why do we sometimes need a persistance layer in our applications?
- nowadays, access to the internet is (mostly) unlimited, so
74
[SwiftUI] What are the advantages against UIKit?
- no need for UIViewControllers to synchronize model and view - SwiftUI framework does it for us - through @State and declarative style. - eliminates the whole class of model-view synchronization problems and makes ui interfaces implementation really quick. - keeping views as value-types seems more perfromant (even though they are destroyed and recreated frequently), they are lightweight, no UIView crazy inheritence. - Great corectness, and Great separation of concerns.
75
[SwiftUI] Explain property wrappers and macros.
- property wrapper is a feature, that allows adding logic to the property's getter/setter/initializer. Exposes wrappedValue and projectedValue that we can access via $ syntax for some extended functionality (can be defined freely), but we can also add other properties. - added in Swift 5.1 - macro is a powerful way to generate code at compile time, enabling metaprogramming. - added in Swift 5.9 - freestanding vs attached macros
76
[SwiftUI] Explain @State and @Binding.
- @State is a tool for transfering a mutability of a property to a special place that is managed by SwiftUI framework. - @State is for managing data that is local to the view. - Every @State property is a new Source of Truth. - @Binding is a tool that encapsulates get/set operations on the wrapped value and that is it - the thing that uses it, doesn't need to know where that value comes from. - binding can be derived (with its current value) from a state variable via $.
77
[SwiftUI] Explain View.
- Views are a function of state, not of a sequence of events. - declarative approach shines - you describe a view giving a current state.
78
[SwiftUI] Explain UDF (Uni-directional flow).
- user interacts with a view - action mutates the state (Source of Truth) - view is updated according to state changes - view is rendered for the user
79
[SwiftUI] Explain @Environment and @EnvironmentObject.
80
[SwiftUI] Explain @Bindable.
81
[SwiftUI] Discuss about overall approach.
.
82
[Architecture] Explain SOLID.
.
83
[Architecture] Explain DIP, IoC, DI, ServiceLocator, Compositional Root Approach.
.
84
[GCD] How to provide thread-safety using GCD?
- using serial dispatch queues. - using custom concurrent dispatch queues with barrier tasks. (non-blocking write + concurrent reads) - alternatively: use NSLock/DispatchSemaphore - easier to implement, however cannot provide concurrent access - everything is serialized. - alternatively: use actor (Swift 5.5+).
85
[GCD] Explain the difference between async and asyncAndWait.
- async is non-blocking. - asyncAndWait is blocking (simmilarly to sync), but executes on a separate thread.
86
[GCD] Explain NSRecursiveLock.
- enables locking mutliple times for the same thread, when having a recursive function, so the recursive call doesn't introduce deadlocks. - alternatively: we can wrap a recursive method and use NSLock.
87
Compare Array and NSArray.
- Array is type-safe (Array), while NSArray is loosely-typed (Array). - Array can be mutable/immutable depending on let/var declaration. NSArray is immutable. - Array is value-type, NSArray is reference-type. - Array has access to modern Swift features, like map, filter, reduce, etc..
88
[Architecture] Explain and compare MVC, MVP, MVVM.
- MVC separates three layers - Model, View, Controller. Controller handles a lot of things in UIKit - manages the view lifecycle, handles interaction events, handles business logic, etc.. - MVP extracts buisness logic and interaction with Data layer to Presenter, so View (View+ViewController is UIKit) may focus only on rendering, view lifecycle, handling user interactions. - MVVM is event-driven (view observes the viewmodel) and viewmodels is completely independent from the view! - all of these are only guides, we can implement them differently, depending on requirements, abilities, etc..
89
[Architecture] What are the differences between MVP and MVVM?
- MVP talks to the View via some interface, whilst MVVM exposes observable API for the View, so it is completely independent from the View.
90
[UIKit] Explain UIWindow and UIWindowScene.
- UIWindow is a key component in the iOS app lifecycle. - represents a rectangular area on the screen that hosts and displays an app’s content. - it provides a container for views and is associated with a root view controller. - until iOS 13 we had only one UIWindow handled with AppDelegate. - from iOS 13 we have SceneDelegate that is able to handle mutliple windows.
91
Describe how an iOS application can be launched.
- apart from user tapping app icon. - by incoming CoreLocation update (when registered for certain location events). - by incoming CoreBluetooth update (when registered for certain bluetooh/accessory events). - by incoming PushNotification (when APNs configured). - by incoming WatchConnectivity event. - by incoming CarPlay event. - by scheduling periodic background fetches.
92
[HR] Tell me about your professional background.
.
93
[HR] What is the biggest challenge you’ve faced as an iOS Developer?
.
94
[HR] Have you ever mentored junior developers or worked in a leadership role?
- In my previous role, I had ownership of the iOS tech stack, which was used by a team of 5 other developers, so i had to technically lead the whole team, listenning to the needs, resolving problems, helping in adopting this stack in different products. - however i did not literally mentor people in how they should lead their carriers - there where no space for that, everything was too dynamic, it was more like Leadership by example, providing feedback through PRs, etc..
95
[HR] What do you do when you disagree with a team member about a technical solution?
- I believe that healthy debate can lead to better solutions. - I’m open to feedback and willing to adjust my position if the other person provides a valid point I hadn’t considered. - If we can't reach consensus, i'd ask for a 3rd opinion.
96
[HR] How do you handle receiving critical feedback on your work?
- I see feedback as an essential part of the development process, and I believe it helps me become a better developer and team member.
97
[HR] Where do you see yourself professionally in the next 2-3 years?
- In the next 2-3 years, I see myself continuing to grow as an iOS Developer, taking on more complex and challenging projects. - I'm not interested in startup/POC projects anymore. - i want to contribute to something really, really big that has a meaningful impact on the market.
98
Explain dSYMs.
- compiled app is optimized and stripped of certain debugging information to make the final app size smaller. - dSYMs are crucial for understanding what happens when your app crashes in production. They provide the necessary symbol information to decode raw crash reports, enabling you to identify where problems occur in your code
99
Explain @dynamicMemberLookup.
- instructs Swift to call a subscript method when accessing properties using subscript(dynamicMember: String).
100
Explain @objc.
- this attribute is essential for making Swift classes, methods, properties, and other members visible to Objective-C runtime. - useful and required when dealing with ObjC APIs - e.g. when defining selectors for target-action, using KVO, etc..
101
Explain closures.
- so called anonymous function - first-class citizen (can be assigned ti a variable/passed as arguments to fx/returned from the function/stored in collections) - reference-type - an unnamed block of code that can capture and retain references to variables and constants from its surrounding context.
102
Compare type-erasure vs existential types.
- type erasure is often used to avoid dynamic dispatch that existential types provide. - type-erasure is typically implemented using a generic wrapper (compile-time optimization) - both can be used e.g. to unlock a possibility to store objects (of different types) inside a heterogeneous collection. however, existential-type cannot be used if it is using associatedtype.
103
[SwiftConcurrency] Explain term "structured concurrency".
- in unstructured concurrency, tasks are created without a clear relationship to their execution context. - structured concurrency is a significant step forward in modern Swift programming, making concurrency more approachable and reliable. - async/await. - tasks hierarchy. - scoping and cancellation. - errors propagation.
104
Explain the difference between map compactMap and flatMap.
- functor vs monad. - map will return all the values (transformed) - compactMap will return transformed values excluding nils. - flatMap flattens nested collections.
105
Explain the difference between Generic and Opaque type.
.
106
Explain @autoclosure.
- automatically turns an expression into a closure.
107
[SwiftUI] Explain differences between @State/@StateObject/@ObservedObject/@Bindable
- state/stateObject for value/reference types owned by the view. - observedObject for reference types owned by external entities. - bindable if we need to provide a binding from @Observable - alternative to observedObject.
108
[SwiftUI] Explain @Observable vs ObservableObject + @Published.
- @Observable is available from Swift 5.9, it is a new alternative to ObservedObject protocol + @Published.
109
[SwiftUI] Explain why @StateObject should be initialized with @autoclosure @escaping () -> ObjectType, and @ObservedObject shouldn't.
- when using @StateObject within SwiftUI view, the view is taking over the management of the wrapped property lifecycle. It uses a delayed initialziation in order to initialize only once when recreating the whole view. - when using @ObservedObject within SwiftUI, the responsibility for lifecycle management of the wrapped property is on the entity that
110
[SwiftUI] Explain the difference between Text(...) and Text(verbatim: ...).
- Text(verbatim: ...) bypass the localization mechanism.
111
[SwiftUI] Explain App/Scene/View.
- App defines the app’s lifecycle and entry point. - Scene acts as a container for a view hierarchy that you want to display to the user.
112
[SwiftUI] How would you handle Timer inside View?
- private let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() - .onReceive(timer) { _ in ... } - .autoconnect(), because Timer.publish returns ConnectablePublisher.
113
Explain all kinds of properties.
- mutable/immutable (let/var). - instance/type properties. - stored (let/var) - hold values as part of an instance of a class or structure. - stored+lazy (var) - initialization delayed at first access, then stored. - computed (var) - doesn't store values directly, instead, they provide a getter (and optionally a setter) to compute a value dynamically. - instance properties: stored, computed. - type properties: stored (static only), computed (static, class).
114
Explain why cannot lazy let?
- let requires an immediate value at initialization.
115
Explain Immediately Invoked Closures (IIFEs - Immediately Invoked Function Expressions).
- executes at declaration time and store the result. - useful for one-time initialization and encapsulating complex logic.
116
Explain declaration vs definition.
- declaration introduces a name (e.g a variable with a type or a function with signature), it doesn't allocate memory. - definition includes both the declaration and the implementation (body), which allocates memory or provides behavior.
117
[UIKit] How does the responder chain work in UIKit?
Events propagate through a hierarchy of responders (views, view controllers, window, app delegate) until handled.
118
[UIKit] Explain layoutSubviews(), setNeedsLayout(), and setNeedsDisplay()?
- layoutSubviews() updates layouts, - setNeedsLayout() schedules layout updates, - setNeedsDisplay() marks views for redrawing.
119
[UIKit] How does UIKit handle multi-touch gestures internally?
UIKit tracks touches, assigns them to gesture recognizers, and resolves conflicts using dependencies (requireGestureRecognizerToFail).
120
[UIKit] How does UIView’s intrinsicContentSize impact Auto Layout?
Defines a view’s natural size; used by Auto Layout when no explicit size constraints exist.
121
[UIKit] How does UIKit render a UIView to the screen?
Views use Core Animation (CALayer), which composites them using Metal for rendering.
122
[UIKit] What are CATransactions and how do they work with UIView animations?
CATransactions batch animations and layer changes to commit them together, ensuring synchronization.
123
[UIKit] Explain the impact of offscreen rendering and how to detect it.
- Offscreen rendering (caused by cornerRadius + masksToBounds, shadows) slows performance; detected via Instruments (Core Animation).
124
[UIKit] How does UIViewPropertyAnimator differ from UIView.animate(...)?
- UIViewPropertyAnimator supports interactive and interruptible animations, unlike UIView.animate.
125
[UIKit] What happens if you update UI from a background thread?
- UIKit is not thread-safe; updating UI from background threads leads to crashes or undefined behavior.
126
[UIKit] How does UIKit internally handle layout and rendering in a multithreaded environment?
- UIKit runs layout/rendering on the main thread, while Core Animation composites asynchronously.
127
[UIKit] Explain the process of constraint resolution in Auto Layout.
- Auto Layout creates a system of equations, solves for the best fit, and applies calculated frames.
128
[UIKit] What is a “hugging priority” vs. “compression resistance priority”?
- hugging prevents expansion. - compression resistance prevents shrinking.
129
[UIKit] How does prepareForReuse() work in UITableViewCell and UICollectionViewCell?
- resets reusable cells to prevent displaying stale data (e.g., clearing images, text).
130
[UIKit] What happens under the hood when a view controller is presented modally?
UIKit creates a presentation controller, animates the transition, and updates the view hierarchy.
131
[UIKit] What is the difference between show(_:, sender:) and present(_:, animated:)?
- show(_:sender:) context-aware - pushes if inside UINavigationController. - present(_:animated:) always presents modally.
132
[Combine] Explain the difference between share(), multicast(_:), and makeConnectable().
- operators to control how data is sent to multiple subscribers. - share() automatically starts when a subscriber attaches - multicast(_:) requires an explicit connection using a subject. - makeConnectable() delays execution until explicitly connected.
133
[Combine] What is the role of @Published in Combine, and how does it differ from CurrentValueSubject?
@Published is a property wrapper for CurrentValueSubject but only exposes a publisher. CurrentValueSubject allows direct mutation and retains the latest value.
134
What is the purpose of flatMap(maxPublishers:), and how does it control concurrency?
- flatMap transforms a value into a new publisher and allows limiting concurrent inner subscriptions using maxPublishers, preventing excessive parallelism.
135
[Combine] How does combineLatest differ from zip, and when would you prefer one over the other?
- combineLatest emits whenever any input updates. - zip waits for all inputs to emit simultaneously. - use combineLatest for live updates, zip for sequential processing.
136
[Combine] What are type erasers in Combine (AnyPublisher, AnyCancellable), and why are they useful?
- they hide implementation details while keeping pipelines flexible. - AnyPublisher ensures return-type consistency. - AnyCancellable helps manage subscription lifetimes.
137
[Combine] How does Combine’s assign(to:on:) operator work, and what are its limitations?
- automatically updates a property when a publisher emits - limitations: Only works with class properties and can cause retain cycles if not handled properly.
138
[Combine] What are some key strategies to avoid memory leaks when using Combine subscriptions?
- use [weak self] in closures. - store AnyCancellable instances in a Set. - use .handleEvents(receiveCancel:) to debug unsubscriptions.
139
[Combine] How can you bridge Combine with Swift’s async/await using asyncPublisher and values?
- asyncPublisher converts a publisher into an AsyncSequence for use with for-await loops. - values provides an AsyncStream that emits values as they arrive.
140
[Combine] How do you debug complex Combine pipelines efficiently?
- use .print(), .handleEvents(). - Instruments (Timelines & Memory Profiler) to trace emissions and memory usage.
141
[Combine] What are the performance implications of using receive(on:) vs. subscribe(on:)?
- receive(on:) moves updates to the specified thread. - subscribe(on:) controls execution context, useful for background processing.
142
[Combine] Explain backpressure.
- flow control mechanism in reactive-programming that prevents fast data emmiters (publishers) from overwhelming slow consumers (subscribers). - techniques to control rate of emission: buffering, batching, throttling/debouncing.
143
[Combine] Explain the difference between throttle and debounce.
- throttle emits periodically - If multiple events occur, it allows the first (or last, depending on configuration) and ignores the rest until the interval resets. - debounce delays emitting an event until there is a pause in the incoming events for a specified time. - lets say we have a hyperactive user...
144
[Combine] Explain the purpose of Combine framework.
- useful for handling asynchronous streams of data.
145
[Combine] Is Combine framework still useful after introducing AsyncStreams?
- yes, as it has wide set of operators for backpressure. - it is still useful when dealing with complex data pipelines. - SwiftUI reactive features are backed by Combine.
146
[Combine] Explain Publisher/Subscriber/Cancellable/Subject.
- publisher emits a stream of data over time, it may signal the completion of the sequence or error. - subscriber consumes data from publisher, demand-driven, controls backpressure, etc. - cancellable is a reference to subscription (bond between publisher and subscriber). - subject is a special publisher that can emit data periodically and we can send data dynamically to it. - PassthroughSubject. - CurrentValueSubject.
147
[Combine] Explain demand-driven model.
- subscriber-driven. - in Combine framework subscribers control the flow of data from publisher, meaning it requests more data from publisher when it is ready to consume. - e.g. backpressure is controlled by subscriber, not publisher.
148
[Combine] Explain Future/Just/Fail/Empty
- kinds of Publishers - Future emits single value or error and completes. - Just emits single value and completes. - Empty emits no values, just completes. - Fail emits no values, just fails.
149
Explain the difference between broadcast and multicast.
- multicast targets specific groups of receivers. - broadcast sends data to all potential receivers on the network.
150
Explain side effects.
- refer to any changes that has effects outside of the fucntion's scope. - any operation that affects the state of the system.
151
Explain sorting algorithms utilized by Swift.
- introsort (hybrid quicksort/heapsort/insertionsort) for sotring collections - timsort (hybrid mergesort/insertionsort) for SwiftUI List - both are O(n log n)
152
[SwiftConcurrency] What is a Task for?
- a unit of asynchronous work that runs in a structured concurrency environment. - it allows running async code in a non-blocking way.
153
[SwiftConcurrency] What is an Actor for?
- an Actor in Swift is a reference type that ensures thread-safe access to its mutable state by serializing access to its properties and methods - prevents data races in concurrent code.
154
[SwiftConcurrency] What is a GlobalActor for?
- a GlobalActor in Swift ensures that specific code always runs on the same, isolated execution context. - prevents data races in concurrent environments.
155
Explain static library.
- static library is linked at the compile time, it increases the enclosing module size.
156
Explain dynamic library.
- dynamic library is linked at runtime, it doesn't increase the enclosing module size, but it increases the application start time.
157
Explain agile.
- a project management and product development methodology that emphasizes flexibility, collaboration, and customer satisfaction. - focuses on iterative progress, continuous improvement, and delivering small, workable pieces of a product over time. - common agile frameworks: scrum, kanban or a mix of those called scrumban.
158
Explain Authentication vs Authorization.
- authentication is the process of verifying who a user is. - authorization is the process of verifying what they have access to.
159
Explain stub vs mock.
- both are test doubles. - stub is simple with predefined behaviour (state-based testing) - mocks are more advanced, we can adjust it at runtime (behaviour-based testing).
160
[SwiftConcurrency] What is Actor reentrancy?
- actors doesn't work like serial queues - if func a() async has suspension point - other task can call a() and mutate actor's state - that is why we should avoid suspending calls between actor's mutable state access.