diff --git a/SliderExample/SliderExample.xcodeproj/project.pbxproj b/SliderExample/SliderExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..56d299b --- /dev/null +++ b/SliderExample/SliderExample.xcodeproj/project.pbxproj @@ -0,0 +1,443 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + FDFC58871A6FF92400B3F39F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDFC58861A6FF92400B3F39F /* AppDelegate.swift */; }; + FDFC58891A6FF92400B3F39F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDFC58881A6FF92400B3F39F /* ViewController.swift */; }; + FDFC588C1A6FF92400B3F39F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FDFC588A1A6FF92400B3F39F /* Main.storyboard */; }; + FDFC588E1A6FF92400B3F39F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FDFC588D1A6FF92400B3F39F /* Images.xcassets */; }; + FDFC58911A6FF92400B3F39F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = FDFC588F1A6FF92400B3F39F /* LaunchScreen.xib */; }; + FDFC589D1A6FF92400B3F39F /* SliderExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDFC589C1A6FF92400B3F39F /* SliderExampleTests.swift */; }; + FDFC58B21A701DD800B3F39F /* Spacebrew.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDFC58AF1A701DD800B3F39F /* Spacebrew.swift */; }; + FDFC58B31A701DD800B3F39F /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDFC58B01A701DD800B3F39F /* SwiftyJSON.swift */; }; + FDFC58B41A701DD800B3F39F /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDFC58B11A701DD800B3F39F /* WebSocket.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + FDFC58971A6FF92400B3F39F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FDFC58791A6FF92400B3F39F /* Project object */; + proxyType = 1; + remoteGlobalIDString = FDFC58801A6FF92400B3F39F; + remoteInfo = SliderExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + FDFC58811A6FF92400B3F39F /* SliderExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SliderExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + FDFC58851A6FF92400B3F39F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FDFC58861A6FF92400B3F39F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + FDFC58881A6FF92400B3F39F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + FDFC588B1A6FF92400B3F39F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + FDFC588D1A6FF92400B3F39F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + FDFC58901A6FF92400B3F39F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + FDFC58961A6FF92400B3F39F /* SliderExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SliderExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + FDFC589B1A6FF92400B3F39F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FDFC589C1A6FF92400B3F39F /* SliderExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SliderExampleTests.swift; sourceTree = ""; }; + FDFC58AF1A701DD800B3F39F /* Spacebrew.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Spacebrew.swift; sourceTree = ""; }; + FDFC58B01A701DD800B3F39F /* SwiftyJSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftyJSON.swift; sourceTree = ""; }; + FDFC58B11A701DD800B3F39F /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocket.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FDFC587E1A6FF92400B3F39F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FDFC58931A6FF92400B3F39F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FDFC58781A6FF92400B3F39F = { + isa = PBXGroup; + children = ( + FDFC58831A6FF92400B3F39F /* SliderExample */, + FDFC58991A6FF92400B3F39F /* SliderExampleTests */, + FDFC58821A6FF92400B3F39F /* Products */, + ); + sourceTree = ""; + }; + FDFC58821A6FF92400B3F39F /* Products */ = { + isa = PBXGroup; + children = ( + FDFC58811A6FF92400B3F39F /* SliderExample.app */, + FDFC58961A6FF92400B3F39F /* SliderExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + FDFC58831A6FF92400B3F39F /* SliderExample */ = { + isa = PBXGroup; + children = ( + FDFC58AE1A701DD800B3F39F /* source */, + FDFC58861A6FF92400B3F39F /* AppDelegate.swift */, + FDFC58881A6FF92400B3F39F /* ViewController.swift */, + FDFC588A1A6FF92400B3F39F /* Main.storyboard */, + FDFC588D1A6FF92400B3F39F /* Images.xcassets */, + FDFC588F1A6FF92400B3F39F /* LaunchScreen.xib */, + FDFC58841A6FF92400B3F39F /* Supporting Files */, + ); + path = SliderExample; + sourceTree = ""; + }; + FDFC58841A6FF92400B3F39F /* Supporting Files */ = { + isa = PBXGroup; + children = ( + FDFC58851A6FF92400B3F39F /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + FDFC58991A6FF92400B3F39F /* SliderExampleTests */ = { + isa = PBXGroup; + children = ( + FDFC589C1A6FF92400B3F39F /* SliderExampleTests.swift */, + FDFC589A1A6FF92400B3F39F /* Supporting Files */, + ); + path = SliderExampleTests; + sourceTree = ""; + }; + FDFC589A1A6FF92400B3F39F /* Supporting Files */ = { + isa = PBXGroup; + children = ( + FDFC589B1A6FF92400B3F39F /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + FDFC58AE1A701DD800B3F39F /* source */ = { + isa = PBXGroup; + children = ( + FDFC58AF1A701DD800B3F39F /* Spacebrew.swift */, + FDFC58B01A701DD800B3F39F /* SwiftyJSON.swift */, + FDFC58B11A701DD800B3F39F /* WebSocket.swift */, + ); + name = source; + path = ../../source; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FDFC58801A6FF92400B3F39F /* SliderExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = FDFC58A01A6FF92400B3F39F /* Build configuration list for PBXNativeTarget "SliderExample" */; + buildPhases = ( + FDFC587D1A6FF92400B3F39F /* Sources */, + FDFC587E1A6FF92400B3F39F /* Frameworks */, + FDFC587F1A6FF92400B3F39F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SliderExample; + productName = SliderExample; + productReference = FDFC58811A6FF92400B3F39F /* SliderExample.app */; + productType = "com.apple.product-type.application"; + }; + FDFC58951A6FF92400B3F39F /* SliderExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = FDFC58A31A6FF92400B3F39F /* Build configuration list for PBXNativeTarget "SliderExampleTests" */; + buildPhases = ( + FDFC58921A6FF92400B3F39F /* Sources */, + FDFC58931A6FF92400B3F39F /* Frameworks */, + FDFC58941A6FF92400B3F39F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + FDFC58981A6FF92400B3F39F /* PBXTargetDependency */, + ); + name = SliderExampleTests; + productName = SliderExampleTests; + productReference = FDFC58961A6FF92400B3F39F /* SliderExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FDFC58791A6FF92400B3F39F /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = "Georg Fischer"; + TargetAttributes = { + FDFC58801A6FF92400B3F39F = { + CreatedOnToolsVersion = 6.1.1; + }; + FDFC58951A6FF92400B3F39F = { + CreatedOnToolsVersion = 6.1.1; + TestTargetID = FDFC58801A6FF92400B3F39F; + }; + }; + }; + buildConfigurationList = FDFC587C1A6FF92400B3F39F /* Build configuration list for PBXProject "SliderExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = FDFC58781A6FF92400B3F39F; + productRefGroup = FDFC58821A6FF92400B3F39F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FDFC58801A6FF92400B3F39F /* SliderExample */, + FDFC58951A6FF92400B3F39F /* SliderExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + FDFC587F1A6FF92400B3F39F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FDFC588C1A6FF92400B3F39F /* Main.storyboard in Resources */, + FDFC58911A6FF92400B3F39F /* LaunchScreen.xib in Resources */, + FDFC588E1A6FF92400B3F39F /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FDFC58941A6FF92400B3F39F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FDFC587D1A6FF92400B3F39F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FDFC58B21A701DD800B3F39F /* Spacebrew.swift in Sources */, + FDFC58891A6FF92400B3F39F /* ViewController.swift in Sources */, + FDFC58871A6FF92400B3F39F /* AppDelegate.swift in Sources */, + FDFC58B31A701DD800B3F39F /* SwiftyJSON.swift in Sources */, + FDFC58B41A701DD800B3F39F /* WebSocket.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FDFC58921A6FF92400B3F39F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FDFC589D1A6FF92400B3F39F /* SliderExampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + FDFC58981A6FF92400B3F39F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = FDFC58801A6FF92400B3F39F /* SliderExample */; + targetProxy = FDFC58971A6FF92400B3F39F /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + FDFC588A1A6FF92400B3F39F /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FDFC588B1A6FF92400B3F39F /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + FDFC588F1A6FF92400B3F39F /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + FDFC58901A6FF92400B3F39F /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + FDFC589E1A6FF92400B3F39F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + 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 = 8.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = 2; + }; + name = Debug; + }; + FDFC589F1A6FF92400B3F39F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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 = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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 = 8.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 2; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FDFC58A11A6FF92400B3F39F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SliderExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + FDFC58A21A6FF92400B3F39F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SliderExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + FDFC58A41A6FF92400B3F39F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = SliderExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SliderExample.app/SliderExample"; + }; + name = Debug; + }; + FDFC58A51A6FF92400B3F39F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = SliderExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SliderExample.app/SliderExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FDFC587C1A6FF92400B3F39F /* Build configuration list for PBXProject "SliderExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FDFC589E1A6FF92400B3F39F /* Debug */, + FDFC589F1A6FF92400B3F39F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FDFC58A01A6FF92400B3F39F /* Build configuration list for PBXNativeTarget "SliderExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FDFC58A11A6FF92400B3F39F /* Debug */, + FDFC58A21A6FF92400B3F39F /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + FDFC58A31A6FF92400B3F39F /* Build configuration list for PBXNativeTarget "SliderExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FDFC58A41A6FF92400B3F39F /* Debug */, + FDFC58A51A6FF92400B3F39F /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = FDFC58791A6FF92400B3F39F /* Project object */; +} diff --git a/SliderExample/SliderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SliderExample/SliderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..283b523 --- /dev/null +++ b/SliderExample/SliderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SliderExample/SliderExample/AppDelegate.swift b/SliderExample/SliderExample/AppDelegate.swift new file mode 100644 index 0000000..86d48e7 --- /dev/null +++ b/SliderExample/SliderExample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// SliderExample +// +// Created by Georg Fischer on 21.01.15. +// Copyright (c) 2015 Georg Fischer. 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:. + } + + +} + diff --git a/SliderExample/SliderExample/Base.lproj/LaunchScreen.xib b/SliderExample/SliderExample/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..e2f6880 --- /dev/null +++ b/SliderExample/SliderExample/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SliderExample/SliderExample/Base.lproj/Main.storyboard b/SliderExample/SliderExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..5fd2cbf --- /dev/null +++ b/SliderExample/SliderExample/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SliderExample/SliderExample/Images.xcassets/AppIcon.appiconset/Contents.json b/SliderExample/SliderExample/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a4645e6 --- /dev/null +++ b/SliderExample/SliderExample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "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" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SliderExample/SliderExample/Info.plist b/SliderExample/SliderExample/Info.plist new file mode 100644 index 0000000..734877f --- /dev/null +++ b/SliderExample/SliderExample/Info.plist @@ -0,0 +1,41 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + io.arbitrary.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SliderExample/SliderExample/ViewController.swift b/SliderExample/SliderExample/ViewController.swift new file mode 100644 index 0000000..574dff4 --- /dev/null +++ b/SliderExample/SliderExample/ViewController.swift @@ -0,0 +1,161 @@ +// +// ViewController.swift +// SliderExample +// +// Created by Georg Fischer on 21.01.15. +// Copyright (c) 2015 Georg Fischer. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController, SpacebrewDelegate { + + var appName = "slider example" + + var slider1Label:UILabel? + var slider2Label:UILabel? + var slider3Label:UILabel? + + var slider1:UISlider? + var slider2:UISlider? + var slider3:UISlider? + + var sb:Spacebrew? + + required init(coder aDecoder: NSCoder) { + super.init(coder:aDecoder) + } + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + + // Add Slider Labels + + self.slider1Label = UILabel(frame:CGRect(x: CGFloat(20), y: CGFloat(40), width: self.view.frame.size.width - CGFloat(40), height: CGFloat(40))) + self.slider1Label!.text = "Input Slider 1" + self.view.addSubview(self.slider1Label!) + + self.slider2Label = UILabel(frame:CGRect(x: CGFloat(20), y: CGFloat(140), width: self.view.frame.size.width - CGFloat(40), height: CGFloat(40))) + self.slider2Label!.text = "Input Slider 2" + self.view.addSubview(slider2Label!) + + self.slider3Label = UILabel(frame:CGRect(x: CGFloat(20), y: CGFloat(240), width: self.view.frame.size.width - CGFloat(40), height: CGFloat(40))) + self.slider3Label!.text = "Input Slider 3" + self.view.addSubview(self.slider3Label!) + + // Add Sliders + + self.slider1 = UISlider(frame: CGRect(x: CGFloat(20), y: CGFloat(60), width: self.view.frame.size.width - CGFloat(40), height: CGFloat(40))) + self.view.addSubview(self.slider1!) + + self.slider2 = UISlider(frame: CGRect(x: CGFloat(20), y: CGFloat(160), width: self.view.frame.size.width - CGFloat(40), height: CGFloat(40))) + self.view.addSubview(self.slider2!) + + self.slider3 = UISlider(frame: CGRect(x: CGFloat(20), y: CGFloat(260), width: self.view.frame.size.width - CGFloat(40), height: CGFloat(40))) + self.view.addSubview(self.slider3!) + + self.setupUI() + self.setupSpacebrew() + } + + func setupUI () { + println("Setting up the UI listeners") + + self.slider1!.addTarget(self, action: "sliderValueChanged:", forControlEvents: UIControlEvents.ValueChanged) + self.slider1!.minimumValue = 0 + self.slider1!.maximumValue = 1023 + self.slider1!.value = 500 + self.slider1!.tag = 1 + + self.slider1Label!.text = "Input Slider 1: \(self.slider1!.value)" + + self.slider2!.addTarget(self, action: "sliderValueChanged:", forControlEvents: UIControlEvents.ValueChanged) + self.slider2!.minimumValue = 0 + self.slider2!.maximumValue = 1023 + self.slider2!.value = 500 + self.slider2!.tag = 2 + + self.slider2Label!.text = "Input Slider 1: \(self.slider2!.value)" + + self.slider3!.addTarget(self, action: "sliderValueChanged:", forControlEvents: UIControlEvents.ValueChanged) + self.slider3!.minimumValue = 0 + self.slider3!.maximumValue = 1023 + self.slider3!.value = 500 + self.slider3!.tag = 3 + + self.slider3Label!.text = "Input Slider 3: \(self.slider3!.value)" + } + + func setupSpacebrew () { + var randomId = "\(Int(arc4random_uniform(UInt32(10000))))" + self.appName = "\(self.appName) \(randomId)" + + println("Setting up spacebrew connection") + + self.sb = Spacebrew(host: "localhost", name: self.appName, description: "Sliders for sending and displaying SpaceBrew range messages") + self.sb!.delegate = self + self.sb!.addPublish("slider1", type: Spacebrew.BrewType.BrewRange, def: "500") + self.sb!.addPublish("slider2", type: Spacebrew.BrewType.BrewRange, def: "500") + self.sb!.addPublish("slider3", type: Spacebrew.BrewType.BrewRange, def: "500") + self.sb!.addSubscribe("slider1", type: Spacebrew.BrewType.BrewRange) + self.sb!.addSubscribe("slider2", type: Spacebrew.BrewType.BrewRange) + self.sb!.addSubscribe("slider3", type: Spacebrew.BrewType.BrewRange) + self.sb!.connect() + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + func sliderValueChanged(sender:UISlider) { + println("Sent new range message: slider\(sender.tag), \(sender.value)") + self.sb!.send("slider\(sender.tag)", type: Spacebrew.BrewType.BrewRange, value: NSString(format: "%.4f", sender.value)) + + if (sender.tag == 1) { + self.slider1Label!.text = "Input Slider 1: \(sender.value)" + } + + if (sender.tag == 2) { + self.slider2Label!.text = "Input Slider 2: \(sender.value)" + } + + if (sender.tag == 3) { + self.slider3Label!.text = "Input Slider 3: \(sender.value)" + } + } + + // MARK: SpacebrewDelegate + + func spacebrewConnectionOpened() { + println("Connected as \(self.appName)") + } + + func spacebrewConnectionClosed() { } + func spacebrewCustomMessageReceived(name: String, value: String, type: String) { } + + func spacebrewRangeMessageReceived(name: String, value: Int) { + println("Received new range message: \(name), \(value)") + + if (name == "slider1") { + self.slider1!.value = Float(value) + self.slider1Label!.text = "Input Slider 1: \(self.slider1!.value)" + } + + if (name == "slider2") { + self.slider2!.value = Float(value) + self.slider2Label!.text = "Input Slider 2: \(self.slider2!.value)" + } + + if (name == "slider3") { + self.slider3!.value = Float(value) + self.slider3Label!.text = "Input Slider 3: \(self.slider3!.value)" + } + } + + func spacebrewStringMessageReceived(name: String, value: String) { } + func spacebrewBoolMessageReceived(name: String, value: Bool) { } + func spacebrewBinaryMessageReceived(name: String, value: String, type: NSMutableData?) { } +} + diff --git a/SliderExample/SliderExampleTests/Info.plist b/SliderExample/SliderExampleTests/Info.plist new file mode 100644 index 0000000..c400a84 --- /dev/null +++ b/SliderExample/SliderExampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + io.arbitrary.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/SliderExample/SliderExampleTests/SliderExampleTests.swift b/SliderExample/SliderExampleTests/SliderExampleTests.swift new file mode 100644 index 0000000..4a5555e --- /dev/null +++ b/SliderExample/SliderExampleTests/SliderExampleTests.swift @@ -0,0 +1,36 @@ +// +// SliderExampleTests.swift +// SliderExampleTests +// +// Created by Georg Fischer on 21.01.15. +// Copyright (c) 2015 Georg Fischer. All rights reserved. +// + +import UIKit +import XCTest + +class SliderExampleTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + XCTAssert(true, "Pass") + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock() { + // Put the code you want to measure the time of here. + } + } + +}