Skip to content

Enables nested spice stores to be inlined in separate sections #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 3, 2025

Conversation

simonbs
Copy link
Contributor

@simonbs simonbs commented Mar 3, 2025

Adds support grouping settings into sections.

Description

Settings can be grouped into sections by providing the .inline presentation style when nesting a spice store.

final class AppSpiceStore: SpiceStore {
    @Spice(requiresRestart: true) var environment: ServiceEnvironment = .production
    @Spice(name: "API URL") var apiURL = "http://example.com"
    @Spice(presentation: .inline) var debugging = DebuggingSpiceStore()
}

final class DebuggingSpiceStore: SpiceStore {
    @Spice var enableLogging = false
    @Spice var clearCache = {
        try await Task.sleep(for: .seconds(1))
        URLCache.shared.removeAllCachedResponses()
    }

    fileprivate init() {}
}

Similarly, a nested spice store can be presented modally with the .modal presentation style.

@Spice(presentation: .modal) var debugging = DebuggingSpiceStore()

Motivation and Context

Grouping settings into sections improves organization and enhances readability.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@simonbs simonbs changed the title Adds support grouping settings into sections Enables nested spice stores to be inlined in separate sections Mar 3, 2025
@simonbs simonbs merged commit 6a0fc3b into main Mar 3, 2025
9 checks passed
@simonbs simonbs deleted the feature/sections branch March 3, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants