mirror of
https://github.com/kkebo/DNSecure.git
synced 2026-03-11 08:54:36 +00:00
refactor: use #Preview macros
The `#Preview` macro is a simple replacement for the `PreviewProvider` protocol.
This commit is contained in:
parent
d873148619
commit
0ad8d115bc
7 changed files with 44 additions and 58 deletions
|
|
@ -335,8 +335,6 @@ extension ContentView: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView(servers: .constant(Presets.servers), usedID: .constant(nil))
|
||||
}
|
||||
#Preview {
|
||||
ContentView(servers: .constant(Presets.servers), usedID: .constant(nil))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,16 +119,14 @@ extension DetailView: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct DetailView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
DetailView(
|
||||
server: .constant(
|
||||
.init(
|
||||
name: "My Server",
|
||||
configuration: .dnsOverTLS(DoTConfiguration())
|
||||
)
|
||||
),
|
||||
isOn: .constant(true)
|
||||
)
|
||||
}
|
||||
#Preview {
|
||||
DetailView(
|
||||
server: .constant(
|
||||
.init(
|
||||
name: "My Server",
|
||||
configuration: .dnsOverTLS(DoTConfiguration())
|
||||
)
|
||||
),
|
||||
isOn: .constant(true)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,22 +55,20 @@ extension DoHSections: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct DoHSections_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Form {
|
||||
DoHSections(
|
||||
configuration: .constant(
|
||||
.init(
|
||||
servers: [
|
||||
"1.1.1.1",
|
||||
"1.0.0.1",
|
||||
"2606:4700:4700::1111",
|
||||
"2606:4700:4700::1001",
|
||||
],
|
||||
serverURL: URL(string: "https://cloudflare-dns.com/dns-query")
|
||||
)
|
||||
#Preview {
|
||||
Form {
|
||||
DoHSections(
|
||||
configuration: .constant(
|
||||
.init(
|
||||
servers: [
|
||||
"1.1.1.1",
|
||||
"1.0.0.1",
|
||||
"2606:4700:4700::1111",
|
||||
"2606:4700:4700::1001",
|
||||
],
|
||||
serverURL: URL(string: "https://cloudflare-dns.com/dns-query")
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,22 +55,20 @@ extension DoTSections: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct DoTSections_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Form {
|
||||
DoTSections(
|
||||
configuration: .constant(
|
||||
.init(
|
||||
servers: [
|
||||
"1.1.1.1",
|
||||
"1.0.0.1",
|
||||
"2606:4700:4700::1111",
|
||||
"2606:4700:4700::1001",
|
||||
],
|
||||
serverName: "cloudflare-dns.com"
|
||||
)
|
||||
#Preview {
|
||||
Form {
|
||||
DoTSections(
|
||||
configuration: .constant(
|
||||
.init(
|
||||
servers: [
|
||||
"1.1.1.1",
|
||||
"1.0.0.1",
|
||||
"2606:4700:4700::1111",
|
||||
"2606:4700:4700::1001",
|
||||
],
|
||||
serverName: "cloudflare-dns.com"
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,8 +175,6 @@ extension HowToActivateView: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct HowToActivateView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HowToActivateView(isSheet: true)
|
||||
}
|
||||
#Preview {
|
||||
HowToActivateView(isSheet: true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ extension LazyTextField: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct LazyTextField_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LazyTextField("Name", text: .constant(""))
|
||||
}
|
||||
#Preview {
|
||||
LazyTextField("Name", text: .constant(""))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,8 +139,6 @@ extension RuleView: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct RuleView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
RuleView(rule: .constant(OnDemandRule(name: "Preview Rule")))
|
||||
}
|
||||
#Preview {
|
||||
RuleView(rule: .constant(OnDemandRule(name: "Preview Rule")))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue