This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-libzt/integrations/apple/example_app/iOS/Example_iOS_App/ViewController.swift

45 lines
1.2 KiB
Swift
Raw Normal View History

2016-07-11 19:42:57 -05:00
//
// ViewController.swift
// Example_iOS_App
//
// Created by Joseph Henry on 7/10/16.
// Copyright © 2016 ZeroTier Inc. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
var service_thread : NSThread!
func ztnc_start_service() {
let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
print("start_service()\n")
// e5cd7a9e1c3511dd
start_service("/Users/Joseph/utest3")
//start_service(path[0])
}
2016-07-11 19:42:57 -05:00
override func viewDidLoad() {
super.viewDidLoad()
// ZeroTier Service thread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
self.service_thread = NSThread(target:self, selector:"ztnc_start_service", object:nil)
self.service_thread.start()
});
// Set RPC path for this thread
zts_init_rpc("/Users/Joseph/utest3/nc_","e5cd7a9e1c2e194f");
2016-07-11 19:42:57 -05:00
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}