Migrate from ObservableObject to @Observable (Swift Observation)#653
Merged
IvanStepanok merged 65 commits intoopenedx:developfrom Mar 17, 2026
Merged
Migrate from ObservableObject to @Observable (Swift Observation)#653IvanStepanok merged 65 commits intoopenedx:developfrom
IvanStepanok merged 65 commits intoopenedx:developfrom
Conversation
Fix/issue 581
Migrated Course Unit View, CourseContainerViewModel, SignInViewModel, BaseCourseViewModel
Swift, replacing `@ObservedObject` and `@StateObject`. This modernizes the data flow and simplifies the code by leveraging the compiler to automatically manage observation. Also it increases the minimum iOS deployment target to 17.0
Updates the iOS deployment target to version 17.0 in the project settings. Refactors the course outline and progress view to handle loading states correctly.
IvanStepanok
approved these changes
Mar 17, 2026
Contributor
IvanStepanok
left a comment
There was a problem hiding this comment.
You’ve put in a tremendous amount of work! Thank you so much!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #653 +/- ##
========================================
Coverage ? 0
========================================
Files ? 0
Lines ? 0
Branches ? 0
========================================
Hits ? 0
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates ViewModels from the ObservableObject protocol and
@Publishedproperties to the new Swift Observation macro@Observable.As part of this change, the project now targets iOS 17+ as the minimum deployment version, allowing us to rely on modern SwiftUI and observation APIs without backward-compatibility workarounds.
Motivation
ObservableObject +
@Publishedrequires a significant amount of manual work and is error-prone:properties must be explicitly marked as
@Published, it’s easy to forget to publish changes, objectWillChange is implicit and not type-safe.With iOS 17 as the minimum supported version, we can safely adopt Swift’s
@Observablemacro, which provides a compiler-generated, first-class observation mechanism that is:What changed
Before
After
Benefits
@Published, or manual change notifications.