Repository: riccqi/ARImageTracking
Branch: main
Commit: 37f27c86a639
Files: 14
Total size: 23.7 KB
Directory structure:
gitextract_i6bgeubv/
├── .gitattributes
├── .gitignore
├── ARImageTracking/
│ ├── AppDelegate.swift
│ ├── Assets.xcassets/
│ │ ├── AR Resources.arresourcegroup/
│ │ │ ├── Contents.json
│ │ │ └── xs.arreferenceimage/
│ │ │ └── Contents.json
│ │ ├── AccentColor.colorset/
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset/
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── ContentView.swift
│ ├── Info.plist
│ └── Preview Content/
│ └── Preview Assets.xcassets/
│ └── Contents.json
├── ARImageTracking.xcodeproj/
│ └── project.pbxproj
├── LICENSE
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto
================================================
FILE: .gitignore
================================================
### Xcode ###
## User settings
xcuserdata/
## Xcode 8 and earlier
*.xcscmblueprint
*.xccheckout
### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings
================================================
FILE: ARImageTracking/AppDelegate.swift
================================================
//
// AppDelegate.swift
// ARImageTracking
//
// Created by Qi on 8/1/21.
//
import SwiftUI
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Use a UIHostingController as window root view controller.
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// 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.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// 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.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// 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.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// 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.
}
}
================================================
FILE: ARImageTracking/Assets.xcassets/AR Resources.arresourcegroup/Contents.json
================================================
{
"info" : {
"author" : "xcode",
"version" : 1
},
"resources" : [
{
"filename" : "xs.arreferenceimage"
}
]
}
================================================
FILE: ARImageTracking/Assets.xcassets/AR Resources.arresourcegroup/xs.arreferenceimage/Contents.json
================================================
{
"images" : [
{
"filename" : "xs.jpg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"width" : 2.7999999999999998
}
}
================================================
FILE: ARImageTracking/Assets.xcassets/AccentColor.colorset/Contents.json
================================================
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
================================================
FILE: ARImageTracking/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
================================================
FILE: ARImageTracking/Assets.xcassets/Contents.json
================================================
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
================================================
FILE: ARImageTracking/ContentView.swift
================================================
//
// ContentView.swift
// ARImageTracking
//
// Created by Qi on 8/1/21.
//
import ARKit
import RealityKit
import SwiftUI
// Displays as a SwiftUI View
struct ContentView: View {
var body: some View {
return ARViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARViewContainer: UIViewRepresentable {
var arView = ARView(frame: .zero)
func makeCoordinator() -> Coordinator {
Coordinator(parent: self)
}
class Coordinator: NSObject, ARSessionDelegate {
var parent: ARViewContainer
var videoPlayer: AVPlayer!
init(parent: ARViewContainer) {
self.parent = parent
}
func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
guard let imageAnchor = anchors[0] as? ARImageAnchor else {
print("Problems loading anchor.")
return
}
// Assigns video to be overlaid
guard let path = Bundle.main.path(forResource: "iphonevideo", ofType: "mp4") else {
print("Unable to find video file.")
return
}
let videoURL = URL(fileURLWithPath: path)
let playerItem = AVPlayerItem(url: videoURL)
videoPlayer = AVPlayer(playerItem: playerItem)
let videoMaterial = VideoMaterial(avPlayer: videoPlayer)
// size of video plane depending of the image
let width = Float(imageAnchor.referenceImage.physicalSize.width * 1.03)
let height = Float(imageAnchor.referenceImage.physicalSize.height * 1.03)
// Sets the aspect ratio of the video to be played, and the corner radius of the video
let videoPlane = ModelEntity(mesh: .generatePlane(width: width, depth: height, cornerRadius: 0.3), materials: [videoMaterial])
// Assigns reference image that will be detected
if let imageName = imageAnchor.name, imageName == "xs" {
let anchor = AnchorEntity(anchor: imageAnchor)
// Adds specified video to the anchor
anchor.addChild(videoPlane)
parent.arView.scene.addAnchor(anchor)
}
}
// Checks for tracking status
func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
guard let imageAnchor = anchors[0] as? ARImageAnchor else {
print("Problems loading anchor.")
return
}
// Plays/pauses the video when tracked/loses tracking
if imageAnchor.isTracked {
videoPlayer.play()
} else {
videoPlayer.pause()
}
}
}
func makeUIView(context: Context) -> ARView {
guard let referenceImages = ARReferenceImage.referenceImages(
inGroupNamed: "AR Resources", bundle: nil)
else {
fatalError("Missing expected asset catalog resources.")
}
// Assigns coordinator to delegate the AR View
arView.session.delegate = context.coordinator
let configuration = ARImageTrackingConfiguration()
configuration.isAutoFocusEnabled = true
configuration.trackingImages = referenceImages
configuration.maximumNumberOfTrackedImages = 1
// Enables People Occulusion on supported iOS Devices
if ARWorldTrackingConfiguration.supportsFrameSemantics(.personSegmentationWithDepth) {
configuration.frameSemantics.insert(.personSegmentationWithDepth)
} else {
print("People Segmentation not enabled.")
}
arView.session.run(configuration)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}
================================================
FILE: ARImageTracking/Info.plist
================================================
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
$(PRODUCT_BUNDLE_PACKAGE_TYPE)
CFBundleShortVersionString
1.0
CFBundleVersion
1
LSRequiresIPhoneOS
UILaunchScreen
NSCameraUsageDescription
UIApplicationSupportsIndirectInputEvents
UIRequiredDeviceCapabilities
armv7
arkit
UIStatusBarHidden
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
================================================
FILE: ARImageTracking/Preview Content/Preview Assets.xcassets/Contents.json
================================================
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: ARImageTracking.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
43653C8B25A853E400AD9879 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43653C8A25A853E400AD9879 /* AppDelegate.swift */; };
43653C8D25A853E400AD9879 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43653C8C25A853E400AD9879 /* ContentView.swift */; };
43653C9125A853E800AD9879 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 43653C9025A853E800AD9879 /* Assets.xcassets */; };
43653C9425A853E800AD9879 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 43653C9325A853E800AD9879 /* Preview Assets.xcassets */; };
43653C9D25A854E400AD9879 /* iphonevideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 43653C9C25A854E400AD9879 /* iphonevideo.mp4 */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
43653C8725A853E400AD9879 /* ARImageTracking.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ARImageTracking.app; sourceTree = BUILT_PRODUCTS_DIR; };
43653C8A25A853E400AD9879 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
43653C8C25A853E400AD9879 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
43653C9025A853E800AD9879 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
43653C9325A853E800AD9879 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
43653C9525A853E800AD9879 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43653C9C25A854E400AD9879 /* iphonevideo.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = iphonevideo.mp4; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
43653C8425A853E400AD9879 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
43653C7E25A853E400AD9879 = {
isa = PBXGroup;
children = (
43653C8925A853E400AD9879 /* ARImageTracking */,
43653C8825A853E400AD9879 /* Products */,
);
sourceTree = "";
};
43653C8825A853E400AD9879 /* Products */ = {
isa = PBXGroup;
children = (
43653C8725A853E400AD9879 /* ARImageTracking.app */,
);
name = Products;
sourceTree = "";
};
43653C8925A853E400AD9879 /* ARImageTracking */ = {
isa = PBXGroup;
children = (
43653C8A25A853E400AD9879 /* AppDelegate.swift */,
43653C8C25A853E400AD9879 /* ContentView.swift */,
43653C9C25A854E400AD9879 /* iphonevideo.mp4 */,
43653C9025A853E800AD9879 /* Assets.xcassets */,
43653C9525A853E800AD9879 /* Info.plist */,
43653C9225A853E800AD9879 /* Preview Content */,
);
path = ARImageTracking;
sourceTree = "";
};
43653C9225A853E800AD9879 /* Preview Content */ = {
isa = PBXGroup;
children = (
43653C9325A853E800AD9879 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
43653C8625A853E400AD9879 /* ARImageTracking */ = {
isa = PBXNativeTarget;
buildConfigurationList = 43653C9825A853E800AD9879 /* Build configuration list for PBXNativeTarget "ARImageTracking" */;
buildPhases = (
43653C8325A853E400AD9879 /* Sources */,
43653C8425A853E400AD9879 /* Frameworks */,
43653C8525A853E400AD9879 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ARImageTracking;
productName = ARImageTracking;
productReference = 43653C8725A853E400AD9879 /* ARImageTracking.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
43653C7F25A853E400AD9879 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1230;
LastUpgradeCheck = 1230;
TargetAttributes = {
43653C8625A853E400AD9879 = {
CreatedOnToolsVersion = 12.3;
};
};
};
buildConfigurationList = 43653C8225A853E400AD9879 /* Build configuration list for PBXProject "ARImageTracking" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 43653C7E25A853E400AD9879;
productRefGroup = 43653C8825A853E400AD9879 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
43653C8625A853E400AD9879 /* ARImageTracking */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
43653C8525A853E400AD9879 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
43653C9425A853E800AD9879 /* Preview Assets.xcassets in Resources */,
43653C9125A853E800AD9879 /* Assets.xcassets in Resources */,
43653C9D25A854E400AD9879 /* iphonevideo.mp4 in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
43653C8325A853E400AD9879 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
43653C8D25A853E400AD9879 /* ContentView.swift in Sources */,
43653C8B25A853E400AD9879 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
43653C9625A853E800AD9879 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
43653C9725A853E800AD9879 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
43653C9925A853E800AD9879 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"ARImageTracking/Preview Content\"";
DEVELOPMENT_TEAM = G6E5589J7L;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = ARImageTracking/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ARImageTracking;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
43653C9A25A853E800AD9879 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"ARImageTracking/Preview Content\"";
DEVELOPMENT_TEAM = G6E5589J7L;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = ARImageTracking/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ARImageTracking;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
43653C8225A853E400AD9879 /* Build configuration list for PBXProject "ARImageTracking" */ = {
isa = XCConfigurationList;
buildConfigurations = (
43653C9625A853E800AD9879 /* Debug */,
43653C9725A853E800AD9879 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
43653C9825A853E800AD9879 /* Build configuration list for PBXNativeTarget "ARImageTracking" */ = {
isa = XCConfigurationList;
buildConfigurations = (
43653C9925A853E800AD9879 /* Debug */,
43653C9A25A853E800AD9879 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 43653C7F25A853E400AD9879 /* Project object */;
}
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2021 riccqi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# ARImageTracking
This is an Augmented Reality Xcode project that uses Apple's newest RealityKit framework and ARKit 4 features, to dynamically track a moving image in the real world. It is written in SwiftUI.
The example video and image used in my project is of an iPhone Xs screen recording and iPhone Xs box. Do swap the video and image out to whatever you want to track and overlay. I've commented the entire project to help you adapt the code to your needs!
Contributions are welcome.
Tested on iOS 15.6 and requires an iDevice with an A12 chip or higher to run.