david-swift / settingskit-macos Goto Github PK
View Code? Open in Web Editor NEWAdd a settings window to a SwiftUI macOS app
Home Page: https://david-swift.github.io/SettingsKit-macOS/
License: MIT License
Add a settings window to a SwiftUI macOS app
Home Page: https://david-swift.github.io/SettingsKit-macOS/
License: MIT License
I am new to Swift and am having trouble understanding the use of ColibriComponents.
If the screenshots/images in the markdown files were accompanied by the code for them, that'd be a great solution.
Improve the documentation with more examples of actual usage instead of template code.
That's all, thanks!
No response
Hi @david-swift ,
thank you very much for creating such a great package.
I'm looking for a library which can help me to create a native setting screen for my macOS app and I have just found this repo.
I find that it'd be helpful for us if we can have a sample app demonstrating some common usages for this package.
Wdyt?
N/A
N/A
I wanted to render a TabView within the SettingContent but it doesn't seem to work. Any idea why?
Here is my code:
// App.swift
...
.settings {
SettingsTab(.init("Inline" as String, systemSymbol: .textBelowPhoto), id: "shortcut") {
SettingsSubtab(.noSelection, id: "no-selection") {
InlineSettingsView()
}
}
}
// InlineSettingsView.swift
struct InlineSettingsView: View {
var body: some View {
TabView {
Text("A")
.tabItem {
Label("A", systemSymbol: .person2)
}
Text("B")
.tabItem {
Label("B", systemSymbol: .person2)
}
}
}
}
I wanted to achieve something like this:
This feature doesn't make sense when the user always need to edit something on the sidebar. A misclick might render the "No selection" screen which is just a text "No row selected" etc. Which is kinda annoying.
Allow developers to specify the behavior. Maybe show "No selection" screen only if there is no rows in the sidebar. Otherwise, always select one row.
Not sure.
This is for SettingsSubtab
Basically the title. Is it possible to trigger the Setting window to select a tab after showing up
A method or some other way to set which tab to focus on. Maybe a Binding when creating the Setting View?
Not sure.
Not sure.
This is more of a question than a feature request though. The actions
is working great, however, it's common to show a dropdown menu when clicking on the Plus button, or when clicking on the options
Like this:
How can I achieve this with SettingsKit
?
I can see that the ToolbarAction
body is a Button
. Maybe we should allow developers to specify the body or to create a custom ToolbarAction
(make it a protocol maybe)?
After a new SettingsSubtab is created, SettingsKit does not select that tab automatically. Not a good UX
After a new SettingsSubtab is created, automatically select that tab.
Another solution is allowing developer to specify the $selection
.
Reference:
One of my apps still need to support macOS 12.
Is it possible to use SettingsKit
on macOS 12?
If yes, how can I do it?
Thanks for your great work!
The current implementation of . standardActions {}
uses index
instead of id
for the remove
action. This is quite problematic when the order of the list changes, or when there is a mix of static items and dynamic items.
Let me explain. Given this code:
SettingsTab(.init("Models" as String, systemSymbol: .cpu), id: "model") {
SettingsSubtab(.init("Static Item 1" as String, systemSymbol: .cpu), id: "model-static-1") {
StaticItem1()
}
SettingsSubtab(.init("Static Item 2" as String, systemSymbol: .cpu), id: "model-static-2") {
StaticItem2()
}
for item in dynamicItemList {
SettingsSubtab(.init(item.name, systemSymbol: .cpu), id: "model-\(recordId)") {
DynamicItem(item: item)
}
}
}
.standardActions {
//
} remove: { index in
// handling index here can be annoying, for example when I add more Static item in the front
// will need to increase the check for index each time to find the correct item to be removed
}
When removing an item, I always have to check if the index >= 2 (dynamic) or static. When I add new static item to the settings sub-tabs, it's prone to error.
Maybe support both index and id in the callback parameters? Something like this
.standardActions {
//
} remove: { id, index in
// handling index here can be annoying, for example when I add more Static item in the front
// will need to increase the check for index each time to find the correct item to be removed
}
IMO, id
should be the source of truth, not index
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.