diff --git a/README.md b/README.md index 2190f95..8f5f30a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -![Xcode Tested](http://img.shields.io/badge/Xcode%20Tested-Xcode%206.1-orange.svg?style=flat) +![Xcode Tested](http://img.shields.io/badge/Xcode%20Tested-Xcode%207.1.1-orange.svg?style=flat) ![Bluefruit LE nRF8001 Breakout](https://raw.githubusercontent.com/MichMich/nRF8001-Swift/master/Images/nRF8001-Swift_rounded.jpg) diff --git a/nRF8001-Swift.xcodeproj/project.pbxproj b/nRF8001-Swift.xcodeproj/project.pbxproj index 6f8eb5b..e670b03 100644 --- a/nRF8001-Swift.xcodeproj/project.pbxproj +++ b/nRF8001-Swift.xcodeproj/project.pbxproj @@ -7,47 +7,27 @@ objects = { /* Begin PBXBuildFile section */ - 4C43DBDE198A6E5300C31784 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C43DBDD198A6E5300C31784 /* AppDelegate.swift */; }; - 4C43DBE0198A6E5300C31784 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C43DBDF198A6E5300C31784 /* ViewController.swift */; }; - 4C43DBE3198A6E5300C31784 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4C43DBE1198A6E5300C31784 /* Main.storyboard */; }; - 4C43DBE5198A6E5300C31784 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C43DBE4198A6E5300C31784 /* Images.xcassets */; }; - 4C43DBF1198A6E5300C31784 /* nRF8001_SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C43DBF0198A6E5300C31784 /* nRF8001_SwiftTests.swift */; }; - 4C43DBFB198A6E9300C31784 /* NRFManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C43DBFA198A6E9300C31784 /* NRFManager.swift */; }; + 4CACBDF61C0B6F6D006A9937 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CACBDF51C0B6F6D006A9937 /* AppDelegate.swift */; }; + 4CACBDF81C0B6F6D006A9937 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CACBDF71C0B6F6D006A9937 /* ViewController.swift */; }; + 4CACBDFB1C0B6F6D006A9937 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4CACBDF91C0B6F6D006A9937 /* Main.storyboard */; }; + 4CACBDFD1C0B6F6D006A9937 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4CACBDFC1C0B6F6D006A9937 /* Assets.xcassets */; }; + 4CACBE001C0B6F6D006A9937 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4CACBDFE1C0B6F6D006A9937 /* LaunchScreen.storyboard */; }; + 4CACBE081C0B6F7D006A9937 /* NRFManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CACBE071C0B6F7D006A9937 /* NRFManager.swift */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 4C43DBEB198A6E5300C31784 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C43DBD0198A6E5300C31784 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4C43DBD7198A6E5300C31784; - remoteInfo = "nRF8001-Swift"; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ - 4C43DBD8198A6E5300C31784 /* nRF8001-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "nRF8001-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 4C43DBDC198A6E5300C31784 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4C43DBDD198A6E5300C31784 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 4C43DBDF198A6E5300C31784 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 4C43DBE2198A6E5300C31784 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 4C43DBE4198A6E5300C31784 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 4C43DBEA198A6E5300C31784 /* nRF8001-SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "nRF8001-SwiftTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 4C43DBEF198A6E5300C31784 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4C43DBF0198A6E5300C31784 /* nRF8001_SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = nRF8001_SwiftTests.swift; sourceTree = ""; }; - 4C43DBFA198A6E9300C31784 /* NRFManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NRFManager.swift; sourceTree = ""; }; - 4C43DBFE198A7AFF00C31784 /* nRF8001-Swift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "nRF8001-Swift-Bridging-Header.h"; sourceTree = ""; }; + 4CACBDF21C0B6F6D006A9937 /* nRF8001-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "nRF8001-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4CACBDF51C0B6F6D006A9937 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 4CACBDF71C0B6F6D006A9937 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 4CACBDFA1C0B6F6D006A9937 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 4CACBDFC1C0B6F6D006A9937 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 4CACBDFF1C0B6F6D006A9937 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 4CACBE011C0B6F6D006A9937 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 4CACBE071C0B6F7D006A9937 /* NRFManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NRFManager.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 4C43DBD5198A6E5300C31784 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4C43DBE7198A6E5300C31784 /* Frameworks */ = { + 4CACBDEF1C0B6F6D006A9937 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -57,73 +37,46 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 4C43DBCF198A6E5300C31784 = { + 4CACBDE91C0B6F6D006A9937 = { isa = PBXGroup; children = ( - 4C43DBDA198A6E5300C31784 /* nRF8001-Swift */, - 4C43DBED198A6E5300C31784 /* nRF8001-SwiftTests */, - 4C43DBD9198A6E5300C31784 /* Products */, + 4CACBDF41C0B6F6D006A9937 /* nRF8001-Swift */, + 4CACBDF31C0B6F6D006A9937 /* Products */, ); sourceTree = ""; }; - 4C43DBD9198A6E5300C31784 /* Products */ = { + 4CACBDF31C0B6F6D006A9937 /* Products */ = { isa = PBXGroup; children = ( - 4C43DBD8198A6E5300C31784 /* nRF8001-Swift.app */, - 4C43DBEA198A6E5300C31784 /* nRF8001-SwiftTests.xctest */, + 4CACBDF21C0B6F6D006A9937 /* nRF8001-Swift.app */, ); name = Products; sourceTree = ""; }; - 4C43DBDA198A6E5300C31784 /* nRF8001-Swift */ = { + 4CACBDF41C0B6F6D006A9937 /* nRF8001-Swift */ = { isa = PBXGroup; children = ( - 4C43DBDD198A6E5300C31784 /* AppDelegate.swift */, - 4C43DBDF198A6E5300C31784 /* ViewController.swift */, - 4C43DBE1198A6E5300C31784 /* Main.storyboard */, - 4C43DBE4198A6E5300C31784 /* Images.xcassets */, - 4C43DBDB198A6E5300C31784 /* Supporting Files */, - 4C43DBFA198A6E9300C31784 /* NRFManager.swift */, - 4C43DBFE198A7AFF00C31784 /* nRF8001-Swift-Bridging-Header.h */, + 4CACBE071C0B6F7D006A9937 /* NRFManager.swift */, + 4CACBDF51C0B6F6D006A9937 /* AppDelegate.swift */, + 4CACBDF71C0B6F6D006A9937 /* ViewController.swift */, + 4CACBDF91C0B6F6D006A9937 /* Main.storyboard */, + 4CACBDFC1C0B6F6D006A9937 /* Assets.xcassets */, + 4CACBDFE1C0B6F6D006A9937 /* LaunchScreen.storyboard */, + 4CACBE011C0B6F6D006A9937 /* Info.plist */, ); path = "nRF8001-Swift"; sourceTree = ""; }; - 4C43DBDB198A6E5300C31784 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 4C43DBDC198A6E5300C31784 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 4C43DBED198A6E5300C31784 /* nRF8001-SwiftTests */ = { - isa = PBXGroup; - children = ( - 4C43DBF0198A6E5300C31784 /* nRF8001_SwiftTests.swift */, - 4C43DBEE198A6E5300C31784 /* Supporting Files */, - ); - path = "nRF8001-SwiftTests"; - sourceTree = ""; - }; - 4C43DBEE198A6E5300C31784 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 4C43DBEF198A6E5300C31784 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 4C43DBD7198A6E5300C31784 /* nRF8001-Swift */ = { + 4CACBDF11C0B6F6D006A9937 /* nRF8001-Swift */ = { isa = PBXNativeTarget; - buildConfigurationList = 4C43DBF4198A6E5300C31784 /* Build configuration list for PBXNativeTarget "nRF8001-Swift" */; + buildConfigurationList = 4CACBE041C0B6F6D006A9937 /* Build configuration list for PBXNativeTarget "nRF8001-Swift" */; buildPhases = ( - 4C43DBD4198A6E5300C31784 /* Sources */, - 4C43DBD5198A6E5300C31784 /* Frameworks */, - 4C43DBD6198A6E5300C31784 /* Resources */, + 4CACBDEE1C0B6F6D006A9937 /* Sources */, + 4CACBDEF1C0B6F6D006A9937 /* Frameworks */, + 4CACBDF01C0B6F6D006A9937 /* Resources */, ); buildRules = ( ); @@ -131,46 +84,25 @@ ); name = "nRF8001-Swift"; productName = "nRF8001-Swift"; - productReference = 4C43DBD8198A6E5300C31784 /* nRF8001-Swift.app */; + productReference = 4CACBDF21C0B6F6D006A9937 /* nRF8001-Swift.app */; productType = "com.apple.product-type.application"; }; - 4C43DBE9198A6E5300C31784 /* nRF8001-SwiftTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4C43DBF7198A6E5300C31784 /* Build configuration list for PBXNativeTarget "nRF8001-SwiftTests" */; - buildPhases = ( - 4C43DBE6198A6E5300C31784 /* Sources */, - 4C43DBE7198A6E5300C31784 /* Frameworks */, - 4C43DBE8198A6E5300C31784 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 4C43DBEC198A6E5300C31784 /* PBXTargetDependency */, - ); - name = "nRF8001-SwiftTests"; - productName = "nRF8001-SwiftTests"; - productReference = 4C43DBEA198A6E5300C31784 /* nRF8001-SwiftTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 4C43DBD0198A6E5300C31784 /* Project object */ = { + 4CACBDEA1C0B6F6D006A9937 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastSwiftUpdateCheck = 0710; + LastUpgradeCheck = 0710; ORGANIZATIONNAME = "Michael Teeuw"; TargetAttributes = { - 4C43DBD7198A6E5300C31784 = { - CreatedOnToolsVersion = 6.0; - }; - 4C43DBE9198A6E5300C31784 = { - CreatedOnToolsVersion = 6.0; - TestTargetID = 4C43DBD7198A6E5300C31784; + 4CACBDF11C0B6F6D006A9937 = { + CreatedOnToolsVersion = 7.1.1; }; }; }; - buildConfigurationList = 4C43DBD3198A6E5300C31784 /* Build configuration list for PBXProject "nRF8001-Swift" */; + buildConfigurationList = 4CACBDED1C0B6F6D006A9937 /* Build configuration list for PBXProject "nRF8001-Swift" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -178,78 +110,63 @@ en, Base, ); - mainGroup = 4C43DBCF198A6E5300C31784; - productRefGroup = 4C43DBD9198A6E5300C31784 /* Products */; + mainGroup = 4CACBDE91C0B6F6D006A9937; + productRefGroup = 4CACBDF31C0B6F6D006A9937 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 4C43DBD7198A6E5300C31784 /* nRF8001-Swift */, - 4C43DBE9198A6E5300C31784 /* nRF8001-SwiftTests */, + 4CACBDF11C0B6F6D006A9937 /* nRF8001-Swift */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 4C43DBD6198A6E5300C31784 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4C43DBE3198A6E5300C31784 /* Main.storyboard in Resources */, - 4C43DBE5198A6E5300C31784 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4C43DBE8198A6E5300C31784 /* Resources */ = { + 4CACBDF01C0B6F6D006A9937 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4CACBE001C0B6F6D006A9937 /* LaunchScreen.storyboard in Resources */, + 4CACBDFD1C0B6F6D006A9937 /* Assets.xcassets in Resources */, + 4CACBDFB1C0B6F6D006A9937 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 4C43DBD4198A6E5300C31784 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4C43DBE0198A6E5300C31784 /* ViewController.swift in Sources */, - 4C43DBFB198A6E9300C31784 /* NRFManager.swift in Sources */, - 4C43DBDE198A6E5300C31784 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4C43DBE6198A6E5300C31784 /* Sources */ = { + 4CACBDEE1C0B6F6D006A9937 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4C43DBF1198A6E5300C31784 /* nRF8001_SwiftTests.swift in Sources */, + 4CACBDF81C0B6F6D006A9937 /* ViewController.swift in Sources */, + 4CACBE081C0B6F7D006A9937 /* NRFManager.swift in Sources */, + 4CACBDF61C0B6F6D006A9937 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 4C43DBEC198A6E5300C31784 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4C43DBD7198A6E5300C31784 /* nRF8001-Swift */; - targetProxy = 4C43DBEB198A6E5300C31784 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ - 4C43DBE1198A6E5300C31784 /* Main.storyboard */ = { + 4CACBDF91C0B6F6D006A9937 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 4C43DBE2198A6E5300C31784 /* Base */, + 4CACBDFA1C0B6F6D006A9937 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; + 4CACBDFE1C0B6F6D006A9937 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 4CACBDFF1C0B6F6D006A9937 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 4C43DBF2198A6E5300C31784 /* Debug */ = { + 4CACBE021C0B6F6D006A9937 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -268,22 +185,24 @@ 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_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.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -292,7 +211,7 @@ }; name = Debug; }; - 4C43DBF3198A6E5300C31784 /* Release */ = { + 4CACBE031C0B6F6D006A9937 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -310,17 +229,19 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; + 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 = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -328,100 +249,49 @@ }; name = Release; }; - 4C43DBF5198A6E5300C31784 /* Debug */ = { + 4CACBE051C0B6F6D006A9937 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = "nRF8001-Swift/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "nl.xonaymedia.nRF8001-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "nRF8001-Swift/nRF8001-Swift-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - 4C43DBF6198A6E5300C31784 /* Release */ = { + 4CACBE061C0B6F6D006A9937 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = "nRF8001-Swift/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "nl.xonaymedia.nRF8001-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "nRF8001-Swift/nRF8001-Swift-Bridging-Header.h"; - }; - name = Release; - }; - 4C43DBF8198A6E5300C31784 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/nRF8001-Swift.app/nRF8001-Swift"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "nRF8001-SwiftTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - }; - name = Debug; - }; - 4C43DBF9198A6E5300C31784 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/nRF8001-Swift.app/nRF8001-Swift"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = "nRF8001-SwiftTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 4C43DBD3198A6E5300C31784 /* Build configuration list for PBXProject "nRF8001-Swift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4C43DBF2198A6E5300C31784 /* Debug */, - 4C43DBF3198A6E5300C31784 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 4C43DBF4198A6E5300C31784 /* Build configuration list for PBXNativeTarget "nRF8001-Swift" */ = { + 4CACBDED1C0B6F6D006A9937 /* Build configuration list for PBXProject "nRF8001-Swift" */ = { isa = XCConfigurationList; buildConfigurations = ( - 4C43DBF5198A6E5300C31784 /* Debug */, - 4C43DBF6198A6E5300C31784 /* Release */, + 4CACBE021C0B6F6D006A9937 /* Debug */, + 4CACBE031C0B6F6D006A9937 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4C43DBF7198A6E5300C31784 /* Build configuration list for PBXNativeTarget "nRF8001-SwiftTests" */ = { + 4CACBE041C0B6F6D006A9937 /* Build configuration list for PBXNativeTarget "nRF8001-Swift" */ = { isa = XCConfigurationList; buildConfigurations = ( - 4C43DBF8198A6E5300C31784 /* Debug */, - 4C43DBF9198A6E5300C31784 /* Release */, + 4CACBE051C0B6F6D006A9937 /* Debug */, + 4CACBE061C0B6F6D006A9937 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 4C43DBD0198A6E5300C31784 /* Project object */; + rootObject = 4CACBDEA1C0B6F6D006A9937 /* Project object */; } diff --git a/nRF8001-Swift.xcodeproj/project.xcworkspace/xcshareddata/nRF8001-Swift.xccheckout b/nRF8001-Swift.xcodeproj/project.xcworkspace/xcshareddata/nRF8001-Swift.xccheckout deleted file mode 100644 index 7a32d7b..0000000 --- a/nRF8001-Swift.xcodeproj/project.xcworkspace/xcshareddata/nRF8001-Swift.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 9A8E8F9C-AF44-483D-9AE2-E007B4C52C4A - IDESourceControlProjectName - nRF8001-Swift - IDESourceControlProjectOriginsDictionary - - D451D584F85F28E4FD1687969E33460BB0E682FB - https://github.com/MichMich/nRF8001-Swift.git - - IDESourceControlProjectPath - nRF8001-Swift.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - D451D584F85F28E4FD1687969E33460BB0E682FB - ../.. - - IDESourceControlProjectURL - https://github.com/MichMich/nRF8001-Swift.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - D451D584F85F28E4FD1687969E33460BB0E682FB - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - D451D584F85F28E4FD1687969E33460BB0E682FB - IDESourceControlWCCName - nRF8001-Swift - - - - diff --git a/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index 8f94031..0000000 --- a/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/nRF8001-Swift.xcscheme b/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/nRF8001-Swift.xcscheme index 2528b06..126a854 100644 --- a/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/nRF8001-Swift.xcscheme +++ b/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/nRF8001-Swift.xcscheme @@ -1,6 +1,6 @@ @@ -23,45 +23,39 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + - + @@ -71,15 +65,16 @@ - + diff --git a/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/xcschememanagement.plist b/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/xcschememanagement.plist index cb71d38..340e55c 100644 --- a/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/nRF8001-Swift.xcodeproj/xcuserdata/Michael.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,12 +12,7 @@ SuppressBuildableAutocreation - 4C43DBD7198A6E5300C31784 - - primary - - - 4C43DBE9198A6E5300C31784 + 4CACBDF11C0B6F6D006A9937 primary diff --git a/nRF8001-Swift/AppDelegate.swift b/nRF8001-Swift/AppDelegate.swift index 983e466..784b122 100644 --- a/nRF8001-Swift/AppDelegate.swift +++ b/nRF8001-Swift/AppDelegate.swift @@ -2,42 +2,42 @@ // AppDelegate.swift // nRF8001-Swift // -// Created by Michael Teeuw on 31-07-14. -// Copyright (c) 2014 Michael Teeuw. All rights reserved. +// Created by Michael Teeuw on 29-11-15. +// Copyright © 2015 Michael Teeuw. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? - func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } - func applicationWillResignActive(application: UIApplication!) { + 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!) { + 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!) { + 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!) { + 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!) { + func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } diff --git a/nRF8001-Swift/Images.xcassets/AppIcon.appiconset/Contents.json b/nRF8001-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 76% rename from nRF8001-Swift/Images.xcassets/AppIcon.appiconset/Contents.json rename to nRF8001-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json index 91bf9c1..36d2c80 100644 --- a/nRF8001-Swift/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/nRF8001-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -5,16 +5,31 @@ "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", diff --git a/nRF8001-Swift/Base.lproj/LaunchScreen.storyboard b/nRF8001-Swift/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..2e721e1 --- /dev/null +++ b/nRF8001-Swift/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nRF8001-Swift/Base.lproj/Main.storyboard b/nRF8001-Swift/Base.lproj/Main.storyboard index d1892b3..3a2a49b 100644 --- a/nRF8001-Swift/Base.lproj/Main.storyboard +++ b/nRF8001-Swift/Base.lproj/Main.storyboard @@ -1,13 +1,13 @@ - + - + - + diff --git a/nRF8001-Swift/Images.xcassets/LaunchImage.launchimage/Contents.json b/nRF8001-Swift/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 6f870a4..0000000 --- a/nRF8001-Swift/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/nRF8001-Swift/Info.plist b/nRF8001-Swift/Info.plist index bfba5b0..40c6215 100644 --- a/nRF8001-Swift/Info.plist +++ b/nRF8001-Swift/Info.plist @@ -5,13 +5,13 @@ CFBundleDevelopmentRegion en CFBundleExecutable - ${EXECUTABLE_NAME} + $(EXECUTABLE_NAME) CFBundleIdentifier - nl.xonaymedia.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - ${PRODUCT_NAME} + $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString @@ -22,6 +22,8 @@ 1 LSRequiresIPhoneOS + UILaunchStoryboardName + LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities diff --git a/nRF8001-Swift/NRFManager.swift b/nRF8001-Swift/NRFManager.swift index 0f88b05..482df70 100644 --- a/nRF8001-Swift/NRFManager.swift +++ b/nRF8001-Swift/NRFManager.swift @@ -36,7 +36,7 @@ public class NRFManager:NSObject, CBCentralManagerDelegate, UARTPeripheralDelega //Private Properties - private let bluetoothManager:CBCentralManager! + private var bluetoothManager:CBCentralManager! private var currentPeripheral: UARTPeripheral? { didSet { if let p = currentPeripheral { @@ -136,7 +136,7 @@ extension NRFManager { private func log(logMessage: String) { if (verbose) { - println("NRFManager: \(logMessage)") + print("NRFManager: \(logMessage)") } } } @@ -161,7 +161,7 @@ extension NRFManager { } log("Disconnect ...") - bluetoothManager.cancelPeripheralConnection(currentPeripheral?.peripheral) + bluetoothManager.cancelPeripheralConnection((currentPeripheral?.peripheral)!) } public func writeString(string:String) -> Bool @@ -193,7 +193,7 @@ extension NRFManager { // MARK: - CBCentralManagerDelegate Methods extension NRFManager { - public func centralManagerDidUpdateState(central: CBCentralManager!) + public func centralManagerDidUpdateState(central: CBCentralManager) { log("Central Manager Did UpdateState") if central.state == .PoweredOn { @@ -210,14 +210,14 @@ extension NRFManager { } } - public func centralManager(central: CBCentralManager!, didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData: [NSObject : AnyObject]!, RSSI: NSNumber!) + public func centralManager(central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData: [String : AnyObject], RSSI: NSNumber) { log("Did discover peripheral: \(peripheral.name)") bluetoothManager.stopScan() connectPeripheral(peripheral) } - public func centralManager(central: CBCentralManager!, didConnectPeripheral peripheral: CBPeripheral!) + public func centralManager(central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral) { log("Did Connect Peripheral") if currentPeripheral?.peripheral == peripheral { @@ -231,7 +231,7 @@ extension NRFManager { } } - public func centralManager(central: CBCentralManager!, didDisconnectPeripheral peripheral: CBPeripheral!, error: NSError!) + public func centralManager(central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: NSError?) { log("Peripheral Disconnected: \(peripheral.name)") @@ -263,8 +263,8 @@ extension NRFManager { let string = NSString(data: newData, encoding:NSUTF8StringEncoding) log("String: \(string)") - dataCallback?(data: newData, string: string!) - delegate?.nrfReceivedData?(self, data:newData, string: string!) + dataCallback?(data: newData, string: string! as String) + delegate?.nrfReceivedData?(self, data:newData, string: string! as String) } } @@ -299,7 +299,7 @@ extension NRFManager { */ // MARK: UARTPeripheral Initialization -private class UARTPeripheral:NSObject, CBPeripheralDelegate { +public class UARTPeripheral:NSObject, CBPeripheralDelegate { private var peripheral:CBPeripheral private var uartService:CBService? @@ -332,18 +332,22 @@ extension UARTPeripheral { private func setupPeripheralForUse(peripheral:CBPeripheral) { log("Set up peripheral for use"); - for s:CBService in peripheral.services as [CBService] { - for c:CBCharacteristic in s.characteristics as [CBCharacteristic] { - if compareID(c.UUID, toID: UARTPeripheral.rxCharacteristicsUUID()) { - log("Found RX Characteristics") - rxCharacteristic = c - peripheral.setNotifyValue(true, forCharacteristic: rxCharacteristic) - } else if compareID(c.UUID, toID: UARTPeripheral.txCharacteristicsUUID()) { - log("Found TX Characteristics") - txCharacteristic = c - } else if compareID(c.UUID, toID: UARTPeripheral.hardwareRevisionStringUUID()) { - log("Found Hardware Revision String characteristic") - peripheral.readValueForCharacteristic(c) + if let services = peripheral.services { + for service:CBService in services { + if let characteristics = service.characteristics { + for characteristic:CBCharacteristic in characteristics { + if compareID(characteristic.UUID, toID: UARTPeripheral.rxCharacteristicsUUID()) { + log("Found RX Characteristics") + rxCharacteristic = characteristic + peripheral.setNotifyValue(true, forCharacteristic: rxCharacteristic!) + } else if compareID(characteristic.UUID, toID: UARTPeripheral.txCharacteristicsUUID()) { + log("Found TX Characteristics") + txCharacteristic = characteristic + } else if compareID(characteristic.UUID, toID: UARTPeripheral.hardwareRevisionStringUUID()) { + log("Found Hardware Revision String characteristic") + peripheral.readValueForCharacteristic(characteristic) + } + } } } } @@ -351,7 +355,7 @@ extension UARTPeripheral { private func log(logMessage: String) { if (verbose) { - println("UARTPeripheral: \(logMessage)") + print("UARTPeripheral: \(logMessage)") } } @@ -371,7 +375,7 @@ extension UARTPeripheral { private func writeString(string:String) { log("Write string: \(string)") - let data = NSData(bytes: string, length: countElements(string)) + let data = NSData(bytes: string, length: string.characters.count) writeRawData(data) } @@ -381,9 +385,9 @@ extension UARTPeripheral { if let txCharacteristic = self.txCharacteristic { - if txCharacteristic.properties & .WriteWithoutResponse != nil { + if txCharacteristic.properties.intersect(.WriteWithoutResponse) != [] { peripheral.writeValue(data, forCharacteristic: txCharacteristic, type: .WithoutResponse) - } else if txCharacteristic.properties & .Write != nil { + } else if txCharacteristic.properties.intersect(.Write) != [] { peripheral.writeValue(data, forCharacteristic: txCharacteristic, type: .WithResponse) } else { log("No write property on TX characteristics: \(txCharacteristic.properties)") @@ -395,18 +399,21 @@ extension UARTPeripheral { // MARK: CBPeripheral Delegate methods extension UARTPeripheral { - private func peripheral(peripheral: CBPeripheral, didDiscoverServices error:NSError!) { + public func peripheral(peripheral: CBPeripheral, didDiscoverServices error:NSError?) { + if error == nil { - for s:CBService in peripheral.services as [CBService] { - if s.characteristics != nil { - var e = NSError() - //peripheral(peripheral, didDiscoverCharacteristicsForService: s, error: e) - } else if compareID(s.UUID, toID: UARTPeripheral.uartServiceUUID()) { - log("Found correct service") - uartService = s - peripheral.discoverCharacteristics([UARTPeripheral.txCharacteristicsUUID(),UARTPeripheral.rxCharacteristicsUUID()], forService: uartService) - } else if compareID(s.UUID, toID: UARTPeripheral.deviceInformationServiceUUID()) { - peripheral.discoverCharacteristics([UARTPeripheral.hardwareRevisionStringUUID()], forService: s) + if let services = peripheral.services { + for service:CBService in services { + if service.characteristics != nil { + //var e = NSError() + //peripheral(peripheral, didDiscoverCharacteristicsForService: s, error: e) + } else if compareID(service.UUID, toID: UARTPeripheral.uartServiceUUID()) { + log("Found correct service") + uartService = service + peripheral.discoverCharacteristics([UARTPeripheral.txCharacteristicsUUID(),UARTPeripheral.rxCharacteristicsUUID()], forService: uartService!) + } else if compareID(service.UUID, toID: UARTPeripheral.deviceInformationServiceUUID()) { + peripheral.discoverCharacteristics([UARTPeripheral.hardwareRevisionStringUUID()], forService: service) + } } } } else { @@ -416,14 +423,15 @@ extension UARTPeripheral { } } - private func peripheral(peripheral: CBPeripheral!, didDiscoverCharacteristicsForService service: CBService!, error: NSError!) + public func peripheral(peripheral: CBPeripheral, didDiscoverCharacteristicsForService service: CBService, error: NSError?) { if error == nil { log("Did Discover Characteristics For Service: \(service.description)") - let services:[CBService] = peripheral.services as [CBService] - let s = services[services.count - 1] - if compareID(service.UUID, toID: s.UUID) { - setupPeripheralForUse(peripheral) + if let services = peripheral.services { + let s = services[services.count - 1] + if compareID(service.UUID, toID: s.UUID) { + setupPeripheralForUse(peripheral) + } } } else { log("Error discovering characteristics: \(error)") @@ -432,17 +440,19 @@ extension UARTPeripheral { } } - private func peripheral(peripheral: CBPeripheral!, didUpdateValueForCharacteristic characteristic: CBCharacteristic!, error: NSError!) + public func peripheral(peripheral: CBPeripheral, didUpdateValueForCharacteristic characteristic: CBCharacteristic, error: NSError?) { log("Did Update Value For Characteristic") if error == nil { if characteristic == rxCharacteristic { - log("Recieved: \(characteristic.value)") - delegate.didReceiveData(characteristic.value) + if let value = characteristic.value { + log("Recieved: \(value)") + delegate.didReceiveData(value) + } } else if compareID(characteristic.UUID, toID: UARTPeripheral.hardwareRevisionStringUUID()){ log("Did read hardware revision string") // FIX ME: This is not how the original thing worked. - delegate.didReadHardwareRevisionString(NSString(CString:characteristic.description, encoding: NSUTF8StringEncoding)!) + delegate.didReadHardwareRevisionString(NSString(CString:characteristic.description, encoding: NSUTF8StringEncoding)! as String) } } else { diff --git a/nRF8001-Swift/ViewController.swift b/nRF8001-Swift/ViewController.swift index 8e9db06..d638be7 100644 --- a/nRF8001-Swift/ViewController.swift +++ b/nRF8001-Swift/ViewController.swift @@ -15,7 +15,7 @@ class ViewController: UIViewController, NRFManagerDelegate { override func viewDidLoad() { super.viewDidLoad() - + nrfManager = NRFManager( onConnect: { self.log("C: ★ Connected") @@ -29,10 +29,10 @@ class ViewController: UIViewController, NRFManagerDelegate { }, autoConnect: false ) - + nrfManager.verbose = true nrfManager.delegate = self - + setupUI() } @@ -67,41 +67,41 @@ extension ViewController { func setupUI() { view.addSubview(feedbackView) - feedbackView.setTranslatesAutoresizingMaskIntoConstraints(false) + feedbackView.translatesAutoresizingMaskIntoConstraints = false feedbackView.layer.borderWidth = 1 feedbackView.editable = false - let connectButton:UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton + let connectButton:UIButton = UIButton(type: .System) view.addSubview(connectButton) connectButton.setTitle("Connect", forState: UIControlState.Normal) - connectButton.setTranslatesAutoresizingMaskIntoConstraints(false) + connectButton.translatesAutoresizingMaskIntoConstraints = false connectButton.addTarget(nrfManager, action: "connect", forControlEvents: UIControlEvents.TouchUpInside) - let disconnectButton:UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton + let disconnectButton:UIButton = UIButton(type: .System) view.addSubview(disconnectButton) disconnectButton.setTitle("Disconnect", forState: UIControlState.Normal) - disconnectButton.setTranslatesAutoresizingMaskIntoConstraints(false) + disconnectButton.translatesAutoresizingMaskIntoConstraints = false disconnectButton.addTarget(nrfManager, action: "disconnect", forControlEvents: UIControlEvents.TouchUpInside) - let sendButton:UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton + let sendButton:UIButton = UIButton(type: .System) view.addSubview(sendButton) sendButton.setTitle("Send Data", forState: UIControlState.Normal) - sendButton.setTranslatesAutoresizingMaskIntoConstraints(false) + sendButton.translatesAutoresizingMaskIntoConstraints = false sendButton.addTarget(self, action: "sendData", forControlEvents: UIControlEvents.TouchUpInside) - view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[f]-|", options: nil, metrics: nil, views: ["f":feedbackView])) - view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[c]-|", options: nil, metrics: nil, views: ["c":connectButton])) - view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[d]-|", options: nil, metrics: nil, views: ["d":disconnectButton])) - view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[s]-|", options: nil, metrics: nil, views: ["s":sendButton])) - view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-20-[f]-[c]-[d]-[s]-20-|", options: nil, metrics: nil, views: ["f":feedbackView,"c":connectButton,"d":disconnectButton,"s":sendButton])) + view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[f]-|", options: [], metrics: nil, views: ["f":feedbackView])) + view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[c]-|", options: [], metrics: nil, views: ["c":connectButton])) + view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[d]-|", options: [], metrics: nil, views: ["d":disconnectButton])) + view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[s]-|", options: [], metrics: nil, views: ["s":sendButton])) + view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-20-[f]-[c]-[d]-[s]-20-|", options: [], metrics: nil, views: ["f":feedbackView,"c":connectButton,"d":disconnectButton,"s":sendButton])) } func log(string:String) { - println(string) + print(string) feedbackView.text = feedbackView.text + "\(string)\n" - feedbackView.scrollRangeToVisible(NSMakeRange(countElements(feedbackView.text as String), 1)) + feedbackView.scrollRangeToVisible(NSMakeRange(feedbackView.text.characters.count , 1)) } } diff --git a/nRF8001-Swift/nRF8001-Swift-Bridging-Header.h b/nRF8001-Swift/nRF8001-Swift-Bridging-Header.h deleted file mode 100644 index 1b2cb5d..0000000 --- a/nRF8001-Swift/nRF8001-Swift-Bridging-Header.h +++ /dev/null @@ -1,4 +0,0 @@ -// -// Use this file to import your target's public headers that you would like to expose to Swift. -// - diff --git a/nRF8001-SwiftTests/Info.plist b/nRF8001-SwiftTests/Info.plist deleted file mode 100644 index e96bf20..0000000 --- a/nRF8001-SwiftTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - nl.xonaymedia.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/nRF8001-SwiftTests/nRF8001_SwiftTests.swift b/nRF8001-SwiftTests/nRF8001_SwiftTests.swift deleted file mode 100644 index 0064734..0000000 --- a/nRF8001-SwiftTests/nRF8001_SwiftTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// nRF8001_SwiftTests.swift -// nRF8001-SwiftTests -// -// Created by Michael Teeuw on 31-07-14. -// Copyright (c) 2014 Michael Teeuw. All rights reserved. -// - -import UIKit -import XCTest - -class nRF8001_SwiftTests: 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. - } - } - -}