initial pre-viable version of watch app

This commit is contained in:
2025-07-20 19:44:53 -04:00
parent 33b88cb8f0
commit 68d90160c6
35 changed files with 2108 additions and 179 deletions

View File

@ -0,0 +1,22 @@
import Foundation
import OSLog
struct AppLogger {
private let logger: Logger
init(subsystem: String, category: String) {
self.logger = Logger(subsystem: subsystem, category: category)
}
func debug(_ message: String) {
logger.debug("\(message)")
}
func info(_ message: String) {
logger.info("\(message)")
}
func error(_ message: String) {
logger.error("\(message)")
}
}

View File

@ -0,0 +1,21 @@
import SwiftUI
extension Color {
static func color(from name: String) -> Color {
switch name {
case "red": return .red
case "orange": return .orange
case "yellow": return .yellow
case "green": return .green
case "mint": return .mint
case "teal": return .teal
case "cyan": return .cyan
case "blue": return .blue
case "indigo": return .indigo
case "purple": return .purple
case "pink": return .pink
case "brown": return .brown
default: return .indigo
}
}
}

View File

@ -0,0 +1,9 @@
import Foundation
extension Date {
func formatDate() -> String {
let formatter = DateFormatter()
formatter.dateStyle = .short
return formatter.string(from: self)
}
}

View File

@ -0,0 +1,14 @@
import Foundation
extension Date {
func formatDateET(format: String = "MMMM, d yyyy @ h:mm a z") -> String {
let formatter = DateFormatter()
formatter.timeZone = TimeZone(identifier: "America/New_York")
formatter.dateFormat = format
return formatter.string(from: self)
}
static var ISO8601: String {
"yyyy-MM-dd'T'HH:mm:ssZ"
}
}

View File

@ -0,0 +1,9 @@
import Foundation
extension Date {
func formattedDate() -> String {
let formatter = DateFormatter()
formatter.dateStyle = .short
return formatter.string(from: self)
}
}

View File

@ -0,0 +1,33 @@
import Foundation
import WatchKit
struct HapticFeedback {
static func success() {
WKInterfaceDevice.current().play(.success)
}
static func notification() {
WKInterfaceDevice.current().play(.notification)
}
static func click() {
WKInterfaceDevice.current().play(.click)
}
static func doubleTap() {
WKInterfaceDevice.current().play(.click)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
WKInterfaceDevice.current().play(.click)
}
}
static func tripleTap() {
WKInterfaceDevice.current().play(.notification)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
WKInterfaceDevice.current().play(.notification)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
WKInterfaceDevice.current().play(.notification)
}
}
}