Skip to content

Commit 4b792f3

Browse files
committed
ARKit 2 Image Tracking Demo
Enables Harry Potter style moving images, living movie posters, video postcards, paper-thin "displays," and lots more AR fun
1 parent 9f3a171 commit 4b792f3

File tree

22 files changed

+659
-74
lines changed

22 files changed

+659
-74
lines changed

Diff for: Tracked Images.xcodeproj/project.pbxproj

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
DECAFDDA20D16F780003B902 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DECAFDD820D16F780003B902 /* Main.storyboard */; };
1414
DECAFDDC20D16F7B0003B902 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DECAFDDB20D16F7B0003B902 /* Assets.xcassets */; };
1515
DECAFDDF20D16F7B0003B902 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DECAFDDD20D16F7B0003B902 /* LaunchScreen.storyboard */; };
16+
DECAFDE720D1728A0003B902 /* ViewController+ARSessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECAFDE620D1728A0003B902 /* ViewController+ARSessionDelegate.swift */; };
17+
DECAFDEB20D174910003B902 /* StatusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECAFDEA20D174910003B902 /* StatusViewController.swift */; };
1618
/* End PBXBuildFile section */
1719

1820
/* Begin PBXFileReference section */
@@ -24,6 +26,8 @@
2426
DECAFDDB20D16F7B0003B902 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2527
DECAFDDE20D16F7B0003B902 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2628
DECAFDE020D16F7B0003B902 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
29+
DECAFDE620D1728A0003B902 /* ViewController+ARSessionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewController+ARSessionDelegate.swift"; sourceTree = "<group>"; };
30+
DECAFDEA20D174910003B902 /* StatusViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusViewController.swift; sourceTree = "<group>"; };
2731
/* End PBXFileReference section */
2832

2933
/* Begin PBXFrameworksBuildPhase section */
@@ -56,10 +60,12 @@
5660
DECAFDD120D16F780003B902 /* Tracked Images */ = {
5761
isa = PBXGroup;
5862
children = (
63+
DECAFDEA20D174910003B902 /* StatusViewController.swift */,
5964
DECAFDD220D16F780003B902 /* AppDelegate.swift */,
6065
DECAFDD420D16F780003B902 /* art.scnassets */,
6166
DECAFDD620D16F780003B902 /* ViewController.swift */,
6267
DECAFDD820D16F780003B902 /* Main.storyboard */,
68+
DECAFDE620D1728A0003B902 /* ViewController+ARSessionDelegate.swift */,
6369
DECAFDDB20D16F7B0003B902 /* Assets.xcassets */,
6470
DECAFDDD20D16F7B0003B902 /* LaunchScreen.storyboard */,
6571
DECAFDE020D16F7B0003B902 /* Info.plist */,
@@ -139,6 +145,8 @@
139145
isa = PBXSourcesBuildPhase;
140146
buildActionMask = 2147483647;
141147
files = (
148+
DECAFDEB20D174910003B902 /* StatusViewController.swift in Sources */,
149+
DECAFDE720D1728A0003B902 /* ViewController+ARSessionDelegate.swift in Sources */,
142150
DECAFDD720D16F780003B902 /* ViewController.swift in Sources */,
143151
DECAFDD320D16F780003B902 /* AppDelegate.swift in Sources */,
144152
);
@@ -284,6 +292,7 @@
284292
isa = XCBuildConfiguration;
285293
buildSettings = {
286294
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
295+
CODE_SIGN_IDENTITY = "iPhone Developer";
287296
CODE_SIGN_STYLE = Automatic;
288297
DEVELOPMENT_TEAM = 25A3U75D5Z;
289298
INFOPLIST_FILE = "Tracked Images/Info.plist";
@@ -293,6 +302,7 @@
293302
);
294303
PRODUCT_BUNDLE_IDENTIFIER = "com.kalopsiac.Tracked-Images";
295304
PRODUCT_NAME = "$(TARGET_NAME)";
305+
PROVISIONING_PROFILE_SPECIFIER = "";
296306
SWIFT_VERSION = 4.2;
297307
TARGETED_DEVICE_FAMILY = "1,2";
298308
};
@@ -302,6 +312,7 @@
302312
isa = XCBuildConfiguration;
303313
buildSettings = {
304314
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
315+
CODE_SIGN_IDENTITY = "iPhone Developer";
305316
CODE_SIGN_STYLE = Automatic;
306317
DEVELOPMENT_TEAM = 25A3U75D5Z;
307318
INFOPLIST_FILE = "Tracked Images/Info.plist";
@@ -311,6 +322,7 @@
311322
);
312323
PRODUCT_BUNDLE_IDENTIFIER = "com.kalopsiac.Tracked-Images";
313324
PRODUCT_NAME = "$(TARGET_NAME)";
325+
PROVISIONING_PROFILE_SPECIFIER = "";
314326
SWIFT_VERSION = 4.2;
315327
TARGETED_DEVICE_FAMILY = "1,2";
316328
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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>SchemeUserState</key>
6+
<dict>
7+
<key>Tracked Images.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>

Diff for: Tracked Images/AppDelegate.swift

+15-30
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,25 @@
77
//
88

99
import UIKit
10+
import ARKit
1011

1112
@UIApplicationMain
1213
class AppDelegate: UIResponder, UIApplicationDelegate {
13-
1414
var window: UIWindow?
15-
16-
17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18-
// Override point for customization after application launch.
15+
16+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
17+
guard ARWorldTrackingConfiguration.isSupported else {
18+
fatalError("""
19+
ARKit is not available on this device. For apps that require ARKit
20+
for core functionality, use the `arkit` key in the key in the
21+
`UIRequiredDeviceCapabilities` section of the Info.plist to prevent
22+
the app from installing. (If the app can't be installed, this error
23+
can't be triggered in a production scenario.)
24+
In apps where AR is an additive feature, use `isSupported` to
25+
determine whether to show UI for launching AR experiences.
26+
""") // For details, see https://developer.apple.com/documentation/arkit
27+
}
28+
1929
return true
2030
}
21-
22-
func applicationWillResignActive(_ application: UIApplication) {
23-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24-
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25-
}
26-
27-
func applicationDidEnterBackground(_ application: UIApplication) {
28-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29-
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30-
}
31-
32-
func applicationWillEnterForeground(_ application: UIApplication) {
33-
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34-
}
35-
36-
func applicationDidBecomeActive(_ application: UIApplication) {
37-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38-
}
39-
40-
func applicationWillTerminate(_ application: UIApplication) {
41-
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42-
}
43-
44-
4531
}
46-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
},
6+
"resources" : [
7+
{
8+
"filename" : "fight club image.arreferenceimage"
9+
},
10+
{
11+
"filename" : "homer image.arreferenceimage"
12+
},
13+
{
14+
"filename" : "isa image.arreferenceimage"
15+
},
16+
{
17+
"filename" : "prague image.arreferenceimage"
18+
}
19+
]
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "Screen Shot 2018-06-13 at 1.21.10 PM.png"
6+
}
7+
],
8+
"info" : {
9+
"version" : 1,
10+
"author" : "xcode"
11+
},
12+
"properties" : {
13+
"width" : 8
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "Screen Shot 2018-06-13 at 1.35.31 PM.png"
6+
}
7+
],
8+
"info" : {
9+
"version" : 1,
10+
"author" : "xcode"
11+
},
12+
"properties" : {
13+
"width" : 4
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "Screen Shot 2018-06-13 at 12.03.10 AM.png"
6+
}
7+
],
8+
"info" : {
9+
"version" : 1,
10+
"author" : "xcode"
11+
},
12+
"properties" : {
13+
"width" : 6
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "Screen Shot 2018-06-13 at 2.02.00 PM.png"
6+
}
7+
],
8+
"info" : {
9+
"version" : 1,
10+
"author" : "xcode"
11+
},
12+
"properties" : {
13+
"width" : 6.5
14+
}
15+
}

0 commit comments

Comments
 (0)