Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ResourceApp/rswift
R.generated.swift
ResourceApp/rswift.log
ResourceApp/rswift-tv.log
ResourceApp/rswift-watchos.log
Pods
fastlane/test_output
fastlane/README.md
Expand Down
3 changes: 3 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ abstract_target 'Shared' do
target 'ResourceApp-tvOS' do
platform :tvos, '9.0'
end
target 'ResourceApp-watchOS-Extension' do
platform :watchos, '2.2'
end
end

6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
R.swift.Library:
:commit: ae88152aab915b35acd333c23836e22ea44246f4
:commit: 4002f22dbc6dbc2fe76c364c46dbd25911af6dd1
:git: https://github.com/mac-cain13/R.swift.Library.git

SPEC CHECKSUMS:
R.swift.Library: cfe85d569d9bae6cb262922db130e7c3a7a5fad1
R.swift.Library: 08f4e67e3cf6ce0f1802d6a477933ddc6c2cf439
SWRevealViewController: 6d3fd97f70112fd7cef9de14df4260eacce4c63a

PODFILE CHECKSUM: dcf609a63a9cb222b7167b110c27de036120bae0
PODFILE CHECKSUM: feb2d125d56abaa9101403aedbf488a7d5445eab

COCOAPODS: 1.7.1
1 change: 1 addition & 0 deletions R.swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Pod::Spec.new do |spec|

spec.ios.deployment_target = '8.0'
spec.tvos.deployment_target = '9.0'
spec.watchos.deployment_target = '2.2'

spec.dependency "R.swift.Library", "~> 5.0.1"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"assets" : [
{
"idiom" : "watch",
"filename" : "Circular.imageset",
"role" : "circular"
},
{
"idiom" : "watch",
"filename" : "Extra Large.imageset",
"role" : "extra-large"
},
{
"idiom" : "watch",
"filename" : "Modular.imageset",
"role" : "modular"
},
{
"idiom" : "watch",
"filename" : "Utilitarian.imageset",
"role" : "utilitarian"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
56 changes: 56 additions & 0 deletions ResourceApp/ResourceApp-watchOS-Extension/ExtensionDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// ExtensionDelegate.swift
// ResourceApp-watchOS Extension
//
// Created by Lammert Westerhoff on 28/08/2018.
// Copyright © 2018 Mathijs Kadijk. All rights reserved.
//

import WatchKit

class ExtensionDelegate: NSObject, WKExtensionDelegate {

func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
}

func applicationDidBecomeActive() {
// 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.
}

func applicationWillResignActive() {
// 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, etc.
}

func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
// 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.
for task in backgroundTasks {
// Use a switch statement to check the task type
switch task {
case let backgroundTask as WKApplicationRefreshBackgroundTask:
// Be sure to complete the background task once you’re done.
backgroundTask.setTaskCompletedWithSnapshot(false)
case let snapshotTask as WKSnapshotRefreshBackgroundTask:
// Snapshot tasks have a unique completion call, make sure to set your expiration date
snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil)
case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask:
// Be sure to complete the connectivity task once you’re done.
connectivityTask.setTaskCompletedWithSnapshot(false)
case let urlSessionTask as WKURLSessionRefreshBackgroundTask:
// Be sure to complete the URL session task once you’re done.
urlSessionTask.setTaskCompletedWithSnapshot(false)
case let relevantShortcutTask as WKRelevantShortcutRefreshBackgroundTask:
// Be sure to complete the relevant-shortcut task once you're done.
relevantShortcutTask.setTaskCompletedWithSnapshot(false)
case let intentDidRunTask as WKIntentDidRunRefreshBackgroundTask:
// Be sure to complete the intent-did-run task once you're done.
intentDidRunTask.setTaskCompletedWithSnapshot(false)
default:
// make sure to complete unhandled task types
task.setTaskCompletedWithSnapshot(false)
}
}
}

}
36 changes: 36 additions & 0 deletions ResourceApp/ResourceApp-watchOS-Extension/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>ResourceApp-watchOS Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>nl.mathijskadijk.ResourceApp.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>WKExtensionDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).ExtensionDelegate</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// InterfaceController.swift
// ResourceApp-watchOS Extension
//
// Created by Lammert Westerhoff on 28/08/2018.
// Copyright © 2018 Mathijs Kadijk. All rights reserved.
//

import WatchKit
import Foundation

import Rswift

class InterfaceController: WKInterfaceController {

@IBOutlet weak var label: WKInterfaceLabel!

override func awake(withContext context: Any?) {
super.awake(withContext: context)

label.setText(R.string.localizable.quote(11))
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// NotificationController.swift
// ResourceApp-watchOS Extension
//
// Created by Lammert Westerhoff on 28/08/2018.
// Copyright © 2018 Mathijs Kadijk. All rights reserved.
//

import WatchKit
import Foundation
import UserNotifications


class NotificationController: WKUserNotificationInterfaceController {

override init() {
// Initialize variables here.
super.init()

// Configure interface objects here.
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

override func didReceive(_ notification: UNNotification) {
// This method is called when a notification needs to be presented.
// Implement it if you use a dynamic notification interface.
// Populate your dynamic notification interface as quickly as possible.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"aps": {
"alert": {
"body": "Test message",
"title": "Optional title",
"subtitle": "Optional subtitle"
},
"category": "myCategory",
"thread-id":"5280"
},

"WatchKit Simulator Actions": [
{
"title": "First Button",
"identifier": "firstButtonAction"
}
],

"customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
Localizable.strings
ResourceApp

Created by Lammert Westerhoff on 28/08/2018.
Copyright © 2018 Mathijs Kadijk. All rights reserved.
*/

one = Zero; // Duplicate keys are ignored, a warning from R.swift would be nice
one = One;
two = 2;

"quote" = "There are %d lights!";
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Localizable.strings
ResourceApp

Created by Lammert Westerhoff on 28/08/2018.
Copyright © 2018 Mathijs Kadijk. All rights reserved.
*/


one = Uno;
two = 2;

"quote" = "Hay %d luces!";

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Localizable.strings
ResourceApp

Created by Lammert Westerhoff on 28/08/2018.
Copyright © 2018 Mathijs Kadijk. All rights reserved.
*/


one = "一つ";
two = 2;

"quote" = "%dつの光があります!";
"japanese only" = "Not translated in other languages, and there is no Base";
Loading