Skip to content

Commit

Permalink
Attempt to make the watch buttons line up better on iOS18
Browse files Browse the repository at this point in the history
  • Loading branch information
msimms committed Sep 20, 2024
1 parent 136330c commit bd2f0c2
Showing 1 changed file with 37 additions and 20 deletions.
57 changes: 37 additions & 20 deletions Watch App/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,49 @@ struct ContentView: View {
var body: some View {
NavigationStack() {
ScrollView() {
// Start button
Button("Start") {
self.showingActivitySelection = true
}
.confirmationDialog("Select the workout to perform", isPresented: self.$showingActivitySelection, titleVisibility: .visible) {
ForEach(CommonApp.activityTypes, id: \.self) { item in
NavigationLink(item, destination: ActivityView(activityVM: LiveActivityVM(activityType: item, recreateOrphanedActivities: false), activityType: item))
Group() {
// Start button
Button(action: {
self.showingActivitySelection = true
}) {
HStack {
Text("Start")
Image(systemName: "play")
}
}
}

// History button
NavigationLink("History", destination: HistoryView())

// Settings and About buttons
HStack() {
NavigationLink(destination: SettingsView()) {
ZStack {
Image(systemName: "gear")
.confirmationDialog("Select the workout to perform", isPresented: self.$showingActivitySelection, titleVisibility: .visible) {
ForEach(CommonApp.activityTypes, id: \.self) { item in
NavigationLink(item, destination: ActivityView(activityVM: LiveActivityVM(activityType: item, recreateOrphanedActivities: false), activityType: item))
}
}
.frame(minWidth: 0, maxWidth: .infinity)

// History button
NavigationLink(destination: HistoryView()) {
HStack {
Text("History")
Image(systemName: "list.bullet.clipboard")
}
}
NavigationLink(destination: AboutView()) {
ZStack {
Image(systemName: "questionmark.circle")
.frame(minWidth: 0, maxWidth: .infinity)

// Settings and About buttons
HStack() {
NavigationLink(destination: SettingsView()) {
ZStack {
Image(systemName: "gear")
}
}
.frame(minWidth: 0, maxWidth: .infinity)
NavigationLink(destination: AboutView()) {
ZStack {
Image(systemName: "questionmark.circle")
}
}
.frame(minWidth: 0, maxWidth: .infinity)
}
}
.padding(.horizontal)

// iPhone connectivity status
Image(systemName: "iphone")
Expand Down

0 comments on commit bd2f0c2

Please sign in to comment.