diff --git a/Example/Podfile b/Example/Podfile index 396887bb..08010e5e 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,4 +1,5 @@ source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '10.3' use_frameworks! target 'xDripG5_Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9d30a5a1..1846c6be 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: ../ SPEC CHECKSUMS: - xDripG5: 8779a4f495fd8eb81a3d75457afe9b95fb52f61d + xDripG5: 95e385a36ebcf3f42e44dae73fb6490dc5b79904 -PODFILE CHECKSUM: 6b30cba971694d5258509315fb52eb645c9bc5e3 +PODFILE CHECKSUM: c62f3fcb344335d79abdcccea268615000e8801b -COCOAPODS: 1.1.0.rc.2 +COCOAPODS: 1.3.1 diff --git a/Example/xDripG5.xcodeproj/project.pbxproj b/Example/xDripG5.xcodeproj/project.pbxproj index 02b5616c..3d615fcc 100644 --- a/Example/xDripG5.xcodeproj/project.pbxproj +++ b/Example/xDripG5.xcodeproj/project.pbxproj @@ -202,13 +202,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-xDripG5_Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 2FC4228A9369221D367ED688 /* [CP] Copy Pods Resources */ = { @@ -232,9 +235,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-xDripG5_Example/Pods-xDripG5_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/xDripG5/xDripG5.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/xDripG5.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -381,8 +387,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = F3147B948B4F90A741304461 /* Pods-xDripG5_Example.debug.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = xDripG5/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; @@ -397,8 +404,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = CFBD776BFE02F42998A8820B /* Pods-xDripG5_Example.release.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = xDripG5/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; diff --git a/Example/xDripG5/AppDelegate.swift b/Example/xDripG5/AppDelegate.swift index f230f6d9..b1ddb6ec 100644 --- a/Example/xDripG5/AppDelegate.swift +++ b/Example/xDripG5/AppDelegate.swift @@ -24,7 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { transmitter = Transmitter( - ID: UserDefaults.standard.transmitterID, + id: UserDefaults.standard.transmitterID, passiveModeEnabled: UserDefaults.standard.passiveModeEnabled ) transmitter?.stayConnected = UserDefaults.standard.stayConnected @@ -73,24 +73,24 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate { }() func transmitter(_ transmitter: Transmitter, didError error: Error) { - if let vc = window?.rootViewController as? TransmitterDelegate { - DispatchQueue.main.async { + DispatchQueue.main.async { + if let vc = self.window?.rootViewController as? TransmitterDelegate { vc.transmitter(transmitter, didError: error) } } } func transmitter(_ transmitter: Transmitter, didRead glucose: Glucose) { - if let vc = window?.rootViewController as? TransmitterDelegate { - DispatchQueue.main.async { + DispatchQueue.main.async { + if let vc = self.window?.rootViewController as? TransmitterDelegate { vc.transmitter(transmitter, didRead: glucose) } } } func transmitter(_ transmitter: Transmitter, didReadUnknownData data: Data) { - if let vc = window?.rootViewController as? TransmitterDelegate { - DispatchQueue.main.async { + DispatchQueue.main.async { + if let vc = self.window?.rootViewController as? TransmitterDelegate { vc.transmitter(transmitter, didReadUnknownData: data) } } diff --git a/Example/xDripG5/ViewController.swift b/Example/xDripG5/ViewController.swift index faef5334..35c27737 100644 --- a/Example/xDripG5/ViewController.swift +++ b/Example/xDripG5/ViewController.swift @@ -68,9 +68,9 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate if let text = textField.text { let newString = text.replacingCharacters(in: range.rangeOfString(text), with: string) - if newString.characters.count > 6 { + if newString.count > 6 { return false - } else if newString.characters.count == 6 { + } else if newString.count == 6 { AppDelegate.sharedDelegate.transmitter?.ID = newString UserDefaults.standard.transmitterID = newString @@ -86,7 +86,7 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate } func textFieldDidEndEditing(_ textField: UITextField) { - if textField.text?.characters.count != 6 { + if textField.text?.count != 6 { textField.text = UserDefaults.standard.transmitterID } } @@ -129,8 +129,8 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate private extension NSRange { func rangeOfString(_ string: String) -> Range { - let startIndex = string.characters.index(string.startIndex, offsetBy: location) - let endIndex = string.characters.index(startIndex, offsetBy: length) + let startIndex = string.index(string.startIndex, offsetBy: location) + let endIndex = string.index(startIndex, offsetBy: length) return startIndex.. "loudnate@gmail.com" } s.source = { :git => "https://github.com/LoopKit/xDripG5.git", :tag => s.version.to_s } - s.platform = :ios, '9.3' + s.platform = :ios, '10.3' s.requires_arc = true s.source_files = ['xDripG5/**/*.swift', 'xDripG5/AESCrypt.{h,m}', 'Pod/*.h'] diff --git a/xDripG5/Transmitter.swift b/xDripG5/Transmitter.swift index 1b48956c..5a27a513 100644 --- a/xDripG5/Transmitter.swift +++ b/xDripG5/Transmitter.swift @@ -30,7 +30,12 @@ public final class Transmitter: BluetoothManagerDelegate { /// The ID of the transmitter to connect to public var ID: String { - return id.id + get { + return id.id + } + set(newID) { + id = TransmitterID(id: newID) + } } private var id: TransmitterID