// // RuleView.swift // DNSecure // // Created by Kenta Kubo on 10/27/20. // import NetworkExtension import SwiftUI struct RuleView { @Binding var rule: OnDemandRule } extension RuleView: View { var body: some View { Form { Section { HStack { Text("Name") TextField("Name", text: self.$rule.name) .multilineTextAlignment(.trailing) } Picker("Action", selection: self.$rule.action) { ForEach(NEOnDemandRuleAction.allCases, id: \.self) { Text($0.description) } } } Section( header: Text("Interface Type Match"), footer: Text("If the current primary network interface is of this type and all of the other conditions in the rule match, then the rule matches.") ) { Picker("Interface Type", selection: self.$rule.interfaceType) { ForEach(NEOnDemandRuleInterfaceType.allCases, id: \.self) { Text($0.description) } } } if self.rule.interfaceType.ssidIsUsed { Section( header: EditButton() .foregroundColor(.accentColor) .frame(maxWidth: .infinity, alignment: .trailing) .overlay(Text("SSID Match"), alignment: .leading), footer: Text("If the Service Set Identifier (SSID) of the current primary connected network matches one of the strings in this array and all of the other conditions in the rule match, then the rule matches.") ) { ForEach(0..