Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Raywenderlich Tutorial Team, Josh Berlin, René Cacheaux

Rating No ratings yet

Apply Different Architectures to Your Codebase!Advanced iOS App Architecture guides you through building one real-world app written in different architectures to give you hands-on and practical experience working in different architectures. This book will also guide you through the theory you need to gain a solid foundation of architecture concepts so that you can make your own informed decisions on how to use them in your codebase.Who This Book Is ForThis book is for intermediate iOS developers who already know the basics of iOS and are looking to build apps using defined architectures, making apps cleaner and easier to maintain.Topics Covered in Advanced iOS App ArchitectureNavigating Architecture Topics: Learn the theory behind various architectures to help inform which works best for you in different situations you may face. Managing Dependencies: Learn how to manage dependencies both internally and externally within your app. MVVM Architecture: Explore the history of the MVVM architecture and begin building KOOBER - the book's project app - using MVVM principles. Redux Architecture: Explore the history of the Redux architecture and continue building KOOBER using Redux principles. Elements Architecture: Explore the history of the Elements architecture and continue building KOOBER using Elements principles.After reading this book, you'll have the knowledge to decide which types of architecture components suit your apps and you'll have a deep understanding of the covered architectures.About the iOS Architecture TeamThe architecture team is a group of seasoned developers who work for large multi-national companies who deal with large and diverse code bases on a daily basis. The knowledge procured over years of development is now being transferred to you through book. We hope you enjoy the book and, hopefully, you'll apply some of the architectures you've learned to your own apps!

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# Advanced iOS App Architecture (Fourth Edition) — Reading Guide ## 【One-Line Pitch】 A hands-on guide for intermediate iOS developers who want to move beyond default MVC and learn how to apply MVVM, Redux, and Elements architectures to real-world apps, using the Koober ride-hailing app as a consistent case study throughout. If you've ever felt your codebase is getting messy and want practical, comparative architecture knowledge, this book is for you. --- ## 【Book Arc】 - **Opening (~0%–9%)**: Introduces the book's premise—building one app (Koober) in multiple architectures—and establishes the core question: "Which architecture is right for me?" The authors present a pragmatic framework for evaluating architectures: understand your current codebase, identify problems, evaluate patterns, and try before committing. They emphasize that there's no perfect universal architecture. - **Early (~9%–16%)**: Explores the symptoms of poor architecture, particularly highly interdependent code that causes unexpected regressions. The chapter on choosing architectures introduces the human factors (team size, experience, deadlines) and technical constraints that should inform your choice, plus a checklist of "gotchas" to watch for when trying new patterns. - **Early (~16%–25%)**: Introduces Koober, the book's example app—a ride-hailing app set in Sydney, Australia. The authors explain why they chose this app: it's complex enough to demonstrate real architectural decisions (user authentication, ride booking, location services) while remaining understandable. This section also covers how architecture creates a common vocabulary for teams. - **Early–Middle (~25%–38%)**: Dives deep into objects and their dependencies—the foundation of any architecture. Covers how dependencies arise (refactoring massive classes), the three types of dependency injection (initializer, property, method), and when to use each. Introduces the factories approach for centralizing dependency instantiation, then moves toward container-based management. - **Middle (~38%–47%)**: Explores dependency scopes and container hierarchies. Each scope (app, user, interaction) maps to a container that manages object lifetimes. The key rule: child containers can ask parents for dependencies, but never the reverse. The section then applies these concepts to Koober, showing how to assemble object graphs using on-demand, factories, and container approaches. - **Late (~47%–end)**: Continues applying dependency management patterns to Koober's codebase, demonstrating how the app delegate uses factories and containers to build view controllers with complex dependency graphs. The book then moves into the architecture-specific chapters (MVVM, Redux, Elements), though the excerpts primarily cover the dependency management foundation. --- ## 【Key Takeaways】 - **There's no single "right" architecture** (Early): The book's central thesis is that architecture is "more of an art than science." What works for one project may fail for another. The pragmatic approach: understand your current codebase, identify specific problems, evaluate patterns, and try before committing. Don't feel pressured to pick one pattern exclusively—you can layer MVVM over Redux or mix approaches creatively. - **Highly interdependent code causes regressions** (Early): The book's motivating problem—small changes breaking unrelated features—stems from poor encapsulation and hidden dependencies. The solution is to limit object dependencies and make required dependencies obvious and visible. This principle underlies every architecture pattern discussed later. - **Architecture creates a shared vocabulary** (Early): Categorizing types by responsibility (UIView, UIViewController, RemoteAPI, DataStore) lets teams break down user stories into concrete tasks. This shared understanding reduces planning time and helps teams self-organize faster. - **Initializer injection is the gold standard** (Early): When an object cannot function without a dependency, use initializer injection—it allows storing dependencies as immutable properties and eliminates nil-handling. Property injection is a fallback for Interface Builder-backed view controllers; method injection is rarely needed but useful for single-method dependencies. - **Factories centralize dependency creation** (Early–Middle): The on-demand approach (instantiating dependencies wherever needed) leads to long, repetitive methods scattered across the codebase. A factories class centralizes ephemeral dependency instantiation, making code more readable and testable—though it doesn't handle long-lived objects like singletons. - **Container hierarchies manage object lifetimes** (Middle): Each scope (app, user, interaction) maps to a container that owns its dependencies. The rule—children can request from parents, never vice versa—ensures that parent containers (which live longer) never depend on child containers that might be destroyed. This is how you manage long-lived dependencies systematically. - **Start small when refactoring to DI** (Middle): The book deliberately introduces dependency injection in steps: on-demand → factories → containers. This staged approach lets you get comfortable with the pattern incrementally, and upgrading from factories to containers is straightforward since the factories class can be converted into a container class. --- ## 【Reading Tips】 - **Skim Chapter 2's theory, but don't skip it**: The "Which Architecture Is Right for Me?" chapter feels abstract, but the evaluation framework and "gotcha" questions (boilerplate? empty proxy files? hard to understand?) are practical tools you'll use when evaluating any architecture. - **Deep-read Chapter 4 on dependencies**: This is the technical heart of the book. The progression from on-demand → factories → containers is the foundation for understanding why MVVM, Redux, and Elements differ. Pay special attention to the container hierarchy rule—it's the key insight for managing object lifetimes. - **Use Koober as your reference implementation**: The book consistently applies concepts to the same app, so you can compare how each architecture handles the same features. If you get lost in theory, jump to the Koober code to see the concept in action. - **Don't rush the dependency injection sections**: The factories and container approaches may feel over-engineered for small apps. The book acknowledges this—the value becomes clear as apps grow. If you're building small apps, skim these sections and return when your codebase demands it. - **Treat the architecture chapters as comparative, not prescriptive**: The MVVM, Redux, and Elements chapters are designed to show trade-offs, not to declare a winner. Read them with your own project's constraints in mind, and use the "gotcha" checklist from Chapter 2 to evaluate each pattern. --- ## 【Coverage Limits】 The excerpts primarily cover the book's opening theory and the dependency management foundation (Chapters 2–4). The detailed MVVM, Redux, and Elements architecture chapters are mentioned but not covered in the source material—you'll need to read the book for those specifics. --- ##
Excerpt 1
of development is now being transferred to you through book. We hope you enjoy the book and, hopefully, you'll apply some of the architectures you've learned...
View in text
Excerpt 2
ary to use the pattern? These aren’t necessarily bad things. They’re just things to think about as you survey and compare different patterns. Also, don’t fe...
View in text
Excerpt 3
made up of a bunch of factory methods. Some of the methods create dependencies and some of the methods create objects-under-construction. Also, a factories...
View in text
Excerpt 4
through the methods needed to create a MainViewController. You’ll see how to give MainViewController the power to create OnboardingViewControllers by injec...
View in text
Excerpt 5
OS App Architecture Chapter 4: Objects & Their Dependencies Congratulations; you made it to the end! By practicing all the techniques you saw in this chapte...
View in text
Excerpt 6
PickMeUpViewModel, mapViewController: PickMeUpMapViewController, rideOptionPickerViewController: RideOptionPickerViewCo...
View in text
Excerpt 7
esent to the user and which views are currently presented. • High-level state determines whether the user is signed in or signed out. Current user profile ...
View in text
Excerpt 8
meat of the Koober app. It displays the map, the Where To? button and the ride-option picker. It also transitions between multiple states when you are reque...
View in text
Tags
AI categories
iOSProgramming LanguageBackend
ISBN: 195032561X
Publisher: Razeware LLC
Publish Year: 2022
Language: English
File Format: PDF
File Size: 18.9 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…