refactor: replace deprecated APIs

I replaced deprecated SwiftUI APIs with new ones.
This commit is contained in:
Kenta Kubo 2024-06-06 02:17:32 +09:00
parent bbab4c95b7
commit fcc41a2bcd
No known key found for this signature in database
GPG key ID: 3D79E20285C94BE8
2 changed files with 5 additions and 5 deletions

View file

@ -267,7 +267,7 @@ extension ContentView: View {
} }
@ToolbarContentBuilder private var toolbarContent: some ToolbarContent { @ToolbarContentBuilder private var toolbarContent: some ToolbarContent {
ToolbarItem(placement: .navigationBarLeading) { ToolbarItem(placement: .topBarLeading) {
Menu { Menu {
Button("DNS-over-TLS", action: self.addNewDoTServer) Button("DNS-over-TLS", action: self.addNewDoTServer)
Button("DNS-over-HTTPS", action: self.addNewDoHServer) Button("DNS-over-HTTPS", action: self.addNewDoHServer)
@ -275,7 +275,7 @@ extension ContentView: View {
Image(systemName: "plus") Image(systemName: "plus")
} }
} }
ToolbarItem(placement: .navigationBarTrailing) { ToolbarItem(placement: .topBarTrailing) {
EditButton() EditButton()
} }
ToolbarItem(placement: .status) { ToolbarItem(placement: .status) {
@ -283,7 +283,7 @@ extension ContentView: View {
HStack { HStack {
Circle() Circle()
.frame(width: 10, height: 10) .frame(width: 10, height: 10)
.foregroundColor(self.isEnabled ? .green : .secondary) .foregroundStyle(self.isEnabled ? .green : .secondary)
Text(self.isEnabled ? "Active" : "Inactive") Text(self.isEnabled ? "Active" : "Inactive")
#if targetEnvironment(macCatalyst) #if targetEnvironment(macCatalyst)
Text("-") Text("-")
@ -307,7 +307,7 @@ extension ContentView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(self.servers[i].name) Text(self.servers[i].name)
Text(self.servers[i].configuration.description) Text(self.servers[i].configuration.description)
.foregroundColor(.secondary) .foregroundStyle(.secondary)
} }
if self.usedID == self.servers[i].id.uuidString { if self.usedID == self.servers[i].id.uuidString {
Spacer() Spacer()

View file

@ -30,7 +30,7 @@ extension LazyTextField: View {
self.text.removeAll() self.text.removeAll()
} label: { } label: {
Image(systemName: "xmark.circle.fill") Image(systemName: "xmark.circle.fill")
.foregroundColor(.primary) .foregroundStyle(Color.primary)
.opacity(0.2) .opacity(0.2)
} }
.buttonStyle(.borderless) .buttonStyle(.borderless)