Challenge - 5 Problems
Clean Architecture Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
π§ Conceptual
intermediate2:00remaining
Why does clean architecture improve code maintainability?
Which of the following best explains why clean architecture helps maintain large iOS codebases?
Attempts:
2 left
π‘ Hint
Think about how dividing responsibilities helps when fixing bugs or adding features.
β Incorrect
Clean architecture divides code into layers like UI, business rules, and data. This separation means you can change one layer without breaking others, making the app easier to maintain.
β ui_behavior
intermediate2:00remaining
Effect of clean architecture on UI updates
In an iOS app using clean architecture, what happens when you update the UI layer?
Attempts:
2 left
π‘ Hint
Consider how layers depend on each other in clean architecture.
β Incorrect
In clean architecture, the UI layer depends on the business logic but not vice versa. So changing UI does not require changing business logic or data layers.
β lifecycle
advanced2:00remaining
How clean architecture affects app lifecycle management
Which statement best describes how clean architecture helps manage app lifecycle events in iOS?
Attempts:
2 left
π‘ Hint
Think about where UI-related events like view appearing should be handled.
β Incorrect
In clean architecture, lifecycle events like view appearing are handled in the UI layer, so business logic stays independent and testable.
advanced
2:00remaining
Navigation control in clean architecture
In a clean architecture iOS app, where should navigation logic be placed?
Attempts:
2 left
π‘ Hint
Consider separation of concerns and single responsibility principle.
β Incorrect
Navigation is best handled by a dedicated coordinator or router layer to keep UI and business logic clean and focused.
π§ Debug
expert3:00remaining
Identifying a violation of clean architecture
Which code snippet shows a violation of clean architecture principles in an iOS app?
iOS Swift
class ViewController: UIViewController { var userRepository = UserRepository() func fetchUser() { let user = userRepository.getUser() print(user.name) } } class UserRepository { func getUser() -> User { // fetch user from database } }
Attempts:
2 left
π‘ Hint
Think about which layer should create or own other layers in clean architecture.
β Incorrect
In clean architecture, the UI layer should not directly create or depend on data layer classes. Dependency injection or a use case layer should handle this to keep layers separate.