Skip to content

Commit 412b341

Browse files
committed
IntentHandling: Version 1.0, 2016-09-13
First release The IntentHandling sample is a collection of projects showing how to use the Intents framework to handle custom Siri request in different domains.
1 parent 99e75cd commit 412b341

File tree

68 files changed

+5397
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5397
-0
lines changed

IntentHandling/IntentHandling.xcworkspace/contents.xcworkspacedata

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

IntentHandling/LICENSE.txt

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Sample code project: IntentHandling: Using the Intents framework to handle custom Siri request
2+
Version: 1.0
3+
4+
IMPORTANT: This Apple software is supplied to you by Apple
5+
Inc. ("Apple") in consideration of your agreement to the following
6+
terms, and your use, installation, modification or redistribution of
7+
this Apple software constitutes acceptance of these terms. If you do
8+
not agree with these terms, please do not use, install, modify or
9+
redistribute this Apple software.
10+
11+
In consideration of your agreement to abide by the following terms, and
12+
subject to these terms, Apple grants you a personal, non-exclusive
13+
license, under Apple's copyrights in this original Apple software (the
14+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
15+
Software, with or without modifications, in source and/or binary forms;
16+
provided that if you redistribute the Apple Software in its entirety and
17+
without modifications, you must retain this notice and the following
18+
text and disclaimers in all such redistributions of the Apple Software.
19+
Neither the name, trademarks, service marks or logos of Apple Inc. may
20+
be used to endorse or promote products derived from the Apple Software
21+
without specific prior written permission from Apple. Except as
22+
expressly stated in this notice, no other rights or licenses, express or
23+
implied, are granted by Apple herein, including but not limited to any
24+
patent rights that may be infringed by your derivative works or by other
25+
works in which the Apple Software may be incorporated.
26+
27+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
28+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
29+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
30+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
31+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
32+
33+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
34+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
37+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
38+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
39+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
40+
POSSIBILITY OF SUCH DAMAGE.
41+
42+
Copyright (C) 2016 Apple Inc. All Rights Reserved.

IntentHandling/Projects/Ascent/Ascent.xcodeproj/project.pbxproj

+687
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright (C) 2016 Apple Inc. All Rights Reserved.
3+
See LICENSE.txt for this sample’s licensing information
4+
5+
Abstract:
6+
The application delegate.
7+
*/
8+
9+
import UIKit
10+
import Intents
11+
import AscentFramework
12+
13+
@UIApplicationMain
14+
class AppDelegate: UIResponder, UIApplicationDelegate {
15+
16+
var window: UIWindow?
17+
18+
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
19+
// Pass the activity to the `WorkoutsController` to handle.
20+
if let navigationController = window?.rootViewController as? UINavigationController {
21+
restorationHandler(navigationController.viewControllers)
22+
}
23+
24+
return true
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>ParameterVocabularies</key>
6+
<array>
7+
<dict>
8+
<key>ParameterNames</key>
9+
<array>
10+
<string>INStartWorkoutIntent.workoutName</string>
11+
</array>
12+
<key>ParameterVocabulary</key>
13+
<array>
14+
<dict>
15+
<key>VocabularyItemIdentifier</key>
16+
<string>climb</string>
17+
<key>VocabularyItemSynonyms</key>
18+
<array>
19+
<dict>
20+
<key>VocabularyItemPhrase</key>
21+
<string>Climb</string>
22+
<key>VocabularyItemPronunciation</key>
23+
<string>klime</string>
24+
<key>VocabularyItemExamples</key>
25+
<array>
26+
<string>start a climb with ascent</string>
27+
<string>pause the climb with ascent</string>
28+
<string>resume the climb with ascent</string>
29+
<string>end the climb with ascent</string>
30+
<string>cancel the climb with ascent</string>
31+
</array>
32+
</dict>
33+
</array>
34+
</dict>
35+
</array>
36+
</dict>
37+
<dict>
38+
<key>ParameterNames</key>
39+
<array>
40+
<string>INStartWorkoutIntent.workoutName</string>
41+
</array>
42+
<key>ParameterVocabulary</key>
43+
<array>
44+
<dict>
45+
<key>VocabularyItemIdentifier</key>
46+
<string>boulder</string>
47+
<key>VocabularyItemSynonyms</key>
48+
<array>
49+
<dict>
50+
<key>VocabularyItemPhrase</key>
51+
<string>Boulder Climb</string>
52+
<key>VocabularyItemPronunciation</key>
53+
<string>bowlder klime</string>
54+
<key>VocabularyItemExamples</key>
55+
<array>
56+
<string>start a boulder climb with ascent</string>
57+
</array>
58+
</dict>
59+
<dict>
60+
<key>VocabularyItemPhrase</key>
61+
<string>Boulder Workout</string>
62+
<key>VocabularyItemPronunciation</key>
63+
<string>bowlder workout</string>
64+
<key>VocabularyItemExamples</key>
65+
<array>
66+
<string>start a boulder workout with ascent</string>
67+
</array>
68+
</dict>
69+
</array>
70+
</dict>
71+
</array>
72+
</dict>
73+
</array>
74+
<key>IntentPhrases</key>
75+
<array>
76+
<dict>
77+
<key>IntentName</key>
78+
<string>INStartWorkoutIntent</string>
79+
<key>IntentExamples</key>
80+
<array>
81+
<string>Siri, start a climb with ascent</string>
82+
<string>Siri, start a boulder climb with ascent</string>
83+
<string>Siri, start a boulder workout with ascent</string>
84+
</array>
85+
</dict>
86+
</array>
87+
</dict>
88+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.application-groups</key>
6+
<array>
7+
<string>group.com.example.apple-samplecode.Ascent</string>
8+
</array>
9+
</dict>
10+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "29x29",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "40x40",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "40x40",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "60x60",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "60x60",
31+
"scale" : "3x"
32+
}
33+
],
34+
"info" : {
35+
"version" : 1,
36+
"author" : "xcode"
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
5+
</dependencies>
6+
<scenes>
7+
<!--View Controller-->
8+
<scene sceneID="EHf-IW-A2E">
9+
<objects>
10+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
11+
<layoutGuides>
12+
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
13+
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
14+
</layoutGuides>
15+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
16+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<animations/>
19+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
20+
</view>
21+
</viewController>
22+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
23+
</objects>
24+
<point key="canvasLocation" x="53" y="375"/>
25+
</scene>
26+
</scenes>
27+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11163.2" systemVersion="16A239j" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="GTn-q2-dgu">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11133"/>
6+
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8+
</dependencies>
9+
<scenes>
10+
<!--Workouts-->
11+
<scene sceneID="gRy-Ob-joT">
12+
<objects>
13+
<tableViewController id="xGh-5D-svb" customClass="WorkoutsController" customModule="Ascent" customModuleProvider="target" sceneMemberID="viewController">
14+
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="72" sectionHeaderHeight="28" sectionFooterHeight="28" id="aFP-aS-nQf">
15+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
18+
<prototypes>
19+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="WorkoutCell" id="TSC-Ro-vhC" customClass="WorkoutCell" customModule="Ascent" customModuleProvider="target">
20+
<frame key="frameInset" minY="92" width="375" height="72"/>
21+
<autoresizingMask key="autoresizingMask"/>
22+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TSC-Ro-vhC" id="2IL-P8-Qbi">
23+
<frame key="frameInset" width="375" height="72"/>
24+
<autoresizingMask key="autoresizingMask"/>
25+
<subviews>
26+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="ikm-Tp-QYR">
27+
<subviews>
28+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Uh-8V-ViX">
29+
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
30+
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
31+
<nil key="highlightedColor"/>
32+
</label>
33+
<stackView opaque="NO" contentMode="scaleToFill" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="hgN-00-B2B">
34+
<subviews>
35+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zxo-Ce-xad">
36+
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
37+
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
38+
<nil key="highlightedColor"/>
39+
</label>
40+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fzW-NK-t89">
41+
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
42+
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
43+
<nil key="highlightedColor"/>
44+
</label>
45+
</subviews>
46+
</stackView>
47+
</subviews>
48+
</stackView>
49+
</subviews>
50+
<constraints>
51+
<constraint firstItem="ikm-Tp-QYR" firstAttribute="top" secondItem="2IL-P8-Qbi" secondAttribute="topMargin" constant="6" id="633-Ts-hgx"/>
52+
<constraint firstAttribute="trailingMargin" secondItem="ikm-Tp-QYR" secondAttribute="trailing" id="buy-Ce-s5z"/>
53+
<constraint firstItem="ikm-Tp-QYR" firstAttribute="leading" secondItem="2IL-P8-Qbi" secondAttribute="leadingMargin" constant="7" id="i5M-J7-1EN"/>
54+
<constraint firstAttribute="bottomMargin" secondItem="ikm-Tp-QYR" secondAttribute="bottom" constant="7" id="mgj-nq-TIu"/>
55+
</constraints>
56+
</tableViewCellContentView>
57+
<connections>
58+
<outlet property="climbDescriptionLabel" destination="3Uh-8V-ViX" id="mpz-7d-plE"/>
59+
<outlet property="goalDescriptionLabel" destination="zxo-Ce-xad" id="B2A-42-li2"/>
60+
<outlet property="stateLabel" destination="fzW-NK-t89" id="54d-AY-ODz"/>
61+
</connections>
62+
</tableViewCell>
63+
</prototypes>
64+
<connections>
65+
<outlet property="dataSource" destination="xGh-5D-svb" id="xQJ-xH-DIb"/>
66+
<outlet property="delegate" destination="xGh-5D-svb" id="R16-cC-ceQ"/>
67+
</connections>
68+
</tableView>
69+
<navigationItem key="navigationItem" title="Workouts" id="O2W-b6-jl0"/>
70+
</tableViewController>
71+
<placeholder placeholderIdentifier="IBFirstResponder" id="nsq-sV-DXV" userLabel="First Responder" sceneMemberID="firstResponder"/>
72+
</objects>
73+
<point key="canvasLocation" x="1016.8" y="-174.06296851574214"/>
74+
</scene>
75+
<!--Navigation Controller-->
76+
<scene sceneID="TIc-YE-Q5M">
77+
<objects>
78+
<navigationController id="GTn-q2-dgu" sceneMemberID="viewController">
79+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="xzp-Wm-hk3">
80+
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
81+
<autoresizingMask key="autoresizingMask"/>
82+
</navigationBar>
83+
<connections>
84+
<segue destination="xGh-5D-svb" kind="relationship" relationship="rootViewController" id="DiX-qL-YDa"/>
85+
</connections>
86+
</navigationController>
87+
<placeholder placeholderIdentifier="IBFirstResponder" id="x24-3U-RST" userLabel="First Responder" sceneMemberID="firstResponder"/>
88+
</objects>
89+
<point key="canvasLocation" x="66" y="-174"/>
90+
</scene>
91+
</scenes>
92+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>UILaunchStoryboardName</key>
26+
<string>LaunchScreen</string>
27+
<key>UIMainStoryboardFile</key>
28+
<string>Main</string>
29+
<key>NSUserActivityTypes</key>
30+
<array>
31+
<string>com.example.apple-samplecode.Ascent.startWorkout</string>
32+
<string>com.example.apple-samplecode.Ascent.pauseWorkout</string>
33+
<string>com.example.apple-samplecode.Ascent.resumeWorkout</string>
34+
<string>com.example.apple-samplecode.Ascent.endWorkout</string>
35+
<string>com.example.apple-samplecode.Ascent.cancelWorkout</string>
36+
</array>
37+
<key>UIRequiredDeviceCapabilities</key>
38+
<array>
39+
<string>armv7</string>
40+
</array>
41+
<key>UISupportedInterfaceOrientations</key>
42+
<array>
43+
<string>UIInterfaceOrientationPortrait</string>
44+
<string>UIInterfaceOrientationLandscapeLeft</string>
45+
<string>UIInterfaceOrientationLandscapeRight</string>
46+
</array>
47+
</dict>
48+
</plist>

0 commit comments

Comments
 (0)