2018-05-24 20:07:04 +00:00
|
|
|
//
|
2018-05-26 07:17:36 +00:00
|
|
|
// TunnelConfigurationTableViewController.swift
|
2018-05-24 20:07:04 +00:00
|
|
|
// WireGuard
|
|
|
|
//
|
|
|
|
// Created by Jeroen Leenarts on 24-05-18.
|
2018-05-26 07:41:09 +00:00
|
|
|
// Copyright © 2018 WireGuard. All rights reserved.
|
2018-05-24 20:07:04 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import CoreData
|
|
|
|
import BNRCoreDataStack
|
|
|
|
|
2018-05-26 07:17:36 +00:00
|
|
|
protocol TunnelConfigurationTableViewControllerDelegate: class {
|
2018-05-24 20:07:04 +00:00
|
|
|
}
|
|
|
|
|
2018-05-26 07:17:36 +00:00
|
|
|
class TunnelConfigurationTableViewController: UITableViewController {
|
2018-05-24 20:07:04 +00:00
|
|
|
var viewContext: NSManagedObjectContext!
|
2018-05-26 07:17:36 +00:00
|
|
|
weak var delegate: TunnelConfigurationTableViewControllerDelegate?
|
2018-05-24 20:07:04 +00:00
|
|
|
|
2018-05-26 07:41:09 +00:00
|
|
|
override func numberOfSections(in tableView: UITableView) -> Int {
|
2018-05-24 20:07:04 +00:00
|
|
|
return 3
|
|
|
|
}
|
|
|
|
|
2018-05-26 07:41:09 +00:00
|
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
|
switch section {
|
|
|
|
case 1:
|
|
|
|
return 2
|
|
|
|
default:
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-24 20:07:04 +00:00
|
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
2018-05-26 07:41:09 +00:00
|
|
|
switch indexPath.section {
|
2018-05-24 20:07:04 +00:00
|
|
|
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 {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-05-26 07:17:36 +00:00
|
|
|
extension TunnelConfigurationTableViewController: Identifyable {}
|
2018-05-24 20:07:04 +00:00
|
|
|
extension InterfaceTableViewCell: Identifyable {}
|
|
|
|
extension PeerTableViewCell: Identifyable {}
|
|
|
|
extension AddPeerTableViewCell: Identifyable {}
|