2023-09-07 09:24:55 -07:00
2023-07-18 09:33:57 -07:00
2023-07-18 09:32:55 -07:00
2023-07-18 09:33:57 -07:00
2023-09-07 09:24:55 -07:00

Apple iOS/macOS/iPadOS Framework

Demonstration of how to use a ZeroTier node in your macOS, iOS, iPadOS Swift or Objective-C application. main.swift contains example code that shows how to start and stop a node, handle events, and open a basic BSD-style socket that can connect to resources on your ZeroTier virtual network.

Get the ZeroTier framework

Use the example frameworks in this repo or download the latest here: download.zerotier.com

How to add the ZeroTier framework to your project

Navigate to App -> Overview -> Frameworks and Libraries

alt text

Add zt.framework by clicking the + icon and then the Add Other dropdown in the dialog window. Navigate to the zt.framework file and select it. Our framework is just a folder with a static library and some metadata.

alt text

Add libc++.tbd (Required by ZeroTier)

alt text

You should now have a list with two items:

alt text

Add your code to main.swift. Then build and run:

alt text

After a few moments you should see some output in your console showing details about the node, its state, whether it joined a network, etc.

Low-level socket API

While this example is written in Swift it is basically just calling C functions. More examples can be found here: libzt/examples/c. These same functions can be called from Objective-C code as well.

Higher level API (NSStream / URLSession)

A higher level API is currently under development but not yet released.

S
Description
No description provided
Readme 4.5 MiB
Languages
C 92.1%
Swift 7.9%