Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaa committed Oct 22, 2023
1 parent cb97d1f commit 379b46d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion watchOS/メニュー.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct メニュートップ: View {
ガイドメニュー()
}
.navigationTitle("メニュー")
.toolbar { 閉じるボタン(self.dismiss) }
.modifier(閉じるボタン(self.dismiss))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion watchOS/増減モード.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct 手駒増減メニュー: View {
}
.listStyle(.plain)
.navigationTitle(self.陣営 == .王側 ? "王側の手駒" : "玉側の手駒")
.toolbar { 閉じるボタン(self.dismiss) }
.modifier(閉じるボタン(self.dismiss))
}
init(_ ジンエイ: 王側か玉側か) { self.陣営 = ジンエイ }
}
25 changes: 16 additions & 9 deletions watchOS/閉じるボタン.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import SwiftUI

struct 閉じるボタン: ToolbarContent {
struct 閉じるボタン: ViewModifier {
private var dismiss: DismissAction
var body: some ToolbarContent {
ToolbarItem(placement: .cancellationAction) {
Button(role: .cancel) {
self.dismiss()
フィードバック.軽め()
} label: {
Image(systemName: "xmark")
}
func body(content: Content) -> some View {
if #available(watchOS 10.0, *) {
content
} else {
content
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button(role: .cancel) {
self.dismiss()
フィードバック.軽め()
} label: {
Image(systemName: "xmark")
}
}
}
}
}
init(_ dismiss: DismissAction) {
Expand Down

0 comments on commit 379b46d

Please sign in to comment.