Skip to content
Back to skills

301 Controls 7cf464a6

ASecurity

Use native controls for settings and configuration screens, keeping labels accessible and state bindings clear.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
ai-agentsswift

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 301-controls_7cf464a6 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 301 Controls 7cf464a6?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 301 Controls 7cf464a6
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-301-controls-7cf464a6/badge)](https://www.skillsdirectory.com/skills/tools-only-301-controls-7cf464a6)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Controls (Toggle, Slider, Picker)

## Intent

Use native controls for settings and configuration screens, keeping labels accessible and state bindings clear.

## Core patterns

- Bind controls directly to `@State`, `@Binding`, or `@AppStorage`.
- Prefer `Toggle` for boolean preferences.
- Use `Slider` for numeric ranges and show the current value in a label.
- Use `Picker` for discrete choices; use `.pickerStyle(.segmented)` only for 2–4 options.
- Keep labels visible and descriptive; avoid embedding buttons inside controls.

## Example: toggles with sections

```swift
Form {
  Section("Notifications") {
    Toggle("Mentions", isOn: $preferences.notificationsMentionsEnabled)
    Toggle("Follows", isOn: $preferences.notificationsFollowsEnabled)
    Toggle("Boosts", isOn: $preferences.notificationsBoostsEnabled)
  }
}
```

## Example: slider with value text

```swift
Section("Font Size") {
  Slider(value: $fontSizeScale, in: 0.5...1.5, step: 0.1)
  Text("Scale: \(String(format: \"%.1f\", fontSizeScale))")
    .font(.scaledBody)
}
```

## Example: picker for enums

```swift
Picker("Default Visibility", selection: $visibility) {
  ForEach(Visibility.allCases, id: \.self) { option in
    Text(option.title).tag(option)
  }
}
```

## Design choices to keep

- Group related controls in a `Form` section.
- Use `.disabled(...)` to reflect locked or inherited settings.
- Use `Label` inside toggles to combine icon + text when it adds clarity.

## Pitfalls

- Avoid `.pickerStyle(.segmented)` for large sets; use menu or inline styles instead.
- Don’t hide labels for sliders; always show context.
- Avoid hard-coding colors for controls; use theme tint sparingly.

Files in this skill

  • README.md908 B
  • skill.md1.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.