Skip to content

Commit

Permalink
#1 Added view controller and storyboard for Firmware Revision String …
Browse files Browse the repository at this point in the history
…characteristic
  • Loading branch information
carlos21 committed Jun 25, 2018
1 parent 4eea6ed commit 0af3c75
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 2 deletions.
8 changes: 8 additions & 0 deletions BluetoothExplorer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
35335A0520E1316F006ABD4D /* ModelNumberCharacteristic.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 35335A0420E1316F006ABD4D /* ModelNumberCharacteristic.storyboard */; };
35335A0720E13203006ABD4D /* ModelNumberCharacteristicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35335A0620E13203006ABD4D /* ModelNumberCharacteristicViewController.swift */; };
35335A1220E13FC0006ABD4D /* FirmwareRevisionStringCharacteristic.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 35335A0A20E13FC0006ABD4D /* FirmwareRevisionStringCharacteristic.storyboard */; };
35335A1420E13FF0006ABD4D /* FirmwareRevisionStringCharacteristicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35335A1320E13FF0006ABD4D /* FirmwareRevisionStringCharacteristicViewController.swift */; };
6E13E8CC20D9C7270007111B /* AdvertisementDataManagedObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E13E8CB20D9C7270007111B /* AdvertisementDataManagedObject.swift */; };
6E13E8E320D9D8290007111B /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E13E8E220D9D8290007111B /* TableViewController.swift */; };
6E353A4620D7FDB200E94B73 /* CoreDataEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E353A4520D7FDB200E94B73 /* CoreDataEncodable.swift */; };
Expand Down Expand Up @@ -168,6 +170,8 @@
/* Begin PBXFileReference section */
35335A0420E1316F006ABD4D /* ModelNumberCharacteristic.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ModelNumberCharacteristic.storyboard; sourceTree = "<group>"; };
35335A0620E13203006ABD4D /* ModelNumberCharacteristicViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelNumberCharacteristicViewController.swift; sourceTree = "<group>"; };
35335A0A20E13FC0006ABD4D /* FirmwareRevisionStringCharacteristic.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = FirmwareRevisionStringCharacteristic.storyboard; sourceTree = "<group>"; };
35335A1320E13FF0006ABD4D /* FirmwareRevisionStringCharacteristicViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirmwareRevisionStringCharacteristicViewController.swift; sourceTree = "<group>"; };
6E13E8CB20D9C7270007111B /* AdvertisementDataManagedObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvertisementDataManagedObject.swift; sourceTree = "<group>"; };
6E13E8E220D9D8290007111B /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
6E353A4520D7FDB200E94B73 /* CoreDataEncodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataEncodable.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -265,6 +269,7 @@
6E98B6992059B51000B6F016 /* Main.storyboard */,
6EDE00CE20DB12B3002E951A /* BatteryLevelCharacteristic.storyboard */,
35335A0420E1316F006ABD4D /* ModelNumberCharacteristic.storyboard */,
35335A0A20E13FC0006ABD4D /* FirmwareRevisionStringCharacteristic.storyboard */,
6E98B69C2059B51000B6F016 /* Assets.xcassets */,
6E98B6A12059B51000B6F016 /* Info.plist */,
6E8C68EF20DA04D400232169 /* Async.swift */,
Expand Down Expand Up @@ -345,6 +350,7 @@
children = (
6EDE00D420DB4C84002E951A /* BatteryLevelCharacteristicViewController.swift */,
35335A0620E13203006ABD4D /* ModelNumberCharacteristicViewController.swift */,
35335A1320E13FF0006ABD4D /* FirmwareRevisionStringCharacteristicViewController.swift */,
);
path = "GATT Characteristic Editors";
sourceTree = "<group>";
Expand Down Expand Up @@ -563,6 +569,7 @@
35335A0520E1316F006ABD4D /* ModelNumberCharacteristic.storyboard in Resources */,
6E98B69D2059B51000B6F016 /* Assets.xcassets in Resources */,
6E98B69B2059B51000B6F016 /* Main.storyboard in Resources */,
35335A1220E13FC0006ABD4D /* FirmwareRevisionStringCharacteristic.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -601,6 +608,7 @@
6EDE00C920DB0EB5002E951A /* Data.swift in Sources */,
6EFB3E2520D3E5A600364CA0 /* DeviceStore.swift in Sources */,
6ECCCC7320E091070054663C /* FDGapLayoutGuide.m in Sources */,
35335A1420E13FF0006ABD4D /* FirmwareRevisionStringCharacteristicViewController.swift in Sources */,
6E8C68EA20DA02DA00232169 /* UIAlertAction.swift in Sources */,
35335A0720E13203006ABD4D /* ModelNumberCharacteristicViewController.swift in Sources */,
6EC0D9C720DE076A005FB128 /* Appearance.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// FirmwareRevisionStringCharacteristicsViewController.swift
// BluetoothExplorer
//
// Created by Carlos Duclos on 6/25/18.
// Copyright © 2018 PureSwift. All rights reserved.
//

import UIKit
import Bluetooth

final class FirmareRevisionStringCharacteristicViewController: UIViewController {

// MARK: - IB Outlets

@IBOutlet private(set) var firmwareTextField: UITextField!

// MARK: - Properties

var value: GATTFirmwareRevisionString = ""

var valueDidChange: ((GATTFirmwareRevisionString) -> ())?

// MARK: - Loading

override func viewDidLoad() {
super.viewDidLoad()
}

// MARK: - Actions

@IBAction func textFieldEditingChanged(_ sender: Any) {

guard let text = firmwareTextField.text
else { return }

value = GATTFirmwareRevisionString(rawValue: text)
valueDidChange?(value)
}
}

// MARK: - CharacteristicViewController

extension FirmareRevisionStringCharacteristicViewController: CharacteristicViewController {

static func fromStoryboard() -> FirmareRevisionStringCharacteristicViewController {

let storyboard = UIStoryboard(name: "FirmareRevisionStringCharacteristic", bundle: .main)

let viewController = storyboard.instantiateInitialViewController() as! FirmareRevisionStringCharacteristicViewController

return viewController
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ final class ModelNumberCharacteristicViewController: UIViewController {

// MARK: - IB Outlets

@IBOutlet private(set) var textLabel: UILabel!

@IBOutlet private(set) var modelTextField: UITextField!

// MARK: - Properties
Expand Down
56 changes: 56 additions & 0 deletions BluetoothExplorer/FirmwareRevisionStringCharacteristic.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Firmware Revision String-->
<scene sceneID="2YU-mk-Dtt">
<objects>
<viewController title="Firmware Revision String" id="oms-Lo-Dm1" customClass="FirmareRevisionStringCharacteristicViewController" customModule="BluetoothExplorer" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="7jE-rP-ytQ"/>
<viewControllerLayoutGuide type="bottom" id="zyZ-Rc-zfR"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="B9k-vm-gSb">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Firmware Revision String" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="VcP-tC-U7U">
<rect key="frame" x="40" y="316" width="295" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="9QA-CU-Rh9"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="textFieldEditingChanged:" destination="oms-Lo-Dm1" eventType="editingChanged" id="YFU-Tm-wNj"/>
</connections>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="VcP-tC-U7U" firstAttribute="leading" secondItem="B9k-vm-gSb" secondAttribute="leading" constant="40" id="NMy-e2-702"/>
<constraint firstAttribute="trailing" secondItem="VcP-tC-U7U" secondAttribute="trailing" constant="40" id="XIJ-yp-hiu"/>
<constraint firstItem="VcP-tC-U7U" firstAttribute="centerX" secondItem="B9k-vm-gSb" secondAttribute="centerX" id="hmk-0B-tE5"/>
<constraint firstItem="VcP-tC-U7U" firstAttribute="centerY" secondItem="B9k-vm-gSb" secondAttribute="centerY" id="px1-le-6yj"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Firmware Revision String" id="ghX-3q-eWE"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<connections>
<outlet property="firmwareTextField" destination="VcP-tC-U7U" id="TXq-40-nE4"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2h6-k2-KqZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="91.875" y="62.323943661971832"/>
</scene>
</scenes>
</document>

0 comments on commit 0af3c75

Please sign in to comment.