Add data model.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts 2018-05-23 22:13:09 +02:00
parent ae73b78935
commit c5237d5342
7 changed files with 138 additions and 2 deletions

View File

@ -21,6 +21,10 @@
4A4BAD1720B5F8DE00F12B28 /* Wireguard.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1520B5F8DE00F12B28 /* Wireguard.xcdatamodeld */; }; 4A4BAD1720B5F8DE00F12B28 /* Wireguard.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1520B5F8DE00F12B28 /* Wireguard.xcdatamodeld */; };
4A4BAD1A20B5F8FF00F12B28 /* Profile+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1820B5F8FF00F12B28 /* Profile+CoreDataClass.swift */; }; 4A4BAD1A20B5F8FF00F12B28 /* Profile+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1820B5F8FF00F12B28 /* Profile+CoreDataClass.swift */; };
4A4BAD1B20B5F8FF00F12B28 /* Profile+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1920B5F8FF00F12B28 /* Profile+CoreDataProperties.swift */; }; 4A4BAD1B20B5F8FF00F12B28 /* Profile+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1920B5F8FF00F12B28 /* Profile+CoreDataProperties.swift */; };
4A4BAD2020B6026900F12B28 /* Peer+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1C20B6026900F12B28 /* Peer+CoreDataProperties.swift */; };
4A4BAD2120B6026900F12B28 /* Peer+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1D20B6026900F12B28 /* Peer+CoreDataClass.swift */; };
4A4BAD2220B6026900F12B28 /* Interface+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1E20B6026900F12B28 /* Interface+CoreDataProperties.swift */; };
4A4BAD2320B6026900F12B28 /* Interface+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4BAD1F20B6026900F12B28 /* Interface+CoreDataClass.swift */; };
DA734B3636730B94E9C22F47 /* Pods_Wireguard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BF50C7EC60CD91BBA05E51F /* Pods_Wireguard.framework */; }; DA734B3636730B94E9C22F47 /* Pods_Wireguard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BF50C7EC60CD91BBA05E51F /* Pods_Wireguard.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -53,6 +57,10 @@
4A4BAD1620B5F8DE00F12B28 /* Wireguard.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Wireguard.xcdatamodel; sourceTree = "<group>"; }; 4A4BAD1620B5F8DE00F12B28 /* Wireguard.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Wireguard.xcdatamodel; sourceTree = "<group>"; };
4A4BAD1820B5F8FF00F12B28 /* Profile+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Profile+CoreDataClass.swift"; sourceTree = "<group>"; }; 4A4BAD1820B5F8FF00F12B28 /* Profile+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Profile+CoreDataClass.swift"; sourceTree = "<group>"; };
4A4BAD1920B5F8FF00F12B28 /* Profile+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Profile+CoreDataProperties.swift"; sourceTree = "<group>"; }; 4A4BAD1920B5F8FF00F12B28 /* Profile+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Profile+CoreDataProperties.swift"; sourceTree = "<group>"; };
4A4BAD1C20B6026900F12B28 /* Peer+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Peer+CoreDataProperties.swift"; path = "/Users/jeroenleenarts/code/wireguard-ios/Wireguard/Models/Peer+CoreDataProperties.swift"; sourceTree = "<absolute>"; };
4A4BAD1D20B6026900F12B28 /* Peer+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Peer+CoreDataClass.swift"; path = "/Users/jeroenleenarts/code/wireguard-ios/Wireguard/Models/Peer+CoreDataClass.swift"; sourceTree = "<absolute>"; };
4A4BAD1E20B6026900F12B28 /* Interface+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Interface+CoreDataProperties.swift"; path = "/Users/jeroenleenarts/code/wireguard-ios/Wireguard/Models/Interface+CoreDataProperties.swift"; sourceTree = "<absolute>"; };
4A4BAD1F20B6026900F12B28 /* Interface+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Interface+CoreDataClass.swift"; path = "/Users/jeroenleenarts/code/wireguard-ios/Wireguard/Models/Interface+CoreDataClass.swift"; sourceTree = "<absolute>"; };
82069F3AE97A82448F990CFB /* 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>"; }; 82069F3AE97A82448F990CFB /* 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>"; };
8BF50C7EC60CD91BBA05E51F /* Pods_Wireguard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Wireguard.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8BF50C7EC60CD91BBA05E51F /* Pods_Wireguard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Wireguard.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FB0ABC1036F5A16B24286D3C /* 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>"; }; FB0ABC1036F5A16B24286D3C /* 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>"; };
@ -152,6 +160,10 @@
4A4BAD1420B5F8C000F12B28 /* Models */ = { 4A4BAD1420B5F8C000F12B28 /* Models */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4A4BAD1D20B6026900F12B28 /* Peer+CoreDataClass.swift */,
4A4BAD1C20B6026900F12B28 /* Peer+CoreDataProperties.swift */,
4A4BAD1F20B6026900F12B28 /* Interface+CoreDataClass.swift */,
4A4BAD1E20B6026900F12B28 /* Interface+CoreDataProperties.swift */,
4A4BAD1820B5F8FF00F12B28 /* Profile+CoreDataClass.swift */, 4A4BAD1820B5F8FF00F12B28 /* Profile+CoreDataClass.swift */,
4A4BAD1920B5F8FF00F12B28 /* Profile+CoreDataProperties.swift */, 4A4BAD1920B5F8FF00F12B28 /* Profile+CoreDataProperties.swift */,
4A4BAD1520B5F8DE00F12B28 /* Wireguard.xcdatamodeld */, 4A4BAD1520B5F8DE00F12B28 /* Wireguard.xcdatamodeld */,
@ -366,12 +378,16 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
4A4BAD0C20B5F6AA00F12B28 /* AppCoordinator.swift in Sources */, 4A4BAD0C20B5F6AA00F12B28 /* AppCoordinator.swift in Sources */,
4A4BAD2220B6026900F12B28 /* Interface+CoreDataProperties.swift in Sources */,
4A4BAD1320B5F82400F12B28 /* Identifyable.swift in Sources */, 4A4BAD1320B5F82400F12B28 /* Identifyable.swift in Sources */,
4A4BAD1720B5F8DE00F12B28 /* Wireguard.xcdatamodeld in Sources */, 4A4BAD1720B5F8DE00F12B28 /* Wireguard.xcdatamodeld in Sources */,
4A4BAD1A20B5F8FF00F12B28 /* Profile+CoreDataClass.swift in Sources */, 4A4BAD1A20B5F8FF00F12B28 /* Profile+CoreDataClass.swift in Sources */,
4A4BACE820B5F1BF00F12B28 /* ConnectionsTableViewController.swift in Sources */, 4A4BACE820B5F1BF00F12B28 /* ConnectionsTableViewController.swift in Sources */,
4A4BAD1020B5F6EC00F12B28 /* RootCoordinator.swift in Sources */, 4A4BAD1020B5F6EC00F12B28 /* RootCoordinator.swift in Sources */,
4A4BAD0E20B5F6C300F12B28 /* Coordinator.swift in Sources */, 4A4BAD0E20B5F6C300F12B28 /* Coordinator.swift in Sources */,
4A4BAD2020B6026900F12B28 /* Peer+CoreDataProperties.swift in Sources */,
4A4BAD2320B6026900F12B28 /* Interface+CoreDataClass.swift in Sources */,
4A4BAD2120B6026900F12B28 /* Peer+CoreDataClass.swift in Sources */,
4A4BAD1B20B5F8FF00F12B28 /* Profile+CoreDataProperties.swift in Sources */, 4A4BAD1B20B5F8FF00F12B28 /* Profile+CoreDataProperties.swift in Sources */,
4A4BACE620B5F1BF00F12B28 /* AppDelegate.swift in Sources */, 4A4BACE620B5F1BF00F12B28 /* AppDelegate.swift in Sources */,
); );

View File

@ -0,0 +1,15 @@
//
// Interface+CoreDataClass.swift
//
//
// Created by Jeroen Leenarts on 23-05-18.
//
//
import Foundation
import CoreData
@objc(Interface)
public class Interface: NSManagedObject {
}

View File

@ -0,0 +1,23 @@
//
// Interface+CoreDataProperties.swift
//
//
// Created by Jeroen Leenarts on 23-05-18.
//
//
import Foundation
import CoreData
extension Interface {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Interface> {
return NSFetchRequest<Interface>(entityName: "Interface")
}
@NSManaged public var privateKey: String?
@NSManaged public var listenPort: Int16
@NSManaged public var fwMark: Int32
@NSManaged public var profile: Profile?
}

View File

@ -0,0 +1,15 @@
//
// Peer+CoreDataClass.swift
//
//
// Created by Jeroen Leenarts on 23-05-18.
//
//
import Foundation
import CoreData
@objc(Peer)
public class Peer: NSManagedObject {
}

View File

@ -0,0 +1,25 @@
//
// Peer+CoreDataProperties.swift
//
//
// Created by Jeroen Leenarts on 23-05-18.
//
//
import Foundation
import CoreData
extension Peer {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Peer> {
return NSFetchRequest<Peer>(entityName: "Peer")
}
@NSManaged public var publicKey: String?
@NSManaged public var presharedKey: String?
@NSManaged public var allowedIPs: String?
@NSManaged public var endpoint: String?
@NSManaged public var persistentKeepalive: Int16
@NSManaged public var profile: Profile?
}

View File

@ -10,10 +10,32 @@
import Foundation import Foundation
import CoreData import CoreData
extension Profile { extension Profile {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Profile> { @nonobjc public class func fetchRequest() -> NSFetchRequest<Profile> {
return NSFetchRequest<Profile>(entityName: "Profile") return NSFetchRequest<Profile>(entityName: "Profile")
} }
@NSManaged public var title: String?
@NSManaged public var peers: NSSet?
@NSManaged public var interface: Interface?
}
// MARK: Generated accessors for peers
extension Profile {
@objc(addPeersObject:)
@NSManaged public func addToPeers(_ value: Peer)
@objc(removePeersObject:)
@NSManaged public func removeFromPeers(_ value: Peer)
@objc(addPeers:)
@NSManaged public func addToPeers(_ values: NSSet)
@objc(removePeers:)
@NSManaged public func removeFromPeers(_ values: NSSet)
} }

View File

@ -1,7 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14133" systemVersion="17E202" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> <model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14133" systemVersion="17E202" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Profile" representedClassName="Profile" syncable="YES"/> <entity name="Interface" representedClassName="Interface" syncable="YES">
<attribute name="fwMark" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="listenPort" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="privateKey" attributeType="String" syncable="YES"/>
<relationship name="profile" maxCount="1" deletionRule="Nullify" destinationEntity="Profile" inverseName="interface" inverseEntity="Profile" syncable="YES"/>
</entity>
<entity name="Peer" representedClassName="Peer" syncable="YES">
<attribute name="allowedIPs" attributeType="String" syncable="YES"/>
<attribute name="endpoint" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="persistentKeepalive" attributeType="Integer 16" minValueString="0" maxValueString="65535" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="presharedKey" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="publicKey" attributeType="String" syncable="YES"/>
<relationship name="profile" maxCount="1" deletionRule="Nullify" destinationEntity="Profile" inverseName="peers" inverseEntity="Profile" syncable="YES"/>
</entity>
<entity name="Profile" representedClassName="Profile" syncable="YES">
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="interface" maxCount="1" deletionRule="Cascade" destinationEntity="Interface" inverseName="profile" inverseEntity="Interface" syncable="YES"/>
<relationship name="peers" toMany="YES" minCount="1" deletionRule="Cascade" destinationEntity="Peer" inverseName="profile" inverseEntity="Peer" syncable="YES"/>
</entity>
<elements> <elements>
<element name="Profile" positionX="-63" positionY="-18" width="128" height="45"/> <element name="Profile" positionX="-63" positionY="-18" width="128" height="90"/>
<element name="Interface" positionX="-54" positionY="-9" width="128" height="105"/>
<element name="Peer" positionX="-36" positionY="9" width="128" height="135"/>
</elements> </elements>
</model> </model>