Skip to content

Commit 865cf6a

Browse files
committed
Add touch support
1 parent 0916ba9 commit 865cf6a

File tree

4 files changed

+46
-12
lines changed

4 files changed

+46
-12
lines changed

quickstart-ios-swift.xcodeproj/project.pbxproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 52;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -324,6 +324,7 @@
324324
ONLY_ACTIVE_ARCH = YES;
325325
SDKROOT = iphoneos;
326326
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
327+
SWIFT_INSTALL_OBJC_HEADER = YES;
327328
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
328329
};
329330
name = Debug;
@@ -377,6 +378,7 @@
377378
MTL_FAST_MATH = YES;
378379
SDKROOT = iphoneos;
379380
SWIFT_COMPILATION_MODE = wholemodule;
381+
SWIFT_INSTALL_OBJC_HEADER = YES;
380382
SWIFT_OPTIMIZATION_LEVEL = "-O";
381383
VALIDATE_PRODUCT = YES;
382384
};
@@ -459,7 +461,7 @@
459461
repositoryURL = "https://github.com/DeepARSDK/swift-deepar";
460462
requirement = {
461463
kind = upToNextMajorVersion;
462-
minimumVersion = 5.4.0;
464+
minimumVersion = 5.4.3;
463465
};
464466
};
465467
/* End XCRemoteSwiftPackageReference section */

quickstart-ios-swift.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/DeepARSDK/swift-deepar",
77
"state" : {
8-
"revision" : "6001506c6a0b2695bc7ec0c3d0cb5c4cfeab9d03",
9-
"version" : "5.4.3"
8+
"revision" : "70c6f4812c303d0c12fc40653ada4f090fc94c22",
9+
"version" : "5.4.4"
1010
}
1111
}
1212
],

quickstart-ios-swift/Base.lproj/Main.storyboard

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="DMk-4X-Ojf">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="System colors in document resources" minToolsVersion="11.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -55,7 +55,7 @@
5555
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
5656
</view>
5757
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="uJd-FE-xhl">
58-
<rect key="frame" x="0.0" y="692" width="414" height="102"/>
58+
<rect key="frame" x="0.0" y="720" width="414" height="102"/>
5959
<subviews>
6060
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oM4-3a-Dc3">
6161
<rect key="frame" x="0.0" y="16" width="138" height="70"/>
@@ -81,24 +81,24 @@
8181
</subviews>
8282
</stackView>
8383
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" spacing="40" translatesAutoresizingMaskIntoConstraints="NO" id="zkT-19-D7n" userLabel="Recording Mode Stack View">
84-
<rect key="frame" x="76" y="643" width="262" height="44"/>
84+
<rect key="frame" x="76.5" y="671" width="261" height="44"/>
8585
<subviews>
8686
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pFL-eO-IRm" userLabel="Photo">
87-
<rect key="frame" x="0.0" y="0.0" width="46" height="44"/>
87+
<rect key="frame" x="0.0" y="0.0" width="45" height="44"/>
8888
<fontDescription key="fontDescription" type="system" pointSize="17"/>
8989
<state key="normal" title="Photo">
9090
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
9191
</state>
9292
</button>
9393
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mIr-ia-DAb" userLabel="Video">
94-
<rect key="frame" x="86" y="0.0" width="44" height="44"/>
94+
<rect key="frame" x="85" y="0.0" width="44" height="44"/>
9595
<fontDescription key="fontDescription" type="system" pointSize="17"/>
9696
<state key="normal" title="Video">
9797
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
9898
</state>
9999
</button>
100100
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wtJ-rs-9IX" userLabel="LowQ Video">
101-
<rect key="frame" x="170" y="0.0" width="92" height="44"/>
101+
<rect key="frame" x="169" y="0.0" width="92" height="44"/>
102102
<fontDescription key="fontDescription" type="system" pointSize="17"/>
103103
<state key="normal" title="LowQ Video">
104104
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -110,7 +110,7 @@
110110
</constraints>
111111
</stackView>
112112
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OLW-sN-mKx">
113-
<rect key="frame" x="24" y="60" width="44" height="44"/>
113+
<rect key="frame" x="24" y="64" width="44" height="44"/>
114114
<constraints>
115115
<constraint firstAttribute="height" constant="44" id="MBk-dg-Yhn"/>
116116
<constraint firstAttribute="width" constant="44" id="Z8O-KQ-a84"/>

quickstart-ios-swift/ViewController.swift

+32
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,38 @@ class ViewController: UIViewController {
253253
private func didTapLowQVideoButton() {
254254
currentRecordingMode = .lowQualityVideo
255255
}
256+
257+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
258+
super.touchesBegan(touches, with: event)
259+
let touch = touches.first
260+
let point = touch?.location(in: self.arView)
261+
let info = TouchInfo(x: point!.x, y: point!.y, type: TouchType.START);
262+
self.deepAR.touchOccurred(info)
263+
}
264+
265+
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
266+
super.touchesMoved(touches, with: event)
267+
let touch = touches.first
268+
let point = touch?.location(in: self.arView)
269+
let info = TouchInfo(x: point!.x, y: point!.y, type: TouchType.MOVE);
270+
self.deepAR.touchOccurred(info)
271+
}
272+
273+
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
274+
super.touchesEnded(touches, with: event)
275+
let touch = touches.first
276+
let point = touch?.location(in: self.arView)
277+
let info = TouchInfo(x: point!.x, y: point!.y, type: TouchType.END);
278+
self.deepAR.touchOccurred(info)
279+
}
280+
281+
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
282+
super.touchesCancelled(touches, with: event)
283+
let touch = touches.first
284+
let point = touch?.location(in: self.arView)
285+
let info = TouchInfo(x: point!.x, y: point!.y, type: TouchType.END);
286+
self.deepAR.touchOccurred(info)
287+
}
256288
}
257289

258290
// MARK: - ARViewDelegate -

0 commit comments

Comments
 (0)