Files
vnidrop/apple/VniDrop/UI/Components/Buttons.swift
cdricms ea376a382b feat(apple): native SwiftUI app for iOS and macOS
Add a native SwiftUI VniDrop app (Send/Receive/Settings) talking to the
Rust core via generated UniFFI Swift bindings, plus the uniffi-bindgen
helper crate. iOS uses a TabView, macOS a NavigationSplitView sidebar.
2026-07-18 22:06:30 +02:00

51 lines
1.1 KiB
Swift

import SwiftUI
/// Native SwiftUI button styles. Purple accent comes from the app-wide `.tint`.
/// Full-width filled button (`.borderedProminent`). Apply `.fixedSize()` at the
/// call site to shrink it to its content.
struct PrimaryButton: View {
let title: String
let action: () -> Void
var enabled: Bool = true
var body: some View {
Button(action: action) {
Text(title).frame(maxWidth: .infinity).frame(minHeight: 22)
}
.buttonStyle(.borderedProminent)
.controlSize(.large)
.disabled(!enabled)
}
}
/// Full-width bordered (secondary) button.
struct SecondaryButton: View {
let title: String
let action: () -> Void
var enabled: Bool = true
var body: some View {
Button(action: action) {
Text(title).frame(maxWidth: .infinity).frame(minHeight: 22)
}
.buttonStyle(.bordered)
.controlSize(.large)
.disabled(!enabled)
}
}
/// Borderless tinted text button.
struct QuietButton: View {
let title: String
let action: () -> Void
var enabled: Bool = true
var body: some View {
Button(title, action: action)
.buttonStyle(.borderless)
.disabled(!enabled)
}
}