Skip to content

Commit 250ee36

Browse files
committed
add target for test
1 parent 4f0d0c8 commit 250ee36

File tree

15 files changed

+646
-3
lines changed

15 files changed

+646
-3
lines changed

test/Binary.xcodeproj/project.pbxproj

Lines changed: 295 additions & 3 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "watch",
5+
"scale" : "2x",
6+
"screen-width" : "<=145"
7+
},
8+
{
9+
"idiom" : "watch",
10+
"scale" : "2x",
11+
"screen-width" : ">145"
12+
}
13+
],
14+
"info" : {
15+
"version" : 1,
16+
"author" : "xcode"
17+
}
18+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"assets" : [
3+
{
4+
"idiom" : "watch",
5+
"filename" : "Circular.imageset",
6+
"role" : "circular"
7+
},
8+
{
9+
"idiom" : "watch",
10+
"filename" : "Extra Large.imageset",
11+
"role" : "extra-large"
12+
},
13+
{
14+
"idiom" : "watch",
15+
"filename" : "Modular.imageset",
16+
"role" : "modular"
17+
},
18+
{
19+
"idiom" : "watch",
20+
"filename" : "Utilitarian.imageset",
21+
"role" : "utilitarian"
22+
}
23+
],
24+
"info" : {
25+
"version" : 1,
26+
"author" : "xcode"
27+
}
28+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "watch",
5+
"scale" : "2x",
6+
"screen-width" : "<=145"
7+
},
8+
{
9+
"idiom" : "watch",
10+
"scale" : "2x",
11+
"screen-width" : ">145"
12+
}
13+
],
14+
"info" : {
15+
"version" : 1,
16+
"author" : "xcode"
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "watch",
5+
"scale" : "2x",
6+
"screen-width" : "<=145"
7+
},
8+
{
9+
"idiom" : "watch",
10+
"scale" : "2x",
11+
"screen-width" : ">145"
12+
}
13+
],
14+
"info" : {
15+
"version" : 1,
16+
"author" : "xcode"
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "watch",
5+
"scale" : "2x",
6+
"screen-width" : "<=145"
7+
},
8+
{
9+
"idiom" : "watch",
10+
"scale" : "2x",
11+
"screen-width" : ">145"
12+
}
13+
],
14+
"info" : {
15+
"version" : 1,
16+
"author" : "xcode"
17+
}
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// ExtensionDelegate.swift
3+
// BinaryWatch Extension
4+
//
5+
// Created by Gao on 2018/7/7.
6+
// Copyright © 2018 me.leavez. All rights reserved.
7+
//
8+
9+
import WatchKit
10+
11+
class ExtensionDelegate: NSObject, WKExtensionDelegate {
12+
13+
func applicationDidFinishLaunching() {
14+
// Perform any final initialization of your application.
15+
}
16+
17+
func applicationDidBecomeActive() {
18+
// 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.
19+
}
20+
21+
func applicationWillResignActive() {
22+
// 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.
23+
// Use this method to pause ongoing tasks, disable timers, etc.
24+
}
25+
26+
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
27+
// Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one.
28+
for task in backgroundTasks {
29+
// Use a switch statement to check the task type
30+
switch task {
31+
case let backgroundTask as WKApplicationRefreshBackgroundTask:
32+
// Be sure to complete the background task once you’re done.
33+
backgroundTask.setTaskCompletedWithSnapshot(false)
34+
case let snapshotTask as WKSnapshotRefreshBackgroundTask:
35+
// Snapshot tasks have a unique completion call, make sure to set your expiration date
36+
snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil)
37+
case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask:
38+
// Be sure to complete the connectivity task once you’re done.
39+
connectivityTask.setTaskCompletedWithSnapshot(false)
40+
case let urlSessionTask as WKURLSessionRefreshBackgroundTask:
41+
// Be sure to complete the URL session task once you’re done.
42+
urlSessionTask.setTaskCompletedWithSnapshot(false)
43+
case let relevantShortcutTask as WKRelevantShortcutRefreshBackgroundTask:
44+
// Be sure to complete the relevant-shortcut task once you're done.
45+
relevantShortcutTask.setTaskCompletedWithSnapshot(false)
46+
case let intentDidRunTask as WKIntentDidRunRefreshBackgroundTask:
47+
// Be sure to complete the intent-did-run task once you're done.
48+
intentDidRunTask.setTaskCompletedWithSnapshot(false)
49+
default:
50+
// make sure to complete unhandled task types
51+
task.setTaskCompletedWithSnapshot(false)
52+
}
53+
}
54+
}
55+
56+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>BinaryWatch Extension</string>
9+
<key>CFBundleExecutable</key>
10+
<string>$(EXECUTABLE_NAME)</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>XPC!</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>NSExtension</key>
24+
<dict>
25+
<key>NSExtensionAttributes</key>
26+
<dict>
27+
<key>WKAppBundleIdentifier</key>
28+
<string>me.leavez.Binary.watchkitapp</string>
29+
</dict>
30+
<key>NSExtensionPointIdentifier</key>
31+
<string>com.apple.watchkit</string>
32+
</dict>
33+
<key>WKExtensionDelegateClassName</key>
34+
<string>$(PRODUCT_MODULE_NAME).ExtensionDelegate</string>
35+
</dict>
36+
</plist>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// InterfaceController.swift
3+
// BinaryWatch Extension
4+
//
5+
// Created by Gao on 2018/7/7.
6+
// Copyright © 2018 me.leavez. All rights reserved.
7+
//
8+
9+
import WatchKit
10+
import Foundation
11+
12+
13+
class InterfaceController: WKInterfaceController {
14+
15+
override func awake(withContext context: Any?) {
16+
super.awake(withContext: context)
17+
18+
// Configure interface objects here.
19+
}
20+
21+
override func willActivate() {
22+
// This method is called when watch view controller is about to be visible to user
23+
super.willActivate()
24+
}
25+
26+
override func didDeactivate() {
27+
// This method is called when watch view controller is no longer visible
28+
super.didDeactivate()
29+
}
30+
31+
}

0 commit comments

Comments
 (0)