All bites
The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.
4330 bites
Page 140
Minimizing Storyboard merge conflicts
Split into many small storyboards or xibs, or move to programmatic or SwiftUI layout; process-wise coordinate ownership and merge often.
Decoding a heterogeneous JSON array by a type field
Peek the type field with a partial decode, switch on it, and decode the concrete type, wrapping each in an enum or boxed protocol value.
Retain cycles and how to break them
A cycle is two objects (or a closure and its owner) holding mutual strong references so neither deallocates; break it with a [weak] or [unowned] capture list.
Purpose of the guard statement
Guard requires its condition to hold or else exits the scope, and unwrapped optionals stay in scope afterward; this flattens nesting versus if.
Closures and trailing closure syntax
Closures are self-contained function blocks that capture surrounding state; a final closure parameter can be passed as a trailing closure outside the parentheses.
do-try-catch versus Optional return types
Throwing functions with do/try/catch convey why something failed via typed Error values; Optionals only say success or absence. Use throws when the caller needs the reason.
Protocols with associated types and opaque types
A PAT leaves a placeholder type unresolved, so it has no single concrete shape and historically could not be used as a bare existential; opaque types with some let you return one fixed underlying conforming…
IBOutlet vs IBAction in Interface Builder
Outlet references a view, action handles an event, both connect via Ctrl-drag.
Push vs Modal Presentation in UIKit
Push adds to a nav stack with back, modal presents a self-contained interrupting flow.
Building a Card Flip Animation in SwiftUI
Drive a flipped state, rotate both faces with rotation3DEffect, hide the back face.
Generating Video Thumbnails with AVAssetImageGenerator
Load AVAsset, configure AVAssetImageGenerator, request the time off the main thread, hop back to update UI.
setUp() and tearDown() in XCTestCase
SetUp builds fresh state before each test, tearDown cleans up after, ensuring independence.
Making a Legacy UIViewController Testable
Extract logic into a testable view model, inject dependencies, keep the controller a thin humble object.
Resolving Conflicting Transitive Versions in SPM
SPM allows only one version per package, so diagnose the graph, then update, pin, or fork to find an overlap.
Decoupled Cross-Module Navigation in Modular iOS
Depend on a shared abstraction, register concrete routers in a coordinator or registry, resolve at runtime.
XCFrameworks and Binary Distribution Trade-offs
XCFramework bundles slices for multiple platforms/architectures, used to hide source or speed builds.

Explain the CSS box model: content-box vs border-box
Tests if you understand how width maps to rendered size. Good answers contrast content-box (350px + 10px border = 370px) with border-box (stays 350px) and note that four width:25% items break under content-box. Red flag: saying border-box includes margin.

What color wins when an ID and class rule conflict?
Red wins; an ID scores 1-0-0 while a class scores 0-1-0, so the ID rule beats the class rule.

How do class and ID selectors differ in specificity and use case?
IDs are 1-0-0 and meant for unique elements; classes are 0-1-0 and reusable.

Describe the full CSS cascade precedence order
This tests deep cascade knowledge beyond specificity. A strong answer lists the six origins in order, notes !important reverses them, then layers, specificity, and source order.