-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 Added view controller and storyboard for Firmware Revision String …
…characteristic
- Loading branch information
Showing
4 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ller/GATT Characteristic Editors/FirmwareRevisionStringCharacteristicViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
BluetoothExplorer/FirmwareRevisionStringCharacteristic.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |