Added examples/apple

This commit is contained in:
Joseph Henry
2017-05-30 13:47:50 -07:00
parent 5ab563ce4c
commit c6f20df8da
40 changed files with 4806 additions and 3 deletions

View File

@@ -0,0 +1,346 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
7C7F16901DBEB94700C7AFFD /* XcodeWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7F168B1DBEB92600C7AFFD /* XcodeWrapper.cpp */; };
7C7F16911DBEB94700C7AFFD /* ztsdk.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C7F168D1DBEB92600C7AFFD /* ztsdk.swift */; };
7C7F16921DBEBDF000C7AFFD /* Apple-Bridging-Header.h in Sources */ = {isa = PBXBuildFile; fileRef = 7C7F168A1DBEB92600C7AFFD /* Apple-Bridging-Header.h */; };
7C7F16931DBEBDF000C7AFFD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8BC03D1D3348A6001E1B6F /* ViewController.swift */; };
7C7F16941DBEBE0600C7AFFD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */; };
7C8BC0411D3348A6001E1B6F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC03F1D3348A6001E1B6F /* Main.storyboard */; };
7C8BC0431D3348A6001E1B6F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC0421D3348A6001E1B6F /* Assets.xcassets */; };
7C8BC0461D3348A6001E1B6F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */; };
7C9B10DA1D36C81F005BA825 /* ZeroTierSDK_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */; };
7C9B10DB1D36C81F005BA825 /* ZeroTierSDK_iOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
7C9B10DC1D36C81F005BA825 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
7C9B10DB1D36C81F005BA825 /* ZeroTierSDK_iOS.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
7C7F168A1DBEB92600C7AFFD /* Apple-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Apple-Bridging-Header.h"; path = "../../../../../src/wrappers/swift/Apple-Bridging-Header.h"; sourceTree = "<group>"; };
7C7F168B1DBEB92600C7AFFD /* XcodeWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XcodeWrapper.cpp; path = ../../../../../src/wrappers/swift/XcodeWrapper.cpp; sourceTree = "<group>"; };
7C7F168C1DBEB92600C7AFFD /* XcodeWrapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = XcodeWrapper.hpp; path = ../../../../../src/wrappers/swift/XcodeWrapper.hpp; sourceTree = "<group>"; };
7C7F168D1DBEB92600C7AFFD /* ztsdk.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ztsdk.swift; path = ../../../../../src/wrappers/swift/ztsdk.swift; sourceTree = "<group>"; };
7C8BC0381D3348A6001E1B6F /* Example_iOS_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_iOS_App.app; sourceTree = BUILT_PRODUCTS_DIR; };
7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7C8BC03D1D3348A6001E1B6F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
7C8BC0401D3348A6001E1B6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
7C8BC0421D3348A6001E1B6F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7C8BC0451D3348A6001E1B6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
7C8BC0471D3348A6001E1B6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_iOS.framework; path = "../../../../build/ios_app_framework/Debug-iphoneos/ZeroTierSDK_iOS.framework"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
7C8BC0351D3348A6001E1B6F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7C9B10DA1D36C81F005BA825 /* ZeroTierSDK_iOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7C8BC02F1D3348A6001E1B6F = {
isa = PBXGroup;
children = (
7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */,
7C8BC03A1D3348A6001E1B6F /* Example_iOS_App */,
7C8BC0391D3348A6001E1B6F /* Products */,
);
sourceTree = "<group>";
};
7C8BC0391D3348A6001E1B6F /* Products */ = {
isa = PBXGroup;
children = (
7C8BC0381D3348A6001E1B6F /* Example_iOS_App.app */,
);
name = Products;
sourceTree = "<group>";
};
7C8BC03A1D3348A6001E1B6F /* Example_iOS_App */ = {
isa = PBXGroup;
children = (
7C7F168A1DBEB92600C7AFFD /* Apple-Bridging-Header.h */,
7C7F168B1DBEB92600C7AFFD /* XcodeWrapper.cpp */,
7C7F168C1DBEB92600C7AFFD /* XcodeWrapper.hpp */,
7C7F168D1DBEB92600C7AFFD /* ztsdk.swift */,
7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */,
7C8BC03D1D3348A6001E1B6F /* ViewController.swift */,
7C8BC03F1D3348A6001E1B6F /* Main.storyboard */,
7C8BC0421D3348A6001E1B6F /* Assets.xcassets */,
7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */,
7C8BC0471D3348A6001E1B6F /* Info.plist */,
);
path = Example_iOS_App;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
7C8BC0371D3348A6001E1B6F /* Example_iOS_App */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7C8BC04A1D3348A6001E1B6F /* Build configuration list for PBXNativeTarget "Example_iOS_App" */;
buildPhases = (
7C8BC0341D3348A6001E1B6F /* Sources */,
7C8BC0351D3348A6001E1B6F /* Frameworks */,
7C8BC0361D3348A6001E1B6F /* Resources */,
7C9B10DC1D36C81F005BA825 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Example_iOS_App;
productName = Example_iOS_App;
productReference = 7C8BC0381D3348A6001E1B6F /* Example_iOS_App.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
7C8BC0301D3348A6001E1B6F /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "ZeroTier Inc.";
TargetAttributes = {
7C8BC0371D3348A6001E1B6F = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = 57AG88JR8A;
LastSwiftMigration = 0810;
};
};
};
buildConfigurationList = 7C8BC0331D3348A6001E1B6F /* Build configuration list for PBXProject "Example_iOS_App" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 7C8BC02F1D3348A6001E1B6F;
productRefGroup = 7C8BC0391D3348A6001E1B6F /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
7C8BC0371D3348A6001E1B6F /* Example_iOS_App */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
7C8BC0361D3348A6001E1B6F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7C8BC0461D3348A6001E1B6F /* LaunchScreen.storyboard in Resources */,
7C8BC0431D3348A6001E1B6F /* Assets.xcassets in Resources */,
7C8BC0411D3348A6001E1B6F /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
7C8BC0341D3348A6001E1B6F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7C7F16941DBEBE0600C7AFFD /* AppDelegate.swift in Sources */,
7C7F16921DBEBDF000C7AFFD /* Apple-Bridging-Header.h in Sources */,
7C7F16931DBEBDF000C7AFFD /* ViewController.swift in Sources */,
7C7F16901DBEB94700C7AFFD /* XcodeWrapper.cpp in Sources */,
7C7F16911DBEB94700C7AFFD /* ztsdk.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
7C8BC03F1D3348A6001E1B6F /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
7C8BC0401D3348A6001E1B6F /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
7C8BC0451D3348A6001E1B6F /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
7C8BC0481D3348A6001E1B6F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
7C8BC0491D3348A6001E1B6F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
7C8BC04B1D3348A6001E1B6F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../../../build/iOS_app_framework/debug-iphoneos";
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../../../src";
INFOPLIST_FILE = Example_iOS_App/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(SRC_ROOT)/../../";
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-iOS-App";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/wrappers/swift/Apple-Bridging-Header.h";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
7C8BC04C1D3348A6001E1B6F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../../../build/iOS_app_framework/debug-iphoneos";
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../../../src";
INFOPLIST_FILE = Example_iOS_App/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(SRC_ROOT)/../../";
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-iOS-App";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/wrappers/swift/Apple-Bridging-Header.h";
SWIFT_VERSION = 2.3;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
7C8BC0331D3348A6001E1B6F /* Build configuration list for PBXProject "Example_iOS_App" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7C8BC0481D3348A6001E1B6F /* Debug */,
7C8BC0491D3348A6001E1B6F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7C8BC04A1D3348A6001E1B6F /* Build configuration list for PBXNativeTarget "Example_iOS_App" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7C8BC04B1D3348A6001E1B6F /* Debug */,
7C8BC04C1D3348A6001E1B6F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 7C8BC0301D3348A6001E1B6F /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Example_iOS_App.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_iOS_App/ViewController.swift"
timestampString = "494987032.463726"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "54"
endingLineNumber = "54"
landmarkName = "UI_TX(sender:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_iOS_App/ZTSDK.swift"
timestampString = "494980386.753348"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "44"
endingLineNumber = "44"
landmarkName = "join_network(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_iOS_App/ZTSDK.swift"
timestampString = "494980195.451716"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "17"
endingLineNumber = "17"
landmarkName = "ztnc_start_service(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../../../src/ZTSDK.swift"
timestampString = "494987032.463726"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
landmarkName = "to_sockaddr_in()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../../../../src/ZTSDK.swift"
timestampString = "494987032.463726"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "148"
endingLineNumber = "148"
landmarkName = "listen(_:backlog:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C8BC0371D3348A6001E1B6F"
BuildableName = "Example_iOS_App.app"
BlueprintName = "Example_iOS_App"
ReferencedContainer = "container:Example_iOS_App.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C8BC0371D3348A6001E1B6F"
BuildableName = "Example_iOS_App.app"
BlueprintName = "Example_iOS_App"
ReferencedContainer = "container:Example_iOS_App.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C8BC0371D3348A6001E1B6F"
BuildableName = "Example_iOS_App.app"
BlueprintName = "Example_iOS_App"
ReferencedContainer = "container:Example_iOS_App.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C8BC0371D3348A6001E1B6F"
BuildableName = "Example_iOS_App.app"
BlueprintName = "Example_iOS_App"
ReferencedContainer = "container:Example_iOS_App.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Example_iOS_App.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>7C8BC0371D3348A6001E1B6F</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,46 @@
//
// AppDelegate.swift
// Example_iOS_App
//
// Created by Joseph Henry on 7/10/16.
// Copyright © 2016 ZeroTier Inc. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@@ -0,0 +1,73 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Example_iOS_App" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sM5-GM-4R8">
<rect key="frame" x="183" y="314" width="59" height="30"/>
<state key="normal" title="Connect"/>
<connections>
<action selector="UI_Connect:" destination="BYZ-38-t0r" eventType="touchUpInside" id="5bz-xp-hzT"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9Qv-V2-VnT">
<rect key="frame" x="157" y="264" width="46" height="30"/>
<state key="normal" title="Button"/>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dwn-d8-Ki3">
<rect key="frame" x="183" y="352" width="31" height="30"/>
<state key="normal" title="Bind"/>
<connections>
<action selector="UI_Bind:" destination="BYZ-38-t0r" eventType="touchUpInside" id="DJq-47-7gO"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="ip address" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6id-4C-E8W">
<rect key="frame" x="20" y="275" width="147" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="port" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="uiQ-EM-gfq">
<rect key="frame" x="175" y="276" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Protocol" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fn2-mn-MjK">
<rect key="frame" x="20" y="149" width="64" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Remote Host" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9rm-WW-ji2">
<rect key="frame" x="20" y="239" width="100" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lnh-9e-LMk">
<rect key="frame" x="401" y="281" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="bqB-xS-7Oo">
<rect key="frame" x="423" y="115" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="vwT-sy-CRY">
<rect key="frame" x="38" y="178" width="121" height="29"/>
<segments>
<segment title="TCP"/>
<segment title="UDP"/>
</segments>
<connections>
<action selector="protocolSelected:" destination="BYZ-38-t0r" eventType="valueChanged" id="PpI-tQ-h4C"/>
</connections>
</segmentedControl>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="ZeroTier iOS Example App" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h4F-YA-Rsh">
<rect key="frame" x="20" y="59" width="200" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dp1-qj-Mq8">
<rect key="frame" x="160" y="491" width="41" height="30"/>
<state key="normal" title="read()"/>
<connections>
<action selector="UI_RX:" destination="BYZ-38-t0r" eventType="touchUpInside" id="JJJ-KW-5rF"/>
<action selector="UI_TX:" destination="BYZ-38-t0r" eventType="touchUpInside" id="4h0-8L-CI3"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="EBa-HV-MZ5">
<rect key="frame" x="20" y="453" width="132" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ZjP-35-mln">
<rect key="frame" x="160" y="453" width="132" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="RX" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z5X-D0-I5d">
<rect key="frame" x="165" y="424" width="22" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="TX" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tho-Qu-UmE">
<rect key="frame" x="20" y="424" width="22" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BfY-Te-yWV">
<rect key="frame" x="20" y="492" width="45" height="30"/>
<state key="normal" title="write()"/>
<connections>
<action selector="UI_TX:" destination="BYZ-38-t0r" eventType="touchUpInside" id="1ZJ-oI-a98"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IXS-rJ-KKM">
<rect key="frame" x="208" y="94" width="30" height="30"/>
<state key="normal" title="Join"/>
<connections>
<action selector="UI_JoinNetwork:" destination="BYZ-38-t0r" eventType="touchUpInside" id="kem-tf-1h1"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="nwid" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="TvY-qZ-Zjm">
<rect key="frame" x="20" y="94" width="167" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fU2-IH-aMf">
<rect key="frame" x="208" y="122" width="40" height="30"/>
<state key="normal" title="Leave"/>
<connections>
<action selector="UI_LeaveNetwork:" destination="BYZ-38-t0r" eventType="touchUpInside" id="7Pg-IK-dMo"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q7W-t2-dqo">
<rect key="frame" x="20" y="28" width="320" height="28"/>
<attributedString key="attributedText">
<fragment content="-1.-1.-1.-1/-1">
<attributes>
<color key="NSColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="24" name="HelveticaNeue"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<variation key="default">
<mask key="subviews">
<exclude reference="9Qv-V2-VnT"/>
<exclude reference="Lnh-9e-LMk"/>
<exclude reference="bqB-xS-7Oo"/>
</mask>
</variation>
</view>
<connections>
<outlet property="btnBind" destination="dwn-d8-Ki3" id="FHu-Jd-wFh"/>
<outlet property="btnConnect" destination="sM5-GM-4R8" id="Qun-r4-1OF"/>
<outlet property="btnJoinNetwork" destination="IXS-rJ-KKM" id="C88-pL-2CT"/>
<outlet property="btnLeaveNetwork" destination="fU2-IH-aMf" id="YwN-GB-2tc"/>
<outlet property="btnRX" destination="dp1-qj-Mq8" id="vVr-s4-AX9"/>
<outlet property="btnTX" destination="BfY-Te-yWV" id="KTA-eE-Rhy"/>
<outlet property="lblAddress" destination="Q7W-t2-dqo" id="m0T-dL-QB1"/>
<outlet property="segmentProtocol" destination="vwT-sy-CRY" id="BcU-8W-7kX"/>
<outlet property="txtAddr" destination="6id-4C-E8W" id="q3w-zX-ZFf"/>
<outlet property="txtNWID" destination="TvY-qZ-Zjm" id="1Jc-3U-PIE"/>
<outlet property="txtPort" destination="uiQ-EM-gfq" id="CXT-Ed-idq"/>
<outlet property="txtRX" destination="ZjP-35-mln" id="tOT-GE-wq8"/>
<outlet property="txtTX" destination="EBa-HV-MZ5" id="WWI-4O-1iT"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-12" y="326"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,295 @@
//
// 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 {
let zt = ZTSDK();
var serverPort:Int16 = 8080
var serverAddr:String = "10.9.9.100"
var selectedProtocol:Int32 = 0
var sock:Int32 = -1
var accepted_sock:Int32 = -1
@IBOutlet weak var txtAddr: UITextField!
@IBOutlet weak var txtPort: UITextField!
@IBOutlet weak var txtTX: UITextField!
@IBOutlet weak var txtRX: UITextField!
@IBOutlet weak var btnTX: UIButton!
@IBOutlet weak var btnConnect: UIButton!
@IBOutlet weak var btnBind: UIButton!
@IBOutlet weak var btnRX: UIButton!
@IBAction func UI_RX(sender: AnyObject) {
// Use ordinary read/write calls on ZeroTier socket
// TCP
if(selectedProtocol == SOCK_STREAM) {
var buffer = [UInt8](count: 100, repeatedValue: 0)
read(accepted_sock, &buffer, 100);
print(buffer)
}
// UDP
if(selectedProtocol == SOCK_DGRAM) {
var buffer = [UInt8](count: 100, repeatedValue: 0)
read(Int32(sock), &buffer, 100);
print(buffer)
}
}
@IBAction func UI_TX(sender: AnyObject) {
// Use ordinary read/write calls on ZeroTier socket
// TCP
if(selectedProtocol == SOCK_STREAM) {
write(Int32(sock), txtTX.description, txtTX.description.characters.count);
}
// UDP
if(selectedProtocol == SOCK_DGRAM) {
sendto(Int32(sock), txtTX.description, txtTX.description.characters.count, 0, UnsafePointer<sockaddr>([udp_addr]), UInt32(udp_addr.sin_len))
}
}
@IBOutlet weak var txtNWID: UITextField!
@IBOutlet weak var btnJoinNetwork: UIButton!
@IBAction func UI_JoinNetwork(sender: AnyObject) {
zt.join_network(txtNWID.text!)
}
@IBOutlet weak var btnLeaveNetwork: UIButton!
@IBAction func UI_LeaveNetwork(sender: AnyObject) {
zt.leave_network(txtNWID.text!)
}
@IBOutlet weak var segmentProtocol: UISegmentedControl!
@IBAction func protocolSelected(sender: AnyObject) {
switch sender.selectedSegmentIndex
{
case 0:
selectedProtocol = SOCK_STREAM
case 1:
selectedProtocol = SOCK_DGRAM
default:
break;
}
}
// CONNECT
var connect_thread : NSThread!
func attempt_connect()
{
// TCP
if(selectedProtocol == SOCK_STREAM)
{
sock = zt.socket(AF_INET, SOCK_STREAM, 0)
let ztaddr: ZTAddress = ZTAddress(AF_INET, serverAddr, serverPort)
let connect_err = zt.connect(sock, ztaddr)
print("connect_err = \(connect_err),\(errno)")
if connect_err < 0 {
let err = errno
print("Error connecting IPv4 socket \(err)")
return
}
}
// UDP
if(selectedProtocol == SOCK_DGRAM)
{
}
}
// Connect to remote host on ZeroTier virtual network
@IBAction func UI_Connect(sender: AnyObject) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
self.connect_thread = NSThread(target:self, selector:#selector(ViewController.attempt_connect), object:nil)
self.connect_thread.start()
});
}
// BIND
var bind_thread : NSThread!
func attempt_bind()
{
var err:Int32
// TCP
if(selectedProtocol == SOCK_STREAM)
{
sock = zt_socket(AF_INET, SOCK_STREAM, 0)
let ztaddr: ZTAddress = ZTAddress(AF_INET, serverAddr, serverPort)
let bind_err = zt.bind(sock, ztaddr)
print("bind_err = \(bind_err),\(errno)")
if bind_err < 0 {
let err = errno
print("Error binding IPv4 socket \(err)")
return
}
// Put socket into listening state
zt_listen(Int32(sock), 1);
while(accepted_sock < 0) {
accepted_sock = zt.accept(sock, ztaddr)
}
print("accepted connection")
}
// UDP
if(selectedProtocol == SOCK_DGRAM)
{
let ztaddr: ZTAddress = ZTAddress(AF_INET, serverAddr, serverPort)
sock = zt_socket(AF_INET, SOCK_DGRAM, 0)
err = zt.bind(sock, ztaddr)
print("bind_err = ", err)
err = zt.listen(sock, 0)
print("listen_err = ", err)
}
}
@IBOutlet weak var txtAddress: UITextField!
// Bind a ZeroTier socket
@IBAction func UI_Bind(sender: AnyObject) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
self.bind_thread = NSThread(target:self, selector:#selector(ViewController.attempt_bind), object:nil)
self.bind_thread.start()
});
}
@IBOutlet weak var lblAddress: UILabel!
var udp_addr:sockaddr_in!
// Watch for incoming data
var rx_thread : NSThread!
func update_rx() {
while(true)
{
sleep(1)
dispatch_async(dispatch_get_main_queue()) {
var str_buf = [Int8](count: 16, repeatedValue: 0)
self.zt.get_ipv4_address(self.txtNWID.text!, &str_buf)
self.lblAddress.text = String.fromCString(str_buf)
print("addr = ", String.fromCString(str_buf))
}
// TCP
if(selectedProtocol == SOCK_STREAM)
{
let len = 32
var buffer = [UInt8](count: len, repeatedValue: 0)
let n = read(accepted_sock, &buffer, len);
if(n > 0)
{
if let str = String(data: NSData(bytes: &buffer, length: len), encoding: NSUTF8StringEncoding) {
dispatch_async(dispatch_get_main_queue()) {
self.txtRX.text = str
}
} else {
print("not a valid UTF-8 sequence")
}
}
}
// UDP
/*
if(selectedProtocol == SOCK_DGRAM)
{
let len = 32
var buffer = [UInt8](count: len, repeatedValue: 0)
//udp_addr = sockaddr_in(sin_len: UInt8(sizeof(sockaddr_in)),
// sin_family: UInt8(AF_INET),
// sin_port: UInt16(0).bigEndian,
// sin_addr: in_addr(s_addr: 0),
// sin_zero: (0,0,0,0,0,0,0,0))
//var addrlen:socklen_t = 0;
//var legIntPtr = withUnsafeMutablePointer(&addrlen, { $0 })
//let n = recvfrom(sock, &buffer, len, 0, UnsafeMutablePointer<sockaddr>([udp_addr]), legIntPtr)
var socketAddress = sockaddr_storage()
var socketAddressLength = socklen_t(sizeof(sockaddr_storage.self))
let bytesRead = withUnsafeMutablePointers(&socketAddress, &socketAddressLength) {
recvfrom(sock, UnsafeMutablePointer<Void>(buffer), len, 0, UnsafeMutablePointer($0), UnsafeMutablePointer($1))
//recvfrom(<#T##Int32#>, <#T##UnsafeMutablePointer<Void>#>, <#T##Int#>, <#T##Int32#>, <#T##UnsafeMutablePointer<sockaddr>#>, <#T##UnsafeMutablePointer<socklen_t>#>)
}
if(bytesRead > 0)
{
print("socketAddressLength = ", socketAddressLength);
let bytesWritten = withUnsafePointer(&socketAddress) {
print("TXing...\n");
sendto(sock, UnsafePointer(buffer), bytesRead, 0, UnsafePointer<sockaddr>($0), socketAddressLength)
}
print("bytesWritten = ", bytesWritten);
//let bytesWritten = withUnsafePointer(&socketAddress.sin) {
// sendto(sock, buffer, len, 0, UnsafePointer($0), socklen_t(socketAddress.sin.sin_len))
//}
if let str = String(data: NSData(bytes: &buffer, length: len), encoding: NSUTF8StringEncoding) {
dispatch_async(dispatch_get_main_queue()) {
self.txtRX.text = str
}
} else {
print("not a valid UTF-8 sequence")
}
}
}
*/
}
}
override func viewDidLoad() {
super.viewDidLoad()
txtNWID.text = "8056c2e21c000001"
txtTX.text = "welcome to the machine"
txtAddr.text = "0.0.0.0"
serverAddr = "0.0.0.0"
txtPort.text = "8080"
serverPort = 8080
selectedProtocol = SOCK_STREAM
print("Starting ZeroTier...\n");
zt.start_service(nil);
print("Joining network...\n");
zt.join_network(txtNWID.text!);
print("Complete\n");
// UI RX update
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
self.rx_thread = NSThread(target:self, selector:#selector(ViewController.update_rx), object:nil)
self.rx_thread.start()
});
// 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.
}
}

View File

@@ -0,0 +1,54 @@
iOS + ZeroTier SDK
====
Welcome!
Imagine a flat, encrypted, no-configuration LAN for all of the instances of your iOS app.
This short tutorial will show you how to enable ZeroTier functionality for your iOS app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works.
***
**Step 1: Build iOS framework**
- `make ios_app_framework`
- This will output to `build/ios_app_framework/Release-iphoneos/ZeroTierSDK_iOS.framework`
**Step 2: Integrate SDK into project**
- Add the resultant framework package to your project
- Add `src` directory to *Build Settings -> Header Search Paths*
- Add `build/ios_app_framework/Release-iphoneos/` to *Build Settings -> Framework Search Paths*
- Add `ZeroTierSDK.frameworkiOS` to *General->Embedded Binaries*
- Add `src/wrappers/swift/ZTSDK.swift`, `src/wrappers/swift/XcodeWrapper.cpp` and `src/wrappers/swift/XcodeWrapper.hpp` to your project:
- Set `src/wrappers/swift/Apple-Bridging-Header.h` as your bridging-header in *Build Settings -> Objective-C Bridging-header*
**Step 3: Start the ZeroTier service**
Start the service:
```
zt.start_service(nil);
zt.join_network(nwid);
```
Listen for incoming connections:
```
let sock: Int32 = zt.socket(AF_INET, SOCK_STREAM, 0)
let ztaddr: ZTAddress = ZTAddress(AF_INET, serverAddr, Int16(serverPort))
let bind_err = zt.bind(sock, ztaddr)
zt_listen(sock, 1);
let accepted_sock: Int32 = zt.accept(sock, ztaddr)
```
Or, establish a connection:
```
let sock: Int32 = zt.socket(AF_INET, SOCK_STREAM, 0)
let ztaddr: ZTAddress = ZTAddress(AF_INET, serverAddr, Int16(serverPort))
let connect_err: Int32 = zt.connect(sock, ztaddr)
```
**Alternative APIs**
CLick [here](../../../../docs/api_discussion.md) to learn more about alternative APIs such as the Intercept and SOCKS5 Proxy.