Present add shortcut modally

This commit is contained in:
Davide De Rosa 2019-03-28 08:24:39 +01:00
parent a89b040c44
commit 487b0c07ca
3 changed files with 49 additions and 19 deletions

View File

@ -201,4 +201,8 @@ class ShortcutsAddViewController: UITableViewController, TableModelHost {
private func addShortcut(with intent: INIntent) {
delegate?.shortcutsDidSelectIntent(intent: intent)
}
@IBAction private func close() {
dismiss(animated: true, completion: nil)
}
}

View File

@ -119,7 +119,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
// MARK: Actions
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let vc = segue.destination as? ShortcutsAddViewController {
if let nav = segue.destination as? UINavigationController, let vc = nav.topViewController as? ShortcutsAddViewController {
vc.delegate = self
}
}
@ -216,7 +216,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
func shortcutsDidSelectIntent(intent: INIntent) {
pendingShortcut = INShortcut(intent: intent)
navigationController?.popToViewController(self, animated: true)
dismiss(animated: true, completion: nil)
}
// MARK: INUIAddVoiceShortcutViewControllerDelegate

View File

@ -1,35 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Dh1-Xv-FiO">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="Wns-en-92E">
<objects>
<navigationController id="6Cw-6b-1Xa" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="0DQ-O0-YTg">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="mG2-gQ-aPy" kind="relationship" relationship="rootViewController" id="4Ib-Qa-Swk"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3gI-8D-ozo" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="673" y="-815"/>
</scene>
<!--Shortcuts Add View Controller-->
<scene sceneID="F0m-Xp-5pf">
<objects>
<tableViewController id="mG2-gQ-aPy" customClass="ShortcutsAddViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="Iib-qS-k2f">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingTableViewCell" textLabel="uM1-Q0-TNy" detailTextLabel="3qI-Ca-OLt" style="IBUITableViewCellStyleValue1" id="fOB-T2-oQ9" customClass="SettingTableViewCell" customModule="Passepartout" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="600" height="44"/>
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fOB-T2-oQ9" id="lKF-U0-Np6">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="uM1-Q0-TNy">
<rect key="frame" x="20" y="12" width="33.5" height="20.5"/>
<rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="3qI-Ca-OLt">
<rect key="frame" x="536" y="12" width="44" height="20.5"/>
<rect key="frame" x="315" y="12" width="44" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
@ -44,7 +64,13 @@
<outlet property="delegate" destination="mG2-gQ-aPy" id="wNK-aT-dNi"/>
</connections>
</tableView>
<navigationItem key="navigationItem" id="Yck-NS-FzJ"/>
<navigationItem key="navigationItem" id="Yck-NS-FzJ">
<barButtonItem key="leftBarButtonItem" systemItem="stop" id="pmc-n7-Rh1">
<connections>
<action selector="close" destination="mG2-gQ-aPy" id="P1T-me-5ro"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<segue destination="zpj-mS-isI" kind="show" identifier="ConnectToSegueIdentifier" id="Qer-qI-Oyn"/>
</connections>
@ -58,26 +84,26 @@
<objects>
<tableViewController id="zpj-mS-isI" customClass="ShortcutsConnectToViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="srP-K7-dae">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingTableViewCell" textLabel="4LM-xw-0Rx" detailTextLabel="4RM-B9-uCO" style="IBUITableViewCellStyleValue1" id="aw4-ca-yyE" customClass="SettingTableViewCell" customModule="Passepartout" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="600" height="44"/>
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="aw4-ca-yyE" id="HBB-Gp-iw2">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4LM-xw-0Rx">
<rect key="frame" x="20" y="12" width="33.5" height="20.5"/>
<rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4RM-B9-uCO">
<rect key="frame" x="536" y="12" width="44" height="20.5"/>
<rect key="frame" x="315" y="12" width="44" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
@ -130,26 +156,26 @@
<objects>
<tableViewController id="br5-OH-3al" customClass="ShortcutsViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="dtc-j9-MHJ">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingTableViewCell" textLabel="QvK-JJ-pYE" detailTextLabel="Df7-oa-jnK" rowHeight="64" style="IBUITableViewCellStyleSubtitle" id="9v0-YX-ro9" customClass="SettingTableViewCell" customModule="Passepartout" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="600" height="64"/>
<rect key="frame" x="0.0" y="55.5" width="375" height="64"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="9v0-YX-ro9" id="Ubx-m0-uOE">
<rect key="frame" x="0.0" y="0.0" width="600" height="63.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="63.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QvK-JJ-pYE">
<rect key="frame" x="20" y="12" width="33.5" height="20.5"/>
<rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Df7-oa-jnK">
<rect key="frame" x="20" y="35.5" width="33" height="14.5"/>
<rect key="frame" x="16" y="35.5" width="33" height="14.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
@ -172,7 +198,7 @@
</barButtonItem>
</navigationItem>
<connections>
<segue destination="mG2-gQ-aPy" kind="show" identifier="ShortcutAddSegueIdentifier" id="tmC-OL-AXU"/>
<segue destination="6Cw-6b-1Xa" kind="presentation" identifier="ShortcutAddSegueIdentifier" id="Mnc-d9-blv"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="s4j-l7-Hi8" userLabel="First Responder" sceneMemberID="firstResponder"/>