mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
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.
This commit is contained in:
50
apple/VniDrop/UI/Components/Buttons.swift
Normal file
50
apple/VniDrop/UI/Components/Buttons.swift
Normal file
@@ -0,0 +1,50 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user