Skip to content

How to prevent app storage with defined store to leak among tests? #117

Answered by stephencelis
jiledaa asked this question in Q&A
Discussion options

You must be logged in to vote

@jiledaa It is not valid to construct a store with a suite name like this. If you expand the warning it tells you how to address the problem:

'@Shared(\(self))' was given a new store object for an existing suite name \
(\(suiteName.debugDescription)).
Shared app storage for a given suite should all share the same store object to \
ensure synchronization and observation. For example, define a store as a \
'static let' and refer to this single instance when creating shared app storage:
extension UserDefaults {
nonisolated(unsafe) static let my…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by jiledaa
Comment options

You must be logged in to vote
2 replies
@stephencelis
Comment options

@jiledaa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants