Add bare bones `ProfileConfigurationTableViewController`.

This commit is contained in:
Jeroen Leenarts 2018-05-24 22:07:04 +02:00
parent e528429f0c
commit 6f59c27220
4 changed files with 427 additions and 3 deletions

View File

@ -0,0 +1,51 @@
//
// ProfileConfigurationTableViewController.swift
// WireGuard
//
// Created by Jeroen Leenarts on 24-05-18.
// Copyright © 2018 Wireguard. All rights reserved.
//
import UIKit
import CoreData
import BNRCoreDataStack
protocol ProfileConfigurationTableViewControllerDelegate: class {
}
class ProfileConfigurationTableViewController: UITableViewController {
var viewContext: NSManagedObjectContext!
weak var delegate: ProfileConfigurationTableViewControllerDelegate?
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch indexPath.row {
case 0:
return tableView.dequeueReusableCell(type: InterfaceTableViewCell.self, for: indexPath)
case 1:
return tableView.dequeueReusableCell(type: PeerTableViewCell.self, for: indexPath)
default:
return tableView.dequeueReusableCell(type: AddPeerTableViewCell.self, for: indexPath)
}
}
}
class InterfaceTableViewCell: UITableViewCell {
}
class PeerTableViewCell: UITableViewCell {
}
class AddPeerTableViewCell: UITableViewCell {
}
extension ProfileConfigurationTableViewController: Identifyable {}
extension InterfaceTableViewCell: Identifyable {}
extension PeerTableViewCell: Identifyable {}
extension AddPeerTableViewCell: Identifyable {}

View File

@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
48CF751B34E9703133F1B1AF /* Pods_WireGuard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 861983CAE8FDC13BC83E7E04 /* Pods_WireGuard.framework */; };
4A4BA6D820B73CBA00223AB8 /* ProfileConfigurationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BA6D720B73CBA00223AB8 /* ProfileConfigurationTableViewController.swift */; };
4A4BACE620B5F1BF00F12B28 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BACE520B5F1BF00F12B28 /* AppDelegate.swift */; };
4A4BACE820B5F1BF00F12B28 /* ConnectionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BACE720B5F1BF00F12B28 /* ConnectionsTableViewController.swift */; };
4A4BACEB20B5F1BF00F12B28 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4A4BACE920B5F1BF00F12B28 /* Main.storyboard */; };
@ -44,6 +45,7 @@
/* Begin PBXFileReference section */
0CE52E030FAA93F3BF5747B2 /* Pods-WireGuard.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WireGuard.release.xcconfig"; path = "Pods/Target Support Files/Pods-WireGuard/Pods-WireGuard.release.xcconfig"; sourceTree = "<group>"; };
25E2BE31A33C8CCE6E79B6EF /* Pods-WireGuard.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WireGuard.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WireGuard/Pods-WireGuard.debug.xcconfig"; sourceTree = "<group>"; };
4A4BA6D720B73CBA00223AB8 /* ProfileConfigurationTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileConfigurationTableViewController.swift; sourceTree = "<group>"; };
4A4BACE220B5F1BF00F12B28 /* WireGuard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WireGuard.app; sourceTree = BUILT_PRODUCTS_DIR; };
4A4BACE520B5F1BF00F12B28 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4A4BACE720B5F1BF00F12B28 /* ConnectionsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionsTableViewController.swift; sourceTree = "<group>"; };
@ -161,8 +163,9 @@
isa = PBXGroup;
children = (
4A4BAD1220B5F82400F12B28 /* Identifyable.swift */,
4A4BACE720B5F1BF00F12B28 /* ConnectionsTableViewController.swift */,
4A8AABD720B6A79100B6D8C1 /* UITableView+WireGuard.swift */,
4A4BACE720B5F1BF00F12B28 /* ConnectionsTableViewController.swift */,
4A4BA6D720B73CBA00223AB8 /* ProfileConfigurationTableViewController.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
@ -401,6 +404,7 @@
4A4BACE820B5F1BF00F12B28 /* ConnectionsTableViewController.swift in Sources */,
4A4BAD1020B5F6EC00F12B28 /* RootCoordinator.swift in Sources */,
4A4BAD0E20B5F6C300F12B28 /* Coordinator.swift in Sources */,
4A4BA6D820B73CBA00223AB8 /* ProfileConfigurationTableViewController.swift in Sources */,
4A4BAD2020B6026900F12B28 /* Peer+CoreDataProperties.swift in Sources */,
4A4BAD2320B6026900F12B28 /* Interface+CoreDataClass.swift in Sources */,
4A7F6EDD20B674CD00B260B7 /* Address+CoreDataClass.swift in Sources */,

View File

@ -6,6 +6,8 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@ -54,5 +56,351 @@
</objects>
<point key="canvasLocation" x="34" y="154"/>
</scene>
<!--Title-->
<scene sceneID="xV8-BW-4R7">
<objects>
<tableViewController storyboardIdentifier="ProfileConfigurationTableViewController" id="0VM-73-EPX" customClass="ProfileConfigurationTableViewController" customModule="WireGuard" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="0Uy-k2-O3i">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="InterfaceTableViewCell" rowHeight="368" id="06N-KU-LSv" customClass="InterfaceTableViewCell" customModule="WireGuard" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="368"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="06N-KU-LSv" id="CSX-Am-ix0">
<rect key="frame" x="0.0" y="0.0" width="375" height="367.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="14" translatesAutoresizingMaskIntoConstraints="NO" id="DIe-hK-tf6">
<rect key="frame" x="16" y="11" width="343" height="346"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Interface" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uku-6H-QWf">
<rect key="frame" x="0.0" y="0.0" width="343" height="46"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="uLA-3S-jCk">
<rect key="frame" x="0.0" y="60" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uJE-LK-T3Y">
<rect key="frame" x="0.0" y="0.0" width="343" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6y9-eJ-8fF">
<rect key="frame" x="0.0" y="16" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="wwN-OL-XUr">
<rect key="frame" x="0.0" y="120" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Private key" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fMQ-kK-FD5">
<rect key="frame" x="0.0" y="0.0" width="343" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="26U-vy-7Lc">
<rect key="frame" x="0.0" y="16" width="343" height="30"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hYd-0L-nnY">
<rect key="frame" x="0.0" y="0.0" width="232" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="C1M-bh-5mf">
<rect key="frame" x="240" y="0.0" width="103" height="30"/>
<state key="normal" title="Button"/>
</button>
</subviews>
</stackView>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="LqQ-yU-ag2">
<rect key="frame" x="0.0" y="180" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Public key" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DqG-xF-fZX">
<rect key="frame" x="0.0" y="0.0" width="343" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="(generated)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aXZ-aL-pFu">
<rect key="frame" x="0.0" y="16" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="dqj-8V-yB6">
<rect key="frame" x="0.0" y="240" width="343" height="46"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="1am-cp-4Wr">
<rect key="frame" x="0.0" y="0.0" width="232" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Addresses" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mdx-gd-wO2">
<rect key="frame" x="0.0" y="0.0" width="232" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Oh8-qT-kJL">
<rect key="frame" x="0.0" y="16" width="232" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="nv7-4q-QjM">
<rect key="frame" x="240" y="0.0" width="103" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Listen port" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h1p-Ea-ler">
<rect key="frame" x="0.0" y="0.0" width="103" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="(random)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="CSv-At-WVr">
<rect key="frame" x="0.0" y="16" width="103" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="7fC-XV-6KP">
<rect key="frame" x="0.0" y="300" width="343" height="46"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="NR3-Me-yLc">
<rect key="frame" x="0.0" y="0.0" width="232" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DNS servers" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SA3-N0-wfi">
<rect key="frame" x="0.0" y="0.0" width="232" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ByK-wW-6Q4">
<rect key="frame" x="0.0" y="16" width="232" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="UId-O4-q3t">
<rect key="frame" x="240" y="0.0" width="103" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="MTU" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vYu-BI-0Gj">
<rect key="frame" x="0.0" y="0.0" width="103" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="(auto)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="myM-B2-sjT">
<rect key="frame" x="0.0" y="16" width="103" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstItem="nv7-4q-QjM" firstAttribute="width" secondItem="DIe-hK-tf6" secondAttribute="width" multiplier="0.3" id="1kU-bA-fIi"/>
<constraint firstItem="C1M-bh-5mf" firstAttribute="width" secondItem="DIe-hK-tf6" secondAttribute="width" multiplier="0.3" id="CGs-Ix-e2L"/>
<constraint firstItem="UId-O4-q3t" firstAttribute="width" secondItem="DIe-hK-tf6" secondAttribute="width" multiplier="0.3" id="Tly-iG-ApC"/>
</constraints>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="DIe-hK-tf6" secondAttribute="trailing" id="GkT-4C-4uN"/>
<constraint firstItem="DIe-hK-tf6" firstAttribute="top" secondItem="CSX-Am-ix0" secondAttribute="topMargin" id="Mul-xA-cN9"/>
<constraint firstAttribute="bottomMargin" secondItem="DIe-hK-tf6" secondAttribute="bottom" id="jBh-kE-ZBG"/>
<constraint firstItem="DIe-hK-tf6" firstAttribute="leading" secondItem="CSX-Am-ix0" secondAttribute="leadingMargin" id="sab-5q-2rU"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AddPeerTableViewCell" id="RyR-s5-lBV" customClass="AddPeerTableViewCell" customModule="WireGuard" customModuleProvider="target">
<rect key="frame" x="0.0" y="396" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="RyR-s5-lBV" id="gPY-qW-fbd">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fVu-Aa-9dn">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<state key="normal" title="Add peer"/>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="fVu-Aa-9dn" secondAttribute="bottom" id="G8D-HX-t2n"/>
<constraint firstItem="fVu-Aa-9dn" firstAttribute="leading" secondItem="gPY-qW-fbd" secondAttribute="leading" id="GQn-8W-GpX"/>
<constraint firstAttribute="trailing" secondItem="fVu-Aa-9dn" secondAttribute="trailing" id="H9S-Km-FDv"/>
<constraint firstItem="fVu-Aa-9dn" firstAttribute="top" secondItem="gPY-qW-fbd" secondAttribute="top" id="fcp-SS-lbr"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="PeerTableViewCell" rowHeight="308" id="gzz-88-0IG" customClass="PeerTableViewCell" customModule="WireGuard" customModuleProvider="target">
<rect key="frame" x="0.0" y="440" width="375" height="308"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="gzz-88-0IG" id="XA6-EM-5V9">
<rect key="frame" x="0.0" y="0.0" width="375" height="307.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="14" translatesAutoresizingMaskIntoConstraints="NO" id="NIK-2J-pTR">
<rect key="frame" x="16" y="11" width="343" height="286"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dk9-qH-XaO">
<rect key="frame" x="0.0" y="0.0" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Peer" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="42P-f9-Rft">
<rect key="frame" x="0.0" y="0.0" width="273" height="46"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SfN-pE-Y3t">
<rect key="frame" x="273" y="0.0" width="70" height="46"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="Sj9-zg-bBf"/>
</constraints>
<state key="normal" title="Delete"/>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="zcF-NC-5kf">
<rect key="frame" x="0.0" y="60" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Public key" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s9R-Af-RNn">
<rect key="frame" x="0.0" y="0.0" width="343" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="RLw-0o-akQ">
<rect key="frame" x="0.0" y="16" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="miX-4O-NOP">
<rect key="frame" x="0.0" y="120" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Pre-shared key" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iID-O4-iis">
<rect key="frame" x="0.0" y="0.0" width="343" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="(optional)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="wkY-3s-yTK">
<rect key="frame" x="0.0" y="16" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="vxg-u7-VjZ">
<rect key="frame" x="0.0" y="180" width="343" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Allowed IPs" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hDL-EX-UqG">
<rect key="frame" x="0.0" y="0.0" width="343" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="(generated)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iiY-Tl-UcH">
<rect key="frame" x="0.0" y="16" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="rgQ-cM-hwa">
<rect key="frame" x="0.0" y="240" width="343" height="46"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="8uI-Ux-Xhj">
<rect key="frame" x="0.0" y="0.0" width="232.5" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Endpoint" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P3u-6Z-3Hk">
<rect key="frame" x="0.0" y="0.0" width="232.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="W88-H0-dFZ">
<rect key="frame" x="0.0" y="16" width="232.5" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="eLi-QT-QwF">
<rect key="frame" x="240.5" y="0.0" width="102.5" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Persistent keepalive" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="tja-cM-cGL">
<rect key="frame" x="0.0" y="0.0" width="102.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="(optional)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Q8w-jh-0ox">
<rect key="frame" x="0.0" y="16" width="102.5" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstItem="eLi-QT-QwF" firstAttribute="width" secondItem="NIK-2J-pTR" secondAttribute="width" multiplier="0.3" id="Zid-UY-cdO"/>
</constraints>
</stackView>
</subviews>
<constraints>
<constraint firstItem="NIK-2J-pTR" firstAttribute="top" secondItem="XA6-EM-5V9" secondAttribute="topMargin" id="5YR-8M-6M5"/>
<constraint firstAttribute="trailingMargin" secondItem="NIK-2J-pTR" secondAttribute="trailing" id="AJ6-FH-zGS"/>
<constraint firstItem="NIK-2J-pTR" firstAttribute="leading" secondItem="XA6-EM-5V9" secondAttribute="leadingMargin" id="f2r-kN-RKk"/>
<constraint firstAttribute="bottomMargin" secondItem="NIK-2J-pTR" secondAttribute="bottom" id="rRD-SV-Wft"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="0VM-73-EPX" id="f9B-xZ-gS4"/>
<outlet property="delegate" destination="0VM-73-EPX" id="oHt-UY-XIz"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Title" id="PPu-rX-T38">
<barButtonItem key="rightBarButtonItem" systemItem="save" id="mft-1l-bWa"/>
</navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="j96-PK-ghN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1128.8" y="321.58920539730138"/>
</scene>
</scenes>
</document>

View File

@ -85,8 +85,8 @@ class AppCoordinator: RootViewCoordinator {
extension AppCoordinator: ConnectionsTableViewControllerDelegate {
func addProvider(connectionsTableViewController: ConnectionsTableViewController) {
// TODO implement
print("Add provider")
let addContext = persistentContainer.newBackgroundContext()
showProfileConfigurationViewController(profile: nil, context: addContext)
}
func connect(profile: Profile, connectionsTableViewController: ConnectionsTableViewController) {
@ -97,6 +97,23 @@ extension AppCoordinator: ConnectionsTableViewControllerDelegate {
func configure(profile: Profile, connectionsTableViewController: ConnectionsTableViewController) {
// TODO implement
print("configure profile \(profile)")
let editContext = persistentContainer.newBackgroundContext()
var backgroundProfile: Profile?
editContext.performAndWait {
backgroundProfile = editContext.object(with: profile.objectID) as? Profile
}
showProfileConfigurationViewController(profile: backgroundProfile, context: editContext)
}
func showProfileConfigurationViewController(profile: Profile?, context: NSManagedObjectContext) {
let profileConfigurationViewController = storyboard.instantiateViewController(type: ProfileConfigurationTableViewController.self)
profileConfigurationViewController.viewContext = context
profileConfigurationViewController.delegate = self
self.navigationController.pushViewController(profileConfigurationViewController, animated: true)
}
func delete(profile: Profile, connectionsTableViewController: ConnectionsTableViewController) {
@ -104,3 +121,7 @@ extension AppCoordinator: ConnectionsTableViewControllerDelegate {
print("delete profile \(profile)")
}
}
extension AppCoordinator: ProfileConfigurationTableViewControllerDelegate {
}