fleibility.
This commit is contained in:
parent
93e11b7de8
commit
3bedd7b29c
@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="H1p-Uh-vWS">
|
||||
<device id="retina6_1" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="H1p-Uh-vWS">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@ -66,11 +64,11 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="4Uk-eQ-EQn">
|
||||
<rect key="frame" x="0.0" y="146" width="414" height="716"/>
|
||||
<rect key="frame" x="0.0" y="200" width="414" height="662"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="t3y-r5-cMH" style="IBUITableViewCellStyleDefault" id="k2y-BR-khS">
|
||||
<rect key="frame" x="0.0" y="28" width="414" height="44"/>
|
||||
<rect key="frame" x="0.0" y="28" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="k2y-BR-khS" id="NRL-rD-eae">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
||||
@ -89,14 +87,13 @@
|
||||
</prototypes>
|
||||
</tableView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="IP:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SXL-ds-O0O">
|
||||
<rect key="frame" x="20" y="101.5" width="18.5" height="19.5"/>
|
||||
<rect key="frame" x="20" y="103.5" width="18.5" height="19.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter IP" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8ES-JF-wQQ">
|
||||
<rect key="frame" x="46.5" y="96" width="301.5" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<rect key="frame" x="46.5" y="96" width="301.5" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numbersAndPunctuation" returnKeyType="done" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no" textContentType="url"/>
|
||||
</textField>
|
||||
@ -114,26 +111,41 @@
|
||||
<action selector="requestMolecules:" destination="d7m-B4-a2J" eventType="touchUpInside" id="Ub3-dN-BVq"/>
|
||||
</connections>
|
||||
</button>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="3L8-9h-yx4">
|
||||
<rect key="frame" x="16" y="150" width="382" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="2CU-cR-deF"/>
|
||||
</constraints>
|
||||
<segments>
|
||||
<segment title="none"/>
|
||||
<segment title="listItem"/>
|
||||
<segment title="stackItem"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="4Uk-eQ-EQn" firstAttribute="bottom" secondItem="sWB-DD-mBr" secondAttribute="bottom" id="1EE-Zt-vT1"/>
|
||||
<constraint firstItem="3L8-9h-yx4" firstAttribute="leading" secondItem="sWB-DD-mBr" secondAttribute="leading" constant="16" id="48E-7j-TO2"/>
|
||||
<constraint firstItem="4Uk-eQ-EQn" firstAttribute="leading" secondItem="sWB-DD-mBr" secondAttribute="leading" id="5h4-de-VEb"/>
|
||||
<constraint firstItem="8ES-JF-wQQ" firstAttribute="centerY" secondItem="SXL-ds-O0O" secondAttribute="centerY" id="62j-61-bE9"/>
|
||||
<constraint firstItem="4Uk-eQ-EQn" firstAttribute="top" secondItem="8ES-JF-wQQ" secondAttribute="bottom" constant="20" id="A4e-rm-tbe"/>
|
||||
<constraint firstItem="8ES-JF-wQQ" firstAttribute="leading" secondItem="SXL-ds-O0O" secondAttribute="trailing" constant="8" id="AL1-Zm-i3c"/>
|
||||
<constraint firstItem="sWB-DD-mBr" firstAttribute="trailing" secondItem="4Uk-eQ-EQn" secondAttribute="trailing" id="DhH-Gw-OdP"/>
|
||||
<constraint firstItem="LWi-u3-TWQ" firstAttribute="leading" secondItem="8ES-JF-wQQ" secondAttribute="trailing" constant="16" id="Edc-z4-keA"/>
|
||||
<constraint firstItem="SXL-ds-O0O" firstAttribute="leading" secondItem="sWB-DD-mBr" secondAttribute="leading" constant="20" id="FIo-Dp-pZs"/>
|
||||
<constraint firstItem="sWB-DD-mBr" firstAttribute="trailing" secondItem="LWi-u3-TWQ" secondAttribute="trailing" constant="20" id="Ink-aD-8d1"/>
|
||||
<constraint firstItem="8ES-JF-wQQ" firstAttribute="top" secondItem="sWB-DD-mBr" secondAttribute="top" constant="8" id="aPy-EJ-zp5"/>
|
||||
<constraint firstItem="4Uk-eQ-EQn" firstAttribute="top" secondItem="3L8-9h-yx4" secondAttribute="bottom" constant="20" id="eEA-7A-fc9"/>
|
||||
<constraint firstItem="sWB-DD-mBr" firstAttribute="trailing" secondItem="3L8-9h-yx4" secondAttribute="trailing" constant="16" id="feH-wS-PhX"/>
|
||||
<constraint firstItem="LWi-u3-TWQ" firstAttribute="top" secondItem="sWB-DD-mBr" secondAttribute="top" constant="8" id="jjz-l8-hnl"/>
|
||||
<constraint firstItem="3L8-9h-yx4" firstAttribute="top" secondItem="8ES-JF-wQQ" secondAttribute="bottom" constant="20" id="u0i-ww-R34"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="sWB-DD-mBr"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="QQY-EX-HwK"/>
|
||||
<connections>
|
||||
<outlet property="ipTextField" destination="8ES-JF-wQQ" id="ngi-c0-NuP"/>
|
||||
<outlet property="listOptionControl" destination="3L8-9h-yx4" id="ywL-8P-2B1"/>
|
||||
<outlet property="requestButton" destination="LWi-u3-TWQ" id="SxK-RZ-esy"/>
|
||||
<outlet property="tableView" destination="4Uk-eQ-EQn" id="l5E-2O-dib"/>
|
||||
</connections>
|
||||
|
||||
@ -17,6 +17,7 @@ class MasterViewController: UIViewController, UITableViewDelegate, UITableViewDa
|
||||
@IBOutlet weak var tableView: UITableView!
|
||||
@IBOutlet weak var ipTextField: UITextField!
|
||||
@IBOutlet weak var requestButton: UIButton!
|
||||
@IBOutlet weak var listOptionControl: UISegmentedControl!
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
@ -64,7 +65,30 @@ class MasterViewController: UIViewController, UITableViewDelegate, UITableViewDa
|
||||
|
||||
func getData(for indexPath: IndexPath) -> String? {
|
||||
|
||||
return structureModels[indexPath.section].structures[indexPath.row].value
|
||||
let selectedValue = structureModels[indexPath.section].structures[indexPath.row].value
|
||||
|
||||
// TODO:... Pretty much all '\t' need an additional \t...
|
||||
|
||||
switch listOptionControl.selectedSegmentIndex {
|
||||
case 1:
|
||||
return """
|
||||
{
|
||||
"moleculeName": "listItem",
|
||||
"molecule": \(selectedValue)
|
||||
}
|
||||
"""
|
||||
|
||||
case 2:
|
||||
return """
|
||||
{
|
||||
"moleculeName": "stackItem",
|
||||
"molecule": \(selectedValue)
|
||||
}
|
||||
"""
|
||||
|
||||
default:
|
||||
return selectedValue
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -162,6 +186,8 @@ class MasterViewController: UIViewController, UITableViewDelegate, UITableViewDa
|
||||
|
||||
private func fetchAllMolecules(from json: Any?) {
|
||||
|
||||
structureModels = []
|
||||
|
||||
guard let serverJSON = json,
|
||||
let data = try? JSONSerialization.data(withJSONObject: serverJSON, options: .prettyPrinted),
|
||||
let convertedString = String(data: data, encoding: .utf8)?.data(using: .utf8),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user