Swift
Completed
-
Section 1: Getting Started
-
Section 2: Core Syntax
-
Section 3: Optionals
-
Section 4: Object-Oriented and Value Types
-
Section 5: Memory Management
-
Section 6: Generics and Error Handling
-
Section 7: Concurrency
-
Section 8: Working with Collections
-
Section 9: Codable and Data Handling
-
Section 10: Protocol-Oriented Programming
-
Section 11: Testing and Tooling
-
Section 12: Practical Projects
-
Section 13: Interview Practice
-
Section 14: More Practice Exercises
-
Section 15: More Standard Library
-
Section 16: Advanced Concurrency
-
Section 17: Foundation Framework Deep Dive
-
Section 18: URLSession and Networking Deep Dive
-
Section 19: Combine Framework
-
Section 20: SwiftUI Fundamentals for Swift Developers
-
Section 21: Server-Side Swift with Vapor
-
Section 22: Swift Package Manager Deep Dive
-
Section 23: Swift Concurrency Deep Dive
-
Section 24: More Language Features
-
Section 25: Error Handling Deep Dive
-
Section 26: Testing Deep Dive
-
Section 27: Data Structures and Algorithms in Swift
-
Section 28: More Practice Exercises
-
Section 29: More Interview Practice
-
Section 30: Swift Macros (Swift 5.9+)
-
Section 31: Property Wrappers Ecosystem
-
Section 32: Swift Interop Deep Dive
-
Section 33: iOS App Architecture Patterns
-
Section 34: Performance and Debugging
-
Section 35: App Distribution and CI/CD
-
Section 36: More Practical Projects
-
Section 37: SwiftData and Persistence
-
Section 38: More Design Patterns
-
Section 39: More Review and Practice
-
Section 40: More Foundation Deep Dive
-
Section 41: Advanced Collections in Swift
-
Section 42: Advanced Generics Practice
-
Section 43: UIKit for Legacy and Hybrid Apps
-
Section 44: watchOS and visionOS Development Basics
-
Section 45: More Networking Patterns
-
Section 46: More Testing Practice
-
Section 47: Accessibility in Swift Apps
-
Section 48: Localization
-
Section 49: More Practical Projects Round 2
-
Section 50: Swift Charts Framework
-
Section 51: More Interview and Algorithm Practice
-
Section 52: Final Practice and Mastery
-
Section 53: Swift Compiler and Build System
-
Section 54: More Concurrency Practice
-
Section 55: App Store Guidelines and Review
-
Section 56: More Design and Architecture
155: App Thinning and Bitcode
You've probably seen the "App Thinning" section in your project settings and assumed it's just a fancy way of saying "compression." I see this all the time: developers think that when they upload a "Universal Binary" to App Store Connect, Apple just zips it up and the iPhone unzips it upon installation. They assume the user's device is downloading everything—every single image resolution, every architecture slice—and just ignoring the parts it doesn't need.
The "One-Size-Fits-All" Binary Myth
If that were true, your app's download size would be catastrophic. Imagine you have a professional photo editing app with 4K textures for the iPad Pro and low-res versions for the iPhone SE. If the iPhone SE had to download the 4K assets just to ignore them, you'd be wasting hundreds of megabytes of the user's data and storage. That's not how it works. The binary you upload to Apple is the "Fat Binary," but that's not what the user ever actually downloads.
Slicing: Serving Only What's Necessary
The magic is actually called Slicing. When a user hits "Get" on the App Store, the store looks at the specific device requesting the app. It then creates a "sliced" version of your app on the fly. If the user is on an iPhone 15, Apple strips out the iPad-specific assets, the 1x resolution images (from the ancient days), and any code architectures that the A17 chip doesn't use.
This happens entirely on Apple's servers. You don't have to write a single line of code to make this happen; you just provide all the assets (1x, 2x, 3x) and the various architectures, and Apple handles the surgical removal of the waste.
On-Demand Resources: Beyond the Initial Download
Slicing handles the hardware differences, but what about content that the user might not even need for weeks? This is where On-Demand Resources (ODR) come in. I once worked on a game where the initial download was 2GB because of the high-res textures for later levels. Users were dropping off during the download process because it took too long.
By implementing ODR, we tagged the assets for Levels 10 through 50 as "On-Demand." The user only downloaded the assets for the first few levels. As they progressed, the app would request the next set of assets from the App Store in the background. Here is the general flow of how you'd handle that in your code:
import GameKit
// Requesting a specific tag of resources
let request = NSBundleResourceRequest(tags: ["Level10Assets"])
request?.beginAccessingResources { error in
if let error = error {
print("Error loading assets: \(error)")
return
}
// Now you can safely access the files in the bundle
print("Level 10 assets are ready to use!")
}
The Bitcode Transition
You might see mentions of Bitcode in older tutorials. For years, Bitcode allowed Apple to re-compile your app's binary on their servers to optimize it for new chips without you having to submit a new build. It was a great safety net.
However, here is a bit of a "pro tip" update: Apple has largely deprecated Bitcode starting with Xcode 14. For the vast majority of modern iOS, iPadOS, and watchOS apps, you no longer need to worry about enabling or disabling it. The industry has moved toward a more streamlined build process where the optimizations happen before the upload or through different mechanisms. If you're working on a legacy project and see a "Bitcode" error, you're likely looking at a build setting that is no longer relevant for current App Store submissions.
📋 Practical Task
Configuring an On-Demand Asset Tag for a Level-Based App
In this exercise, you will simulate the setup of On-Demand Resources for a hypothetical game called "SwiftQuest." You aren't writing the full game, but you are implementing the resource management logic.
- Create a new Swift project.
- Create a folder in your project named
Level2Assetsand add a few large dummy files (like high-res images or sound files) to it. - In the Target settings, go to the Build Phases tab.
- Find the
Copy Bundle Resourcessection. - Select your
Level2Assetsfolder and, in the Resource Tags field in the File Inspector (right-hand sidebar), assign the tag"Level2". - Set the On-Demand Resource Tag property to
"Initial Install: No"(this ensures it isn't downloaded with the app). - Write a function
loadLevelTwo()that usesNSBundleResourceRequestto fetch the"Level2"tag and prints a success message to the console once the assets are available.
There are no comments for now.