Replace all ContextManager
sharedInstance()
usages with shared
#24187
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.
Apart from being more Swift-y, this will also allow us to differentiate between a shared instance for the Objective-C layer (
CoreDataStack
) and one for the Swift layer (CoreDataStackSwift
).This differentiation will be valuable if/when we'll replace
ContextManager
references withCoreDataStack
/CoreDataStackSwift
so that WordPressDataObjC can refer to the functionality without knowing aboutContextManager
, which is defined in the Swift WordPressData layer.For example, the Objective-C
AbstractPost
implementation references the SwiftContextManager
implementationWordPress-iOS/WordPress/Classes/Models/AbstractPost.m
Line 32 in b8f184b
I'm doing this change in a dedicated PR because there are 100+ usages of
sharedInstance
and because I don't know yet where the work of replacingContextManager
access withCoreDataStack
in the Objective-C layer will bring me...Testing
This is just a simple swap, given that
shared
wrapssharedInstance()
. If the code compiles, we should be good.I still gave the app a run on my device and loaded a few screens just to ensure it runs okay.
Part of #24165