-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
I decided to add a new group to my functioning Settings page today. And I see this very strange behavior. When I added a new SettingGroup to the Stack - the new group is not displayed, and the previous group is displayed twice.
You've got to see it to understand.
Please help!
`
// From Framework: https://github.com/aheze/Setting Library
struct Settings_View: View {
@State private var settings = SettingsManager.shared
// via Delegate
@AppStorage("apiCallCount") var apiCallCount = 0
@Environment(.appTheme) var appTheme // color theme
// maybe we need the deligate
let api = AlphaVantage_API()
var body: some View {
// do not appear to be able to pass into the SettingStack the ENV
// and use the @Environment(\.appTheme) var appTheme // color theme
// .withBackground(color: appTheme.wrappedValue.background) // use color theme
SettingStack {
SettingPage(title: "Settings") {
// Transaction Settings
SettingGroup(header: "Transaction Settings") {
SettingToggle(title: "Show Fees & Commissions",
/* subtitle: "Display transaction fees in buy/sell views", */
isOn: $settings.showTransactionFees)
SettingToggle(title: "Show Buying Power",
/* subtitle: "Display available funds in transaction views", */
isOn: $settings.showBuyingPower)
} // Transaction group
// Market Data Settings
SettingGroup(header: "Market Data") {
SettingToggle(title: "Market Status Display",
/* subtitle: "Show market open/closed status", */
isOn: $settings.marketStatusDisplay)
SettingSlider(
/* title: "Cache Duration", */
/* subtitle: "Hours to cache market data", */
value: $settings.cacheDuration,
range: 1...48,
step: 1
)
} // market data group
SettingGroup(header: "API Statistics") {
SettingText(title: "API Calls Made \(apiCallCount)")
SettingCustomView {
Button("Reset API Counter") {
apiCallCount = 0
}
.foregroundColor(.red)
}
} // API Stats group
// About Section
SettingGroup(header: "About") {
SettingCustomView {
SettingText(title: "Portfolio Equity Curve")
.font(.headline)
SettingText(title: " Version: \(Bundle.main.appVersionLong)")
.font(.caption)
.foregroundStyle(.secondary)
SettingText(title: "© 2025 David A Koontz")
.font(.caption)
.foregroundStyle(.secondary)
}
//FIXME: .withBackground(color: appTheme.wrappedValue.background) // use color theme
} // about group
SettingGroup(header: "Test does this double up") {
SettingCustomView {
SettingText(title: "but does not display...")
}
}
} // settingPage
} // setting stack
} // body view
private static let logger = Logger(
subsystem: "App.View",
category: String(describing: Settings_View.self)
)
} // settings View
`
Metadata
Metadata
Assignees
Labels
No labels
