All questions
Showing of 80What is the View protocol in SwiftUI?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The View protocol is the fundamental building block of SwiftUI. Any struct that conforms to View must implement a computed property called body that returns some View. This represents the content and behavior of the view.
protocol View {
associatedtype Body : View
var body: Self.Body { get }
}
The some View return type is an opaque type that allows the compiler to determine the actual return type while hiding implementation details from the caller.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the concept of "some View" in SwiftUI.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
some View is an opaque return type introduced in Swift 5.1. It tells the compiler that the function will return a specific type that conforms to the View protocol, but the exact type doesn't need to be known by the caller.
Benefits:
- Type Safety: The compiler knows the exact type internally
- Performance: Enables optimizations since the type is known at compile time
- Flexibility: You can return different view types without exposing implementation details
- Automatic Type Inference: The compiler figures out the return type automatically
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are property wrappers in SwiftUI and why are they important?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Property wrappers are a Swift feature extensively used in SwiftUI to manage state and data flow. They provide a clean syntax for adding behavior to properties without cluttering the property declaration.
Common SwiftUI property wrappers:
@State: For local view state@Binding: For two-way data binding@ObservedObject: For external observable objects@StateObject: For object ownership@EnvironmentObject: For dependency injection
struct CounterView: View {
@State private var count = 0 // Property wrapper
var body: some View {
Text("Count: \(count)")
}
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is @State and when should you use it?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
@State is a property wrapper for managing local, private state within a view. It should be used for simple value types that are owned and managed by the view itself.
Key characteristics:
- Local: State belongs to the view
- Private: Should be marked private
- Value Types: Works with structs, enums, and basic types
- Automatic UI Updates: SwiftUI automatically redraws the view when state changes
struct ToggleView: View {
@State private var isOn = false
var body: some View {
Toggle("Switch", isOn: $isOn)
}
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between VStack, HStack, and ZStack.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
These are fundamental layout containers in SwiftUI:
VStack: Arranges views vertically (top to bottom)
HStack: Arranges views horizontally (left to right)
ZStack: Layers views on top of each other (back to front)
VStack { // Vertical stack
Text("Top")
Text("Bottom")
}
HStack { // Horizontal stack
Text("Left")
Text("Right")
}
ZStack { // Layered stack
Circle().fill(Color.blue)
Text("Overlay")
}
Each can take alignment and spacing parameters to control layout behavior.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How does navigation work in SwiftUI?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
SwiftUI provides several navigation mechanisms:
NavigationView/NavigationStack (iOS 16+):
NavigationView {
List {
NavigationLink("Detail", destination: DetailView())
}
.navigationTitle("Main")
}
Sheet Presentation:
@State private var showingSheet = false
Button("Show Sheet") {
showingSheet = true
}
.sheet(isPresented: $showingSheet) {
DetailView()
}
Alert and ActionSheet:
.alert("Error", isPresented: $showingAlert) {
Button("OK") { }
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you create and customize Lists in SwiftUI?
What is the difference between List and ScrollView?
What is the difference between UIView and UIViewController?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
UIView is the fundamental building block for all visual elements in iOS. It represents a rectangular area on the screen and handles drawing and user interaction within that area. Views can contain other views (subviews) and form a view hierarchy.
UIViewController manages a collection of views and coordinates the logic between the model and view layers. It handles view lifecycle events, user interactions, and navigation between different screens.
// UIView - represents visual element
let myView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
myView.backgroundColor = .blue
// UIViewController - manages views and logic
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(myView)
}
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the view hierarchy in UiKit.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The view hierarchy is a tree-like structure where views contain other views as subviews. Each view has a superview (parent) and can have multiple subviews (children). The root view is typically managed by a view controller.
Key characteristics:
- Child views are drawn on top of their parent views
- Coordinate systems are relative to the superview
- Events bubble up through the hierarchy
- Views inherit certain properties from their superviews
let parentView = UIView()
let childView1 = UIView()
let childView2 = UIView()
parentView.addSubview(childView1)
parentView.addSubview(childView2)
// childView2 will be drawn on top of childView1
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are the main properties of UIView?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Key UIView properties include:
- frame: Position and size in superview's coordinate system
- bounds: Internal coordinate system (always origin at 0,0)
- center: Center point in superview coordinates
- backgroundColor: Background color of the view
- alpha: Transparency level (0.0 to 1.0)
- isHidden: Visibility state
- tag: Integer identifier for finding views
- superview: Parent view reference
- subviews: Array of child views
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is Auto Layout and why is it important?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Auto Layout is a constraint-based layout system that automatically calculates the size and position of views based on rules (constraints) you define. It's important because:
- Responsive Design: Adapts to different screen sizes and orientations
- Dynamic Content: Handles varying content sizes automatically
- Internationalization: Supports different languages and text directions
- Accessibility: Works with Dynamic Type and accessibility features
Auto Layout uses mathematical relationships between views instead of fixed frames, making UIs flexible and maintainable.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between UITableView and UICollectionView.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
UITableView displays data in a single column of rows. It's optimized for vertical scrolling and is ideal for lists, settings screens, and hierarchical data.
UICollectionView displays data in a customizable grid layout. It supports multiple columns, horizontal scrolling, and complex layouts like grids, carousels, or custom arrangements.
Key differences:
- TableView: Single column, vertical scrolling, simpler implementation
- CollectionView: Multiple columns, any scroll direction, more flexible but complex
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is UINavigationController and how does it work?
Explain the difference between @State and @StateObject.
What is @Binding and how does it work?
When should you use @ObservedObject vs @StateObject?
What is @EnvironmentObject and when is it useful?
How does data flow work in SwiftUI?
What is the difference between a View and a ViewBuilder?
How do you handle different screen sizes and orientations in SwiftUI?
What is GeometryReader and when should you use it?
What's the difference between sheet, fullScreenCover, and popover?
How do you pass data back from a presented view?
When should you use LazyVStack vs VStack?
How do you implement pull-to-refresh in SwiftUI?
How do view modifiers work in SwiftUI and what is modifier order importance?
What are some ways to apply conditional modifiers?
How do you create custom view modifiers?
How do animations work in SwiftUI?
What's the difference between implicit and explicit animations?
How do you create reusable custom views?
What is the difference between creating a computed property vs a separate View struct?
What are some best practices for SwiftUI performance?
What causes unnecessary view updates and how do you prevent them?
How do you implement MVVM in SwiftUI?
How do you integrate UIKit views into SwiftUI?
How do you integrate SwiftUI views into existing UIKit apps?
What are the limitations of SwiftUI compared to UIKit?
What is the difference between frame and bounds?
Describe the view controller lifecycle methods and their purposes.
When would you use viewWillAppear vs viewDidLoad?
What is the purpose of loadView() and when should you override it?
What are the different types of constraints in Auto Layout?
What is content hugging and compression resistance priority?
How do you resolve Auto Layout conflicts?
What is intrinsic content size?
What is cell reuse and why is it important?
How do you implement a custom table view cell?
What are the required and optional methods of UITableViewDataSource?
How do you implement swipe actions in a table view?
How do you pass data between view controllers?
What is the difference between modal presentation and navigation?
What are the different modal presentation styles?
What are gesture recognizers and how do you use them?
How do you handle multiple gesture recognizers on the same view?
How do you create basic animations in UiKit?
What properties can be animated with UIView animations?
How do you create a custom view with custom drawing?
When should you use drawRect vs adding subviews?
What are the pros and cons of Interface Builder vs programmatic UI?
How do you create UI elements programmatically?
How do you handle memory warnings in view controllers?
How do you implement Dark Mode support in UiKit?
How do you create custom transitions?
How do you create a view that conforms to multiple protocols?
How does SwiftUI's diffing algorithm work?
How do you handle dependency injection in SwiftUI?
How do you implement custom drawing and shapes in SwiftUI?
How do you implement complex gesture recognition?
How do you handle async operations and error handling in SwiftUI?
How do you test SwiftUI views?
What is the responder chain and how does touch handling work?
What is the difference between UIView animations and Core Animation?
How does memory management work with view controllers and strong reference cycles?
What are some best practices for UiKit performance optimization?
What are size classes and how do you use them for adaptive layouts?
What is UIKit Dynamics and when would you use it?
How do you implement accessibility in UiKit applications?
What are some common UiKit design patterns and when to use them?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
SwiftUI & UIKit cheatsheet
- Why SwiftUI is Revolutionary01
- Views and Modifiers02
- Layout System03
- State Management04
- Navigation05
- Lists and Collections06
- Gestures and Animations07
- Data Flow08
- Lifecycle Methods09
- Performance Optimization10
- Advanced Topics11
- Common Interview Questions12
- + 1 more inside
- + 7 more inside
69 of 80 SwiftUI & UIKit answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.