Documentation Archive Developer
Search

NetworkExtension Changes for Swift

NetworkExtension

Added NEAppRule
Added NWPath
Declaration
From
class NEEvaluateConnectionRule : NSObject, NSSecureCoding, NSCoding, NSCopying {
    init!(matchDomains domains: [AnyObject]!, andAction action: NEEvaluateConnectionRuleAction)
    var action: NEEvaluateConnectionRuleAction { get }
    var matchDomains: [AnyObject]! { get }
    var useDNSServers: [AnyObject]!
    @NSCopying var probeURL: NSURL!
}
To
class NEEvaluateConnectionRule : NSObject, NSSecureCoding, NSCoding, NSCopying {
    init(matchDomains domains: [String], andAction action: NEEvaluateConnectionRuleAction)
    var action: NEEvaluateConnectionRuleAction { get }
    var matchDomains: [String] { get }
    var useDNSServers: [String]?
    @NSCopying var probeURL: NSURL?
}

Declaration
From
init!(matchDomains domains: [AnyObject]!, andAction action: NEEvaluateConnectionRuleAction)
To
init(matchDomains domains: [String], andAction action: NEEvaluateConnectionRuleAction)

Declaration
From
var matchDomains: [AnyObject]! { get }
To
var matchDomains: [String] { get }

Declaration
From
@NSCopying var probeURL: NSURL!
To
@NSCopying var probeURL: NSURL?

Declaration
From
var useDNSServers: [AnyObject]!
To
var useDNSServers: [String]?

IntroductionRaw Value Type
FromiOS 8.1--
ToiOS 8.0Int

Declaration
From
class NEOnDemandRule : NSObject, NSSecureCoding, NSCoding, NSCopying {
    var action: NEOnDemandRuleAction { get }
    var DNSSearchDomainMatch: [AnyObject]!
    var DNSServerAddressMatch: [AnyObject]!
    var interfaceTypeMatch: NEOnDemandRuleInterfaceType
    var SSIDMatch: [AnyObject]!
    @NSCopying var probeURL: NSURL!
}
To
class NEOnDemandRule : NSObject, NSSecureCoding, NSCoding, NSCopying {
    var action: NEOnDemandRuleAction { get }
    var DNSSearchDomainMatch: [String]?
    var DNSServerAddressMatch: [String]?
    var interfaceTypeMatch: NEOnDemandRuleInterfaceType
    var SSIDMatch: [String]?
    @NSCopying var probeURL: NSURL?
}

Declaration
From
var DNSSearchDomainMatch: [AnyObject]!
To
var DNSSearchDomainMatch: [String]?

Declaration
From
var DNSServerAddressMatch: [AnyObject]!
To
var DNSServerAddressMatch: [String]?

Declaration
From
@NSCopying var probeURL: NSURL!
To
@NSCopying var probeURL: NSURL?

Declaration
From
var SSIDMatch: [AnyObject]!
To
var SSIDMatch: [String]?

Raw Value Type
From--
ToInt

Declaration
From
class NEOnDemandRuleEvaluateConnection : NEOnDemandRule {
    var connectionRules: [AnyObject]!
}
To
class NEOnDemandRuleEvaluateConnection : NEOnDemandRule {
    var connectionRules: [NEEvaluateConnectionRule]?
}

Declaration
From
var connectionRules: [AnyObject]!
To
var connectionRules: [NEEvaluateConnectionRule]?

DeclarationRaw Value Type
From
enum NEOnDemandRuleInterfaceType : Int {
    case Ethernet
    case WiFi
    case Cellular
}
--
To
enum NEOnDemandRuleInterfaceType : Int {
    case Any
    case Ethernet
    case WiFi
    case Cellular
}
Int

Declaration
From
class NEVPNConnection : NSObject {
    func startVPNTunnelAndReturnError(_ error: NSErrorPointer) -> Bool
    func stopVPNTunnel()
    var status: NEVPNStatus { get }
}
To
class NEVPNConnection : NSObject {
    func startVPNTunnel() throws
    func startVPNTunnelWithOptions(_ options: [String : NSObject]?) throws
    func stopVPNTunnel()
    var status: NEVPNStatus { get }
    var connectedDate: NSDate? { get }
}

Declaration
From
func startVPNTunnelAndReturnError(_ error: NSErrorPointer) -> Bool
To
func startVPNTunnel() throws

DeclarationRaw Value Type
From
enum NEVPNError : Int {
    case ConfigurationInvalid
    case ConfigurationDisabled
    case ConnectionFailed
    case ConfigurationStale
}
--
To
enum NEVPNError : Int {
    case ConfigurationInvalid
    case ConfigurationDisabled
    case ConnectionFailed
    case ConfigurationStale
    case ConfigurationReadWriteFailed
    case ConfigurationUnknown
}
Int

Raw Value Type
From--
ToInt

IntroductionRaw Value Type
FromiOS 8.0--
ToiOS 8.3Int

Raw Value Type
From--
ToInt

Raw Value Type
From--
ToInt

Raw Value Type
From--
ToInt

Raw Value Type
From--
ToInt

Modified NEVPNManager
Declaration
From
class NEVPNManager : NSObject {
    class func sharedManager() -> NEVPNManager!
    func loadFromPreferencesWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
    func removeFromPreferencesWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
    func saveToPreferencesWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
    var onDemandRules: [AnyObject]!
    var onDemandEnabled: Bool
    var localizedDescription: String!
    var `protocol`: NEVPNProtocol!
    var connection: NEVPNConnection! { get }
    var enabled: Bool
}
To
class NEVPNManager : NSObject {
    class func sharedManager() -> NEVPNManager
    func loadFromPreferencesWithCompletionHandler(_ completionHandler: (NSError?) -> Void)
    func removeFromPreferencesWithCompletionHandler(_ completionHandler: ((NSError?) -> Void)?)
    func saveToPreferencesWithCompletionHandler(_ completionHandler: ((NSError?) -> Void)?)
    var onDemandRules: [NEOnDemandRule]?
    var onDemandEnabled: Bool
    var localizedDescription: String?
    var `protocol`: NEVPNProtocol?
    var protocolConfiguration: NEVPNProtocol?
    var connection: NEVPNConnection { get }
    var enabled: Bool
}

Declaration
From
var connection: NEVPNConnection! { get }
To
var connection: NEVPNConnection { get }

Declaration
From
func loadFromPreferencesWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
To
func loadFromPreferencesWithCompletionHandler(_ completionHandler: (NSError?) -> Void)

Declaration
From
var localizedDescription: String!
To
var localizedDescription: String?

Declaration
From
var onDemandRules: [AnyObject]!
To
var onDemandRules: [NEOnDemandRule]?

DeclarationDeprecation
From
var `protocol`: NEVPNProtocol!
--
To
var `protocol`: NEVPNProtocol?
iOS 9.0

Declaration
From
func removeFromPreferencesWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
To
func removeFromPreferencesWithCompletionHandler(_ completionHandler: ((NSError?) -> Void)?)

Declaration
From
func saveToPreferencesWithCompletionHandler(_ completionHandler: ((NSError!) -> Void)!)
To
func saveToPreferencesWithCompletionHandler(_ completionHandler: ((NSError?) -> Void)?)

Declaration
From
class func sharedManager() -> NEVPNManager!
To
class func sharedManager() -> NEVPNManager

Modified NEVPNProtocol
Declaration
From
class NEVPNProtocol : NSObject, NSCopying, NSSecureCoding, NSCoding {
    var serverAddress: String!
    var username: String!
    @NSCopying var passwordReference: NSData!
    @NSCopying var identityReference: NSData!
    @NSCopying var identityData: NSData!
    var identityDataPassword: String!
    var disconnectOnSleep: Bool
}
To
class NEVPNProtocol : NSObject, NSCopying, NSSecureCoding, NSCoding {
    var serverAddress: String?
    var username: String?
    @NSCopying var passwordReference: NSData?
    @NSCopying var identityReference: NSData?
    @NSCopying var identityData: NSData?
    var identityDataPassword: String?
    var disconnectOnSleep: Bool
    @NSCopying var proxySettings: NEProxySettings?
}

Declaration
From
@NSCopying var identityData: NSData!
To
@NSCopying var identityData: NSData?

Declaration
From
var identityDataPassword: String!
To
var identityDataPassword: String?

Declaration
From
@NSCopying var passwordReference: NSData!
To
@NSCopying var passwordReference: NSData?

Declaration
From
var serverAddress: String!
To
var serverAddress: String?

Declaration
From
var username: String!
To
var username: String?

Declaration
From
class NEVPNProtocolIKEv2 : NEVPNProtocolIPSec {
    var deadPeerDetectionRate: NEVPNIKEv2DeadPeerDetectionRate
    var serverCertificateIssuerCommonName: String!
    var serverCertificateCommonName: String!
    var certificateType: NEVPNIKEv2CertificateType
    var IKESecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters! { get }
    var childSecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters! { get }
}
To
class NEVPNProtocolIKEv2 : NEVPNProtocolIPSec {
    var deadPeerDetectionRate: NEVPNIKEv2DeadPeerDetectionRate
    var serverCertificateIssuerCommonName: String?
    var serverCertificateCommonName: String?
    var certificateType: NEVPNIKEv2CertificateType
    var useConfigurationAttributeInternalIPSubnet: Bool
    var IKESecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters { get }
    var childSecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters { get }
    var disableMOBIKE: Bool
    var disableRedirect: Bool
    var enablePFS: Bool
    var enableRevocationCheck: Bool
    var strictRevocationCheck: Bool
}

Introduction
FromiOS 8.0
ToiOS 8.3

Declaration
From
var childSecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters! { get }
To
var childSecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters { get }

Declaration
From
var IKESecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters! { get }
To
var IKESecurityAssociationParameters: NEVPNIKEv2SecurityAssociationParameters { get }

Declaration
From
var serverCertificateCommonName: String!
To
var serverCertificateCommonName: String?

Declaration
From
var serverCertificateIssuerCommonName: String!
To
var serverCertificateIssuerCommonName: String?

Declaration
From
class NEVPNProtocolIPSec : NEVPNProtocol {
    var authenticationMethod: NEVPNIKEAuthenticationMethod
    var useExtendedAuthentication: Bool
    @NSCopying var sharedSecretReference: NSData!
    var localIdentifier: String!
    var remoteIdentifier: String!
}
To
class NEVPNProtocolIPSec : NEVPNProtocol {
    var authenticationMethod: NEVPNIKEAuthenticationMethod
    var useExtendedAuthentication: Bool
    @NSCopying var sharedSecretReference: NSData?
    var localIdentifier: String?
    var remoteIdentifier: String?
}

Declaration
From
var localIdentifier: String!
To
var localIdentifier: String?

Declaration
From
var remoteIdentifier: String!
To
var remoteIdentifier: String?

Declaration
From
@NSCopying var sharedSecretReference: NSData!
To
@NSCopying var sharedSecretReference: NSData?

Raw Value Type
From--
ToInt