Skip to content

Instantly share code, notes, and snippets.

import Foundation
import UIKit
class BottomMenu: UIViewController {
static let shared = BottomMenu()
var yPosBottomUIView: CGFloat = 90.0
var yPosCenterButton: CGFloat = 35
@IhorYachmenov
IhorYachmenov / VPNIKEv2Setup.swift
Created October 13, 2020 07:32
Example how configure VPN profile based on IKEv2 protocol use NEVPNManager with certificate authentication, example was be tested on real devices, server use AlgoVPN.
import Foundation
import NetworkExtension
class VPNIKEv2Setup {
static let shared = VPNIKEv2Setup()
let vpnManager = NEVPNManager.shared()
func initVPNTunnelProviderManager() {
@IhorYachmenov
IhorYachmenov / ReadFromPKCS12.swift
Last active October 8, 2020 11:01
StackOverFlow Example
func StackOverFrowReadPCKS12() {
if let url = Bundle.main.url(forResource: "client", withExtension: "p12") {
let PKCS12Data = NSData(contentsOf: url)
let inPKCS12Data = CFDataCreate(kCFAllocatorDefault, PKCS12Data!.bytes.assumingMemoryBound(to: UInt8.self), (PKCS12Data?.length)!)
let keys: [CFString] = [kSecImportExportPassphrase]
let values: [CFTypeRef] = []
let keysPointer = UnsafeMutablePointer<UnsafeRawPointer?>.allocate(capacity: keys.count)