Skip to content

Commit 40b54da

Browse files
committed
The first version of our implemented face recognition demo.
1 parent 106406b commit 40b54da

File tree

67 files changed

+4344
-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.

67 files changed

+4344
-0
lines changed

FaceRecognition-Bridging-Header.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+
#import "facesdk/facesdk.h"

FaceRecognition.xcodeproj/project.pbxproj

+712
Large diffs are not rendered by default.

FaceRecognition.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
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>FaceRecognition.xcscheme_^#shared#^_</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>

FaceRecognition/.DS_Store

6 KB
Binary file not shown.
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import UIKit
2+
import AVFoundation
3+
4+
class AboutViewController: UIViewController{
5+
6+
override func viewDidLoad() {
7+
super.viewDidLoad()
8+
// Do any additional setup after loading the view.
9+
}
10+
11+
12+
@IBAction func done_clicked(_ sender: Any) {
13+
if let vc = self.presentingViewController as? ViewController {
14+
self.dismiss(animated: true, completion: nil)
15+
}
16+
}
17+
18+
19+
@IBAction func mail_clicked(_ sender: Any) {
20+
let appURL = URL(string: "mailto:[email protected]") // URL scheme for Mail app
21+
22+
if let appURL = appURL, UIApplication.shared.canOpenURL(appURL) {
23+
// If Mail app is installed, open it with a pre-filled email
24+
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
25+
} else {
26+
// If Mail app is not installed, show an alert indicating that Mail app is not available
27+
let alert = UIAlertController(title: "Mail App Not Available", message: "The Mail app is not installed on this device.", preferredStyle: .alert)
28+
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
29+
alert.addAction(okAction)
30+
UIApplication.shared.keyWindow?.rootViewController?.present(alert, animated: true, completion: nil)
31+
}
32+
}
33+
34+
35+
@IBAction func skype_clicked(_ sender: Any) {
36+
37+
}
38+
39+
@IBAction func telegram_clicked(_ sender: Any) {
40+
let appURL = URL(string: "tg://resolve?domain=kbyai") // URL scheme for Telegram app
41+
42+
if let appURL = appURL, UIApplication.shared.canOpenURL(appURL) {
43+
// If Telegram app is installed, open it to the "Add Contact" screen
44+
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
45+
} else {
46+
let username = "kbyai"
47+
let telegramURL = URL(string: "https://t.me/\(username)")!
48+
UIApplication.shared.open(telegramURL, options: [:], completionHandler: nil)
49+
}
50+
}
51+
52+
@IBAction func whatsapp_clicked(_ sender: Any) {
53+
let appURL = URL(string: "whatsapp://send?phone=+19092802609") // URL scheme for Telegram app
54+
55+
if let appURL = appURL, UIApplication.shared.canOpenURL(appURL) {
56+
// If Telegram app is installed, open it to the "Add Contact" screen
57+
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
58+
} else {
59+
let username = "+19092802609"
60+
let telegramURL = URL(string: "https://wa.me/\(username)")!
61+
UIApplication.shared.open(telegramURL, options: [:], completionHandler: nil)
62+
}
63+
}
64+
65+
@IBAction func github_clicked(_ sender: Any) {
66+
let telegramURL = URL(string: "https://github.com/kby-ai")!
67+
UIApplication.shared.open(telegramURL, options: [:], completionHandler: nil)
68+
}
69+
}
70+

FaceRecognition/AppDelegate.swift

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
import UIKit
3+
import CoreData
4+
5+
@main
6+
class AppDelegate: UIResponder, UIApplicationDelegate {
7+
8+
9+
10+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
11+
// Override point for customization after application launch.
12+
return true
13+
}
14+
15+
// MARK: UISceneSession Lifecycle
16+
17+
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
18+
// Called when a new scene session is being created.
19+
// Use this method to select a configuration to create the new scene with.
20+
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
21+
}
22+
23+
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
24+
// Called when the user discards a scene session.
25+
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
26+
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
27+
}
28+
29+
// MARK: - Core Data stack
30+
31+
lazy var persistentContainer: NSPersistentContainer = {
32+
/*
33+
The persistent container for the application. This implementation
34+
creates and returns a container, having loaded the store for the
35+
application to it. This property is optional since there are legitimate
36+
error conditions that could cause the creation of the store to fail.
37+
*/
38+
let container = NSPersistentContainer(name: "FaceRecognition")
39+
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
40+
if let error = error as NSError? {
41+
// Replace this implementation with code to handle the error appropriately.
42+
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
43+
44+
/*
45+
Typical reasons for an error here include:
46+
* The parent directory does not exist, cannot be created, or disallows writing.
47+
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
48+
* The device is out of space.
49+
* The store could not be migrated to the current model version.
50+
Check the error message to determine what the actual problem was.
51+
*/
52+
fatalError("Unresolved error \(error), \(error.userInfo)")
53+
}
54+
})
55+
return container
56+
}()
57+
58+
// MARK: - Core Data Saving support
59+
60+
func saveContext () {
61+
let context = persistentContainer.viewContext
62+
if context.hasChanges {
63+
do {
64+
try context.save()
65+
} catch {
66+
// Replace this implementation with code to handle the error appropriately.
67+
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
68+
let nserror = error as NSError
69+
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
70+
}
71+
}
72+
}
73+
74+
}
75+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "appstore.png",
5+
"idiom" : "universal",
6+
"platform" : "ios",
7+
"size" : "1024x1024"
8+
}
9+
],
10+
"info" : {
11+
"author" : "xcode",
12+
"version" : 1
13+
}
14+
}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "0x33",
9+
"green" : "0x30",
10+
"red" : "0x30"
11+
}
12+
},
13+
"idiom" : "universal"
14+
},
15+
{
16+
"appearances" : [
17+
{
18+
"appearance" : "luminosity",
19+
"value" : "dark"
20+
}
21+
],
22+
"color" : {
23+
"color-space" : "srgb",
24+
"components" : {
25+
"alpha" : "1.000",
26+
"blue" : "0x33",
27+
"green" : "0x30",
28+
"red" : "0x30"
29+
}
30+
},
31+
"idiom" : "universal"
32+
}
33+
],
34+
"info" : {
35+
"author" : "xcode",
36+
"version" : 1
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "0.545",
9+
"green" : "0.216",
10+
"red" : "0.310"
11+
}
12+
},
13+
"idiom" : "universal"
14+
},
15+
{
16+
"appearances" : [
17+
{
18+
"appearance" : "luminosity",
19+
"value" : "dark"
20+
}
21+
],
22+
"color" : {
23+
"color-space" : "srgb",
24+
"components" : {
25+
"alpha" : "1.000",
26+
"blue" : "0.545",
27+
"green" : "0.216",
28+
"red" : "0.310"
29+
}
30+
},
31+
"idiom" : "universal"
32+
}
33+
],
34+
"info" : {
35+
"author" : "xcode",
36+
"version" : 1
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "1.000",
9+
"green" : "0.867",
10+
"red" : "0.918"
11+
}
12+
},
13+
"idiom" : "universal"
14+
},
15+
{
16+
"appearances" : [
17+
{
18+
"appearance" : "luminosity",
19+
"value" : "dark"
20+
}
21+
],
22+
"color" : {
23+
"color-space" : "srgb",
24+
"components" : {
25+
"alpha" : "1.000",
26+
"blue" : "1.000",
27+
"green" : "0.867",
28+
"red" : "0.918"
29+
}
30+
},
31+
"idiom" : "universal"
32+
}
33+
],
34+
"info" : {
35+
"author" : "xcode",
36+
"version" : 1
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "0xE5",
9+
"green" : "0xE1",
10+
"red" : "0xE6"
11+
}
12+
},
13+
"idiom" : "universal"
14+
},
15+
{
16+
"appearances" : [
17+
{
18+
"appearance" : "luminosity",
19+
"value" : "dark"
20+
}
21+
],
22+
"color" : {
23+
"color-space" : "srgb",
24+
"components" : {
25+
"alpha" : "1.000",
26+
"blue" : "0xE5",
27+
"green" : "0xE1",
28+
"red" : "0xE6"
29+
}
30+
},
31+
"idiom" : "universal"
32+
}
33+
],
34+
"info" : {
35+
"author" : "xcode",
36+
"version" : 1
37+
}
38+
}

0 commit comments

Comments
 (0)